mirror of
https://gitlab.isc.org/isc-projects/bind9
synced 2025-08-29 13:38:26 +00:00
Merge branch '2037-deferred-system-test-fix' into 'main'
Unhexlify 2037-pk11_numbits-crash-test.pkt file Closes #2037 See merge request isc-projects/bind9!4047
This commit is contained in:
commit
045478ad6a
@ -31,7 +31,7 @@
|
||||
# Note that we do not wait for a response for the server. This is simply
|
||||
# a way of injecting arbitrary packets to test server resposnes.
|
||||
#
|
||||
# Usage: packet.pl [-a <address>] [-p <port>] [-t (udp|tcp)] [filename]
|
||||
# Usage: packet.pl [-a <address>] [-p <port>] [-t (udp|tcp)] [-r <repeats>] [filename]
|
||||
#
|
||||
# If not specified, address defaults to 127.0.0.1, port to 53, protocol
|
||||
# to udp, and file to stdin.
|
||||
@ -46,12 +46,12 @@ use IO::File;
|
||||
use IO::Socket;
|
||||
|
||||
sub usage {
|
||||
print ("Usage: packet.pl [-a address] [-p port] [-t (tcp|udp)] -d [file]\n");
|
||||
print ("Usage: packet.pl [-a address] [-p port] [-t (tcp|udp)] [-r <repeats>] [file]\n");
|
||||
exit 1;
|
||||
}
|
||||
|
||||
my %options={};
|
||||
getopts("a:dp:t:", \%options);
|
||||
getopts("a:p:t:r:", \%options);
|
||||
|
||||
my $addr = "127.0.0.1";
|
||||
$addr = $options{a} if defined $options{a};
|
||||
@ -63,6 +63,9 @@ my $proto = "udp";
|
||||
$proto = lc $options{t} if defined $options{t};
|
||||
usage if ($proto !~ /^(udp|tcp)$/);
|
||||
|
||||
my $repeats = 1;
|
||||
$repeats = $options{r} if defined $options{r};
|
||||
|
||||
my $file = "STDIN";
|
||||
if (@ARGV >= 1) {
|
||||
my $filename = shift @ARGV;
|
||||
@ -82,12 +85,13 @@ my $data = pack("H*", $input);
|
||||
my $len = length $data;
|
||||
|
||||
my $output = unpack("H*", $data);
|
||||
print ("sending: $output\n");
|
||||
print ("sending $repeats time(s): $output\n");
|
||||
|
||||
my $sock = IO::Socket::INET->new(PeerAddr => $addr, PeerPort => $port,
|
||||
Proto => $proto,) or die "$!";
|
||||
|
||||
my $bytes;
|
||||
while ($repeats > 0) {
|
||||
if ($proto eq "udp") {
|
||||
$bytes = $sock->send($data);
|
||||
} else {
|
||||
@ -95,39 +99,9 @@ if ($proto eq "udp") {
|
||||
$bytes += $sock->syswrite($data, $len);
|
||||
}
|
||||
|
||||
$repeats = $repeats - 1;
|
||||
}
|
||||
|
||||
print ("sent $bytes bytes to $addr:$port\n");
|
||||
if (defined $options{d}) {
|
||||
use Net::DNS;
|
||||
use Net::DNS::Packet;
|
||||
|
||||
my $rin;
|
||||
my $rout;
|
||||
$rin = '';
|
||||
vec($rin, fileno($sock), 1) = 1;
|
||||
select($rout = $rin, undef, undef, 1);
|
||||
if (vec($rout, fileno($sock), 1)) {{
|
||||
my $buf;
|
||||
if ($proto eq "udp") {
|
||||
$sock->recv($buf, 512);
|
||||
} else {
|
||||
my $n = $sock->sysread($buf, 2);
|
||||
last unless $n == 2;
|
||||
my $len = unpack("n", $buf);
|
||||
$n = $sock->sysread($buf, $len);
|
||||
last unless $n == $len;
|
||||
}
|
||||
|
||||
my $response;
|
||||
if ($Net::DNS::VERSION > 0.68) {
|
||||
$response = new Net::DNS::Packet(\$buf, 0);
|
||||
$@ and die $@;
|
||||
} else {
|
||||
my $err;
|
||||
($response, $err) = new Net::DNS::Packet(\$buf, 0);
|
||||
$err and die $err;
|
||||
}
|
||||
$response->print;
|
||||
}}
|
||||
}
|
||||
$sock->close;
|
||||
close $file;
|
||||
|
@ -1,20 +1,20 @@
|
||||
00000000: 0137 edda 2800 0001 0000 0001 0000 0972 .7..(..........r
|
||||
00000010: 7361 7368 6132 3536 0765 7861 6d70 6c65 sasha256.example
|
||||
00000020: 0000 0600 01c0 0c00 3000 0100 0001 2c01 ........0.....,.
|
||||
00000030: 0801 0003 0803 0100 0100 0000 0000 0000 ................
|
||||
00000040: 0000 0000 0000 0000 0000 0000 0000 0000 ................
|
||||
00000050: 0000 0000 0000 0000 0000 0000 0000 0000 ................
|
||||
00000060: 0000 0000 0000 0000 0000 0000 0000 0000 ................
|
||||
00000070: 0000 0000 0000 0000 0000 0000 0000 0000 ................
|
||||
00000080: 0000 0000 0000 0000 0000 0000 0000 0000 ................
|
||||
00000090: 0000 0000 0000 0000 0000 0000 0000 0000 ................
|
||||
000000a0: 0000 0000 0000 0000 0000 0000 0000 0000 ................
|
||||
000000b0: 0000 0000 0000 0000 0000 0000 0000 0000 ................
|
||||
000000c0: 0000 0000 0000 0000 0000 0000 0000 0000 ................
|
||||
000000d0: 0000 0000 0000 0000 0000 0000 0000 0000 ................
|
||||
000000e0: 0000 0000 0000 0000 0000 0000 0000 0000 ................
|
||||
000000f0: 0000 0000 0000 0000 0000 0000 0000 0000 ................
|
||||
00000100: 0000 0000 0000 0000 0000 0000 0000 0000 ................
|
||||
00000110: 0000 0000 0000 0000 0000 0000 0000 0000 ................
|
||||
00000120: 0000 0000 0000 0000 0000 0000 0000 0000 ................
|
||||
00000130: 0000 0000 0000 0000 00 .........
|
||||
edda 2800 0001 0000 0001 0000 0972 7361
|
||||
7368 6132 3536 0765 7861 6d70 6c65 0000
|
||||
0600 01c0 0c00 3000 0100 0001 2c01 0801
|
||||
0003 0803 0100 0100 0000 0000 0000 0000
|
||||
0000 0000 0000 0000 0000 0000 0000 0000
|
||||
0000 0000 0000 0000 0000 0000 0000 0000
|
||||
0000 0000 0000 0000 0000 0000 0000 0000
|
||||
0000 0000 0000 0000 0000 0000 0000 0000
|
||||
0000 0000 0000 0000 0000 0000 0000 0000
|
||||
0000 0000 0000 0000 0000 0000 0000 0000
|
||||
0000 0000 0000 0000 0000 0000 0000 0000
|
||||
0000 0000 0000 0000 0000 0000 0000 0000
|
||||
0000 0000 0000 0000 0000 0000 0000 0000
|
||||
0000 0000 0000 0000 0000 0000 0000 0000
|
||||
0000 0000 0000 0000 0000 0000 0000 0000
|
||||
0000 0000 0000 0000 0000 0000 0000 0000
|
||||
0000 0000 0000 0000 0000 0000 0000 0000
|
||||
0000 0000 0000 0000 0000 0000 0000 0000
|
||||
0000 0000 0000 0000 0000 0000 0000 0000
|
||||
0000 0000 0000 00
|
||||
|
Binary file not shown.
@ -186,7 +186,7 @@ status=$((status + ret))
|
||||
n=$((n + 1))
|
||||
echo_i "checking that BIND 9 doesn't crash on long TCP messages ($n)"
|
||||
ret=0
|
||||
$PERL ../packet.pl -a "10.53.0.1" -p "${PORT}" -t udp 1996-alloc_dnsbuf-crash-test.pkt || ret=1
|
||||
$PERL ../packet.pl -a "10.53.0.1" -p "${PORT}" -t tcp -r 300000 1996-alloc_dnsbuf-crash-test.pkt || ret=1
|
||||
dig_with_opts +tcp @10.53.0.1 txt.example > dig.out.test$n || ret=1
|
||||
if [ $ret != 0 ]; then echo_i "failed"; fi
|
||||
status=$((status + ret))
|
||||
|
Loading…
x
Reference in New Issue
Block a user