Subject: | Incorrect calculation of reverse string |
Date: | Tue, 2 Jul 2019 17:33:52 -0400 |
To: | bug-Net-IP [...] rt.cpan.org |
From: | Matt Richard <gmattrichard [...] gmail.com> |
Hello,
We appear to be incorrectly calculating the reverse (PTR-style) string for
an IP address when the IP address ends in a zero.
Consider:
use Net::IP;
my $addr1 = '10.100.128.114';
my $addr2 = '10.100.128.0';
my $ip1 = new Net::IP ($addr1 . "/32");
my $ip2 = new Net::IP ($addr2 . "/32");
printf "IP1 = %s / object = %s / reverse = %s\n", $addr1, $ip1->print(),
$ip1->reverse_ip();
printf "IP2 = %s / object = %s / reverse = %s\n", $addr2, $ip2->print(),
$ip2->reverse_ip();
the output is:
IP1 = 10.100.128.114 / object = 10.100.128.114/32 / reverse =
114.128.100.10.in-addr.arpa.
IP2 = 10.100.128.0 / object = 10.100.128.0/32 / reverse =
128.100.10.in-addr.arpa.
The reverese for $addr2 should be *0.**128.100.10.in-addr.arpa.*
Can you please confim?
Best,
Matt