[net-dns-users] Severe Net::DNS bug waiting to be fixed

Willem Toorop willem at nlnetlabs.nl
Thu Jul 18 12:14:01 UTC 2013


Thanks. To make tests succeed with Net::DNS::SEC 0.16, I also had to put
in a dummy header into Packet:

--- Packet.pm	2013-07-18 13:39:10.870079091 +0200
+++ Packet.pm	2013-07-18 13:41:42.598078205 +0200
@@ -67,6 +67,7 @@
 		additional => []}, $class;

 	$self->{question} = [Net::DNS::Question->new(@_)] if scalar @_;
+	$self->{header} = {}; # Backw. compatibility with Net::DNS::SEC

 	$self->header->rd(1);
 	return $self;
@@ -126,7 +127,8 @@
 			answer	   => [],
 			authority  => [],
 			additional => [],
-			answersize => length $$data
+			answersize => length $$data,
+			header     => {} # BW compat. with Net::DNS::SEC
 			}, $class;

 		# question/zone section

I also added some more default initializations for status:

--- Header.pm.orig	2013-07-18 14:07:07.778069322 +0200
+++ Header.pm	2013-07-18 13:54:13.878073831 +0200
@@ -139,7 +139,7 @@
 sub opcode {
 	my $self = shift;
 	my $xpkt = $self->{xbody};
-	for ( $xpkt->{status} ) {
+	for ( $xpkt->{status} ||= 0 ) {
 		return opcodebyval(( $_ >> 11) & 0x0f) unless scalar @_;
 		my $opcode = opcodebyname(shift);
 		$_ = ( $_ & 0x87ff ) | ( $opcode << 11 );
@@ -160,7 +160,7 @@
 sub rcode {
 	my $self = shift;
 	my $xpkt = $self->{xbody};
-	for ( $xpkt->{status} ) {
+	for ( $xpkt->{status} ||= 0 ) {
 		my $arg = shift;
 		my $opt = $self->edns;
 		unless ( defined $arg ) {

Do you agree?

-- Willem

Op 18-07-13 12:59, Dick Franks schreef:
> Willem,
> 
> Attached tarball patches Header and Packet to solve memory leak.
> I am still looking at the implications for Net::DNS::SEC
> 
> Dick Franks




More information about the net-dns-users mailing list