Skip Menu |

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

Report information
The Basics
Id: 133203
Status: resolved
Priority: 0/
Queue: Net-DNS

People
Owner: Nobody in particular
Requestors: rt.cpan.org [...] cochon.co.uk
Cc:
AdminCc:

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



Subject: Net::DNS::RR::LOC erroneously strips non default values from string representation
Date: Fri, 21 Aug 2020 12:05:09 +0100
To: bug-Net-DNS [...] rt.cpan.org
From: Phil Gunhouse <rt.cpan.org [...] cochon.co.uk>
Hi, The function _format_rdata in LOC.pm invoked by string/plain etc., intended to strip out the default RFC-1876 precision values can erroneously strip valid non default values that happen to match defaults for other fields. In the examples below 1m is not the default for either HORIZ PRE or VERT PRE, but is removed, leaving them to be substituted as per RFC-1876 incorrectly. My usage case, a pipe backend for PowerDNS where pdns consumes the textual representation of the record and correctly substitutes the unwanted default values because the explicit values have been incorrectly removed. Net-DNS-1.26 / Perl v5.28.1 / Debian 10.4 amd64 use Net::DNS::Nameserver; $loc_rr = new Net::DNS::RR( "good 3600 IN LOC 54 3 2 N 12 3 4 W 123 500 10 2" ); print $loc_rr->string . "\n"; $loc_rr = new Net::DNS::RR( "vp-bad 3600 IN LOC 54 3 2 N 12 3 4 W 123 500 10 1" ); print $loc_rr->string . "\n"; $loc_rr = new Net::DNS::RR( "hp-bad 3600 IN LOC 54 3 2 N 12 3 4 W 123 500 1 10" ); print $loc_rr->string . "\n"; good. 3600 IN LOC 54 3 2 N 12 3 4 W 123m 500m 10m 2m vp-bad. 3600 IN LOC 54 3 2 N 12 3 4 W 123m 500m 10m hp-bad. 3600 IN LOC 54 3 2 N 12 3 4 W 123m 500m The following patch should resolve the issue, giving positional context to the 3 specific default values. --- LOC.pm.orig +++ LOC.pm @@ -46,5 +46,5 @@ for ($precision) { - s/\s+10m$//; - s/\s+10000m$//; - s/\s*1m$//; + s/^(\S+\s+\S+)\s+10m$/$1/; + s/^(\S+)\s+10000m$/$1/; + s/^\s*1m$//; } Best Regards, -- Phil Gunhouse
On Fri Aug 21 07:10:29 2020, rt.cpan.org@cochon.co.uk wrote: Show quoted text
>8 > > The following patch should resolve the issue, giving positional context > to the 3 specific default values. > > --- LOC.pm.orig > +++ LOC.pm > @@ -46,5 +46,5 @@ > for ($precision) { > - s/\s+10m$//; > - s/\s+10000m$//; > - s/\s*1m$//; > + s/^(\S+\s+\S+)\s+10m$/$1/; > + s/^(\S+)\s+10000m$/$1/; > + s/^\s*1m$//; > }
This is an over-complicated way of looking at it. The real requirement is to remove the longest contiguous list of default values from RH end of the string. my ( $altitude, @precision ) = map $self->$_() . 'm', qw(altitude size hp vp); my $precision = join ' ', @precision; for ($precision) { ! s/^1m 10000m 10m$//; ! s/ 10000m 10m$//; ! s/ 10m$//; }
Will be resolved in the soon to be released Net::DNS 1.27