my ($packet, $err) = new Net::DNS::Packet(\$buf, 0);
$err and die $err;
- print "REQUEST:\n";
+ print "REQUEST:\n";
$packet->print;
$packet->header->qr(1);
- $packet->push("authority", new Net::DNS::RR("below.www.example.com 300 NS ns.below.www.example.com"));
- $packet->push("additional", new Net::DNS::RR("ns.below.www.example.com 300 A 10.53.0.3"));
+
+ my @questions = $packet->question;
+ my $qname = $questions[0]->qname;
+
+ if ($qname eq "cname1.example.com") {
+ # Data for the "cname + other data / 1" test
+ $packet->push("answer", new Net::DNS::RR("cname1.example.com 300 CNAME cname1.example.com"));
+ $packet->push("answer", new Net::DNS::RR("cname1.example.com 300 A 1.2.3.4"));
+ } elsif ($qname eq "cname2.example.com") {
+ # Data for the "cname + other data / 2" test: same RRs in opposite order
+ $packet->push("answer", new Net::DNS::RR("cname2.example.com 300 A 1.2.3.4"));
+ $packet->push("answer", new Net::DNS::RR("cname2.example.com 300 CNAME cname2.example.com"));
+ } else {
+ # Data for the "bogus referrals" test
+ $packet->push("authority", new Net::DNS::RR("below.www.example.com 300 NS ns.below.www.example.com"));
+ $packet->push("additional", new Net::DNS::RR("ns.below.www.example.com 300 A 10.53.0.3"));
+ }
$sock->send($packet->data);
# NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
# WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
-# $Id: tests.sh,v 1.3 2000/07/27 09:40:40 tale Exp $
+# $Id: tests.sh,v 1.4 2000/07/28 22:42:41 gson Exp $
SYSTEMTESTTOP=..
. $SYSTEMTESTTOP/conf.sh
-#
-# Perform tests
-#
-
status=0
+echo "I:checking handling of bogus referrals"
# If the server has the "INSIST(!external)" bug, this query will kill it.
-$DIG +tcp example. dig www.example.com. a @10.53.0.1 -p 5300 >/dev/null || status=1
+$DIG +tcp www.example.com. a @10.53.0.1 -p 5300 >/dev/null || status=1
+
+echo "I:check handling of cname + other data / 1"
+$DIG +tcp cname1.example.com. a @10.53.0.1 -p 5300 >/dev/null || status=1
+
+echo "I:check handling of cname + other data / 2"
+$DIG +tcp cname2.example.com. a @10.53.0.1 -p 5300 >/dev/null || status=1
-# Query once more to see if the server is still alive.
-$DIG +tcp example. dig www.example.com. a @10.53.0.1 -p 5300 >/dev/null || status=1
+echo "I:check that server is still running"
+$DIG +tcp www.example.com. a @10.53.0.1 -p 5300 >/dev/null || status=1
echo "I:exit status: $status"
exit $status