Skip Menu |

This queue is for tickets about the Net-DNS CPAN distribution.

Report information
The Basics
Id: 87473
Status: rejected
Priority: 0/
Queue: Net-DNS

People
Owner: Nobody in particular
Requestors: he [...] uninett.no
Cc:
AdminCc:

Bug Information
Severity: (no value)
Broken in: (no value)
Fixed in: (no value)



Subject: Feature request: allow tweak to header fields
Date: Wed, 31 Jul 2013 11:42:35 +0200 (CEST)
To: bug-Net-DNS [...] rt.cpan.org
From: Havard Eidnes <he [...] uninett.no>
Hi, this may be somewhat related to RT#37104, "Feature Request - export and document DNS::Resolver::make_query_packet". I just came back from fixing fpdns from https://github.com/kirei/fpdns to work with Net::DNS 0.69. This required one change to fpdns (NS_NOTIFY_OP -> NOTIFY), but also triggered the need for getting rid of these warnings (and lack of feature): header->qdcount attribute is read-only at /usr/pkg/lib/perl5/vendor_perl/5.16.0/Net/DNS/Fingerprint.pm line 2174. header->ancount attribute is read-only at /usr/pkg/lib/perl5/vendor_perl/5.16.0/Net/DNS/Fingerprint.pm line 2175. header->nscount attribute is read-only at /usr/pkg/lib/perl5/vendor_perl/5.16.0/Net/DNS/Fingerprint.pm line 2176. header->arcount attribute is read-only at /usr/pkg/lib/perl5/vendor_perl/5.16.0/Net/DNS/Fingerprint.pm line 2177. This comes from fpdns's function fp2header: sub fp2header { my @list = split(/,/, shift); my $header = shift; $header->qr(shift @list); $header->opcode(shift @list); $header->aa(shift @list); $header->tc(shift @list); $header->rd(shift @list); $header->ra(shift @list); $header->ad(shift @list); $header->cd(shift @list); $header->rcode(shift @list); $header->qdcount(shift @list); $header->ancount(shift @list); $header->nscount(shift @list); $header->arcount(shift @list); } specifically the 4 last lines. I beleive the attached diff adds this feature to Net::DNS (actual testing has been skimpy, though, so I may have made a mistake...), but at least gets rid of the warnings. Regards, - HÃ¥vard
--- lib/Net/DNS/Header.pm.orig 2012-12-05 12:03:11.000000000 +0000 +++ lib/Net/DNS/Header.pm @@ -334,8 +334,9 @@ sub cd { =head2 qdcount, zocount print "# of question records: ", $packet->header->qdcount, "\n"; + $packet->header->qdcount($n); -Gets the number of records in the question section of the packet. +Gets or sets the number of records in the question section of the packet. In dynamic update packets, this field is known as C<zocount> and refers to the number of RRs in the zone section. @@ -347,15 +348,16 @@ sub qdcount { my $self = shift; my $xpkt = $self->{xbody}; return $self->{count}[0] || scalar @{$xpkt->{question}} unless @_; - carp 'header->qdcount attribute is read-only' unless $warned; + $self->{count}[0] = @_; } =head2 ancount, prcount print "# of answer records: ", $packet->header->ancount, "\n"; + $packet->header->ancount($n); -Gets the number of records in the answer section of the packet. +Gets or sets the number of records in the answer section of the packet. In dynamic update packets, this field is known as C<prcount> and refers to the number of RRs in the prerequisite section. @@ -365,15 +367,16 @@ sub ancount { my $self = shift; my $xpkt = $self->{xbody}; return $self->{count}[1] || scalar @{$xpkt->{answer}} unless @_; - carp 'header->ancount attribute is read-only' unless $warned; + $self->{count}[1] = @_; } =head2 nscount, upcount print "# of authority records: ", $packet->header->nscount, "\n"; + $packet->header->nscount($n); -Gets the number of records in the authority section of the packet. +Gets or sets the number of records in the authority section of the packet. In dynamic update packets, this field is known as C<upcount> and refers to the number of RRs in the update section. @@ -383,15 +386,16 @@ sub nscount { my $self = shift; my $xpkt = $self->{xbody}; return $self->{count}[2] || scalar @{$xpkt->{authority}} unless @_; - carp 'header->nscount attribute is read-only' unless $warned; + $self->{count}[2] = @_; } =head2 arcount, adcount print "# of additional records: ", $packet->header->arcount, "\n"; + $packet->header->arcount($n); -Gets the number of records in the additional section of the packet. +Gets or sets the number of records in the additional section of the packet. In dynamic update packets, this field is known as C<adcount>. =cut @@ -400,7 +404,7 @@ sub arcount { my $self = shift; my $xpkt = $self->{xbody}; return $self->{count}[3] || scalar @{$xpkt->{additional}} unless @_; - carp 'header->arcount attribute is read-only' unless $warned; + $self->{count}[3] = @_; } sub zocount { &qdcount; }
From: rwfranks [...] acm.org
On Wed Jul 31 05:42:58 2013, he@uninett.no wrote: Show quoted text
> Hi, > > this may be somewhat related to RT#37104, "Feature Request - > export and document DNS::Resolver::make_query_packet".
Not related Show quoted text
> > I just came back from fixing fpdns from > > https://github.com/kirei/fpdns > > to work with Net::DNS 0.69. This required one change to fpdns > (NS_NOTIFY_OP -> NOTIFY),
This now follows the mnemonic in the IANA registry database. Show quoted text
> ... but also triggered the need for getting > rid of these warnings (and lack of feature): > > header->qdcount attribute is read-only at > /usr/pkg/lib/perl5/vendor_perl/5.16.0/Net/DNS/Fingerprint.pm line > 2174. > header->ancount attribute is read-only at > /usr/pkg/lib/perl5/vendor_perl/5.16.0/Net/DNS/Fingerprint.pm line > 2175. > header->nscount attribute is read-only at > /usr/pkg/lib/perl5/vendor_perl/5.16.0/Net/DNS/Fingerprint.pm line > 2176. > header->arcount attribute is read-only at > /usr/pkg/lib/perl5/vendor_perl/5.16.0/Net/DNS/Fingerprint.pm line > 2177.
Mechanism works as follows: For received packet, header counts are those transmitted by remote nameserver. These MAY differ from the size of corresponding section IF packet was truncated by some device en route. For home-grown packets, header count is ALWAYS same as length of corresponding section. It is impossible to send a packet with inconsistent header counts and section sizes. This was no different before 0.69. In 0.68, the first thing that packet->data does is to overwrite the header counts. The warning message is the only new feature. This is intended to inform you that changing the header count is pointless because the value will be ignored. Dick