Subject: | Problem with Net::CIDR::cidrvalidate() |
Date: | Thu, 17 Jan 2008 09:05:42 -0800 (PST) |
To: | bug-Net-CIDR [...] rt.cpan.org |
From: | Mike Friedman <mikef [...] berkeley.edu> |
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Distribution: Net-CIDR-0.11
Perl version: 5.8.8
OS: FreeBSD 6.2-STABLE
Description:
Net::CIDR::cidrvalidate() does not honor leading 0 padded octets in IPv4
addresses.
Example:
use Net::CIDR qw( cidrvalidate );
$ip = cidrvalidate("128.32.25.13");
print "\$ip = $ip\n";'
results in
$ip = 128.32.25.13
whereas, with
$ip = cidrvalidate("128.32.025.13");
we get this:
$ip =
I suppose this isn't really a bug, as it appears, empirically, that at
least some resolvers also consider the 0-padded octets as invalid in some
way (or at least don't understand them).
So, I'd like to propose a new function in Net::CIDR, that would
canonicalize IPv4 dotted addresses by removing the leading 0 in each
octet, returning the canonicalized form after successfully validating the
address (if it is otherwise valid).
I assume none of this would affect IPv6 addresses.
If this kind of proposal belongs somewhere else than in a 'bug' report,
please let me know.
Thanks.
Mike
Show quoted text
_________________________________________________________________________
Mike Friedman Information Services & Technology
mikef@berkeley.edu 2484 Shattuck Avenue
1-510-642-1410 University of California at Berkeley
http://socrates.berkeley.edu/~mikef http://ist.berkeley.edu
_________________________________________________________________________
-----BEGIN PGP SIGNATURE-----
Version: PGP 6.5.8
iQA/AwUBR4+K6a0bf1iNr4mCEQJZBgCdFVfvlOdMjA7nQbxm2U22RGnUOdkAoOmT
axrGjWcKMhc62po5QVuPp0CP
=lm8p
-----END PGP SIGNATURE-----