[net-dns-users] Can't call method "zclass" on an undefined value at ... Net/DNS/Packet.pm line 474

Wessels, Duane dwessels at verisign.com
Thu Jun 25 18:37:53 UTC 2015


An issue was reported to the fpdns repository:

  https://github.com/kirei/fpdns/issues/8

I traced through the code, found what fpdns is doing and replicated it in the small program below.

  1 #!/usr/bin/perl
  2 use strict;
  3 use warnings;
  4 use Net::DNS::Packet;
  5 
  6 my $packet = new Net::DNS::Packet;
  7 my $q  = new Net::DNS::Question('.', 'IN', 'A');
  8 
  9 $packet->header->opcode('UPDATE');
 10 $packet->push('question', $q);


Essentially, it seems when a packet header has opcode set to UPDATE, the push method fails
because it expects the question (aka 'zone') section to be non-empty:

468 sub push {
469         my $self = shift;
470         my $list = $self->_section(shift);
471         my @rr   = grep ref($_), @_;
472 
473         if ( $self->header->opcode eq 'UPDATE' ) {
474                 my $zclass = ( $self->zone )[0]->zclass;
475                 foreach (@rr) {
476                         $_->class($zclass) unless $_->class =~ /ANY|NONE/;
477                 }
478         }
479 
480         return CORE::push( @$list, @rr );
481 }

I'm not sure, but this seems like a bug net Net::DNS.  If so I'll be happy to file the bug report...

DW           

-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 4676 bytes
Desc: not available
URL: <http://lists.nlnetlabs.nl/pipermail/net-dns-users/attachments/20150625/c94ae409/attachment.bin>


More information about the net-dns-users mailing list