[157653] in North American Network Operators' Group
Re: IPv6 Netowrk Device Numbering BP
daemon@ATHENA.MIT.EDU (Karl Auer)
Thu Nov 1 19:52:32 2012
From: Karl Auer <kauer@biplane.com.au>
To: nanog@nanog.org
Date: Fri, 02 Nov 2012 10:52:10 +1100
In-Reply-To: <B054B0DE-9D2F-4AD1-BE75-2DE89CA0A1B8@delong.com>
Errors-To: nanog-bounces+nanog.discuss=bloom-picayune.mit.edu@nanog.org
--=-Sm+N8xUSds63WZ8YzmfP
Content-Type: text/plain; charset="ISO-8859-1"
Content-Transfer-Encoding: quoted-printable
On Thu, 2012-11-01 at 07:07 -0700, Owen DeLong wrote:
> I agree with you that we shouldn't introduce partially decimal format,
but I
> don't see why you say IPv6 addresses are difficult to parse.
They are not simple to parse, but not particularly difficult either.
> 1. Tokenize (on : boundaries).
> 2. If n(tokens) < 8, expand null token to 9-n tokens.
It's a bit harder than that. You need to deal with the positioning of
the "::", which may be at the beginning or end. Scope identifiers need
to be handled. On output, you need to handle the requirements of RFC
5952.
> You really shouldn't need to parse [mapped addresses] and it's
perfectly valid
> to reject them as invalid input.
No, it's not OK to reject them. You can't just say they are invalid,
they are not.
> Finally, at this point, if you're feeling like you have to write your
own IP address parser,
> you're probably doing something wrong. PLEASE PLEASE PLEASE use the
standard
> libraries whenever possible.
Definitely oh very yes! That said, I have had to write my own three
times now, because of errors or inadequacies in the existing parsers,
and I can confidently say it is slightly tricky, but not hard. The key,
the essential and vital thing, is to unit test that sucker until it is
gasping and limp.
> There are similar library functions for virtually every other language
at this point as well.
Java's is broken, for a start. I have had to replace it for literals,
because it doesn't compress for output, and because it treats a mapped
IPv4 address as an IPv4 address! It's also hard to do some operations on
InetAddress objects. I still use InetAddress where actual names are
concerned, so as not to duplicate the Java DNS functionality.
Unfortunately Java appears to not properly prefer IPv6 addresses. There
is allegedly a system property to control that, but it is either
documented incorrectly or just doesn't work.
Regards, K.
--=20
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Karl Auer (kauer@biplane.com.au)
http://www.biplane.com.au/kauer
http://www.biplane.com.au/blog
GPG fingerprint: AE1D 4868 6420 AD9A A698 5251 1699 7B78 4EEE 6017
Old fingerprint: DA41 51B1 1481 16E1 F7E2 B2E9 3007 14ED 5736 F687
--=-Sm+N8xUSds63WZ8YzmfP
Content-Type: application/pgp-signature; name="signature.asc"
Content-Description: This is a digitally signed message part
Content-Transfer-Encoding: 7bit
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.11 (GNU/Linux)
iF4EABEIAAYFAlCTCyoACgkQFpl7eE7uYBck4gD/RGqXvyOsW7Ayh35n1kRgOoNp
pEAGM/LNMPeiDt7bmL0BAI3kq1SmWHGKGihbsc/hAfJ1zDDco0cTso1EDA6nAc03
=vgP1
-----END PGP SIGNATURE-----
--=-Sm+N8xUSds63WZ8YzmfP--