Looking for DNS/Operational experience

Mike Leber mleber at he.net
Fri May 8 17:13:16 CEST 2009


Bjørn Mork wrote:
> Mike Leber <mleber at he.net> writes:
> 
>> Since you mentioned Perl, here is a way to do it with Perl:
>>
>> $ perl -e 'use Net::IP;$ip=new Net::IP("2a02:c0:100::2/128");print
>> ($ip->reverse_ip()."\n");'
>>
>> 2.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.1.0.0.c.0.0.2.0.a.2.ip6.arpa.
>>
>> You'll probably find Net::IP very useful.  You can use it to write
>> code that is nearly address family agnostic.
> 
> No, you can't.  You can use it for IPv6, but it fails for IPv4 (CIDR):

To date, I'd bet Net::IP has been used in more IPv4 code than IPv6.

The documentation for the reverse_ip function is:

QUOTE
Return the reverse IP for a given IP address (in.addr. format).
ENDQUOTE

It says IP address (not prefix) plus they probably didn't test for 
somebody using .0 of a prefix.

This function is just one of 27.

If you find a behavior in a package you don't agree with:

1) Find out how other people made it work correctly.  Read the 
documentation and use Google.  Look at what how the module writer 
actually wrote the function you are using.

2) Write your own perl code to handle it.

3) Find another package that does what you want.

4) Fix the module, or write a fixed version of the function, and mail 
the module writer.  Other people will probably run into the same thing.

Mike.

> 
> bjorn at nemi:/tmp$  perl -e 'use Net::IP;$ip=new Net::IP("192.168.4.0/24");print $ip->reverse_ip()."\n"'
> 4.168.192.in-addr.arpa.
> bjorn at nemi:/tmp$  perl -e 'use Net::IP;$ip=new Net::IP("192.168.0.0/24");print $ip->reverse_ip()."\n"'
> 168.192.in-addr.arpa.
> 
> 
> The output of the latter should of course have been
> 0.168.192.in-addr.arpa.
> 
> 
> Bjørn

-- 
+---------------- H U R R I C A N E - E L E C T R I C ----------------+
| Mike Leber        Wholesale IPv4 and IPv6 Transit      510 580 4100 |
| Hurricane Electric                                           AS6939 |
| mleber at he.net     Internet Backbone & Colocation      http://he.net |
+---------------------------------------------------------------------+




More information about the ipv6-ops mailing list