Skip Menu |

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

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

People
Owner: Nobody in particular
Requestors: gslin [...] cpan.org
Cc:
AdminCc:

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



Subject: Unable to return edns record (Net::DNS::RR::OPT) in additional section
In Net/DNS/Packet.pm, it forbids all Net::DNS::RR::OPT objects in additional section: my $edns = $self->edns; # EDNS support my @addl = grep !$_->isa('Net::DNS::RR::OPT'), @{$self->{additional}}; unshift( @addl, $edns ) if $edns->_specified; $self->{additional} = \@addl; According to RFC 6891: If an OPT record is present in a received request, compliant responders MUST include an OPT record in their respective responses. When I tried to implement edns-client-subnet, spec requires to include OPT RR, like this ("dig www.google.com @8.8.8.8 +client=140.112.2.0/24" and "tshark -V" to sniff return packets): Additional records <Root>: type OPT Name: <Root> Type: OPT (EDNS0 option) UDP payload size: 512 Higher bits in extended RCODE: 0x0 EDNS0 version: 0 Z: 0x0 Data length: 11 Option: Unknown (8) Option Code: Unknown (8) Option Length: 7 Option Data: 000118188c7002
From: rwfranks [...] acm.org
On Sat Apr 09 14:32:53 2016, GSLIN wrote: Show quoted text
> In Net/DNS/Packet.pm, it forbids all Net::DNS::RR::OPT objects in > additional section: > > my $edns = $self->edns; # EDNS support > my @addl = grep !$_->isa('Net::DNS::RR::OPT'), @{$self->{additional}}; > unshift( @addl, $edns ) if $edns->_specified; > $self->{additional} = \@addl; >
No, it does not. This code makes sure that there is no more than one OPT RR, and if there is one, that some content has been specified. It is not feasible to generate OPT RRs directly in application code because they also carry header extension fields which cannot be managed outside the enclosing packet. See documentation for Net::DNS::Packet and Net::DNS::RR::OPT. Something approximating to your dig example might be coded: my $res = Net::DNS::Resolver->new( nameserver => '8.8.8.8' ); my $query = Net::DNS::Packet->new('www.google.com'); $query->edns->option( 8, pack 'H*', '000118188c7002' ); my $reply = $res->send($query);