Regular Expression for IPv6 addresses

Mark Andrews marka at isc.org
Fri Feb 5 01:53:38 UTC 2010


In message <4B6B7185.2080708 at spaghetti.zurich.ibm.com>, Jeroen Massar writes:
> Mark Andrews wrote:
> [..]
> > And now for the trick question.  Is ::ffff:077.077.077.077 a legal
> > mapped address and if it, does it match 077.077.077.077?
> 
> ::ffff:0:0:0:0/96 should never ever be shown to a user, as it is
> confusing (is it IPv6 or IPv4?) and does not make sense at all.
> As such whatever one thinks of it, it is "illegal" in that context.
> 
> Internally inside a program though using a 128bit sequence of memory is
> of course a great way to store both IPv6 and IPv4 addresses in one
> structure and that is where the ::ffff:0:0:0:0::/96 format is very
> useful and intended for. Of course still the representation to the user
> of addresses stored that way would be 77.77.77.77 (and thus an IPv4
> address and not IPv6) even though internally it is written as an IPv6
> address.

You missed the point 077 is octal and 077.077.077.077 is 63.63.63.63
in the IPv4 address whereas it is decimal dotted quad in a mapped
address *if* zero padded decimal dotted quad is legal in a IPv6
text form.

> As that usage is internal, you don't need any validation of the format
> as the input will be either an IPv6 or IPv4 address without any of the
> compatibility stuff, thus one does not need to handle it anyway.
> 
> Of course, there should be only limited places where a user can enter or
> see IP addresses in the first place. There is this great thing called
> DNS which is what most people should be using.
> 
> Greets,
>  Jeroen
> 
> 
> --------------enig57675C04A65E0982D8079586
> Content-Type: application/pgp-signature; name="signature.asc"
> Content-Description: OpenPGP digital signature
> Content-Disposition: attachment; filename="signature.asc"
> 
> -----BEGIN PGP SIGNATURE-----
> Version: GnuPG v2.0.12 (MingW32)
> 
> iEYEARECAAYFAktrcYgACgkQKaooUjM+fCPUCQCgmwJ8u2Zqi1ljQ+PVOByv45Jv
> OrgAn2iTiqdLdFWT5a9vlM6dUe6McqEO
> =OqJc
> -----END PGP SIGNATURE-----
> 
> --------------enig57675C04A65E0982D8079586--
-- 
Mark Andrews, ISC
1 Seymour St., Dundas Valley, NSW 2117, Australia
PHONE: +61 2 9871 4742                 INTERNET: marka at isc.org




More information about the NANOG mailing list