[122067] in North American Network Operators' Group
Re: Regular Expression for IPv6 addresses
daemon@ATHENA.MIT.EDU (Jeroen Massar)
Thu Feb 4 19:33:44 2010
Date: Thu, 04 Feb 2010 18:31:59 -0600
From: Jeroen Massar <jeroen@unfix.org>
To: "Richard E. Brown" <Richard.E.Brown@dartware.com>
In-Reply-To: <4912284@blitz.dartware.com>
Cc: nanog@nanog.org
Errors-To: nanog-bounces+nanog.discuss=bloom-picayune.mit.edu@nanog.org
This is an OpenPGP/MIME signed message (RFC 2440 and 3156)
--------------enig891C9F4ADFD48E8466DFC414
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable
Richard E. Brown wrote:
> Folks,
>=20
> My company, Dartware, have derived a regex for testing whether an IPv6
> address is correct. I've posted it in my blog:
>=20
> http://intermapper.ning.com/profiles/blogs/a-regular-expression-for=
-ipv6
>=20
>=20
> This has links to the regular expression, a (Perl) program that tests
> various correct and malformed addresses, and a Ruby implementation of
> the same.
You know, link local addresses (fe80::/10) are quite useless without
specifying the zone of that address. See section 11 of RFC4007.
The only proper way of "testing" if an address is a valid IPv6 address
is to feed it to getaddrinfo() and then use it through that API.
Yes, you can make some assumptions, but it has shown that people
assuming that everything stayed under 2001::/16 also got it wrong at one
point in time. Thus just feed it to getaddrinfo() if you really need it.
Greets,
Jeroen
--------------enig891C9F4ADFD48E8466DFC414
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)
iEYEARECAAYFAktrZy4ACgkQKaooUjM+fCOrWwCfa9tvQCL16Vm4DmjHT7vhBCZ3
L64AoJIOS32pvdd2nGDMB5UepsInCHxX
=uq83
-----END PGP SIGNATURE-----
--------------enig891C9F4ADFD48E8466DFC414--