[AFS3-std] Encoding IPvN addresses (was Re: first draft: ubik update proposal)

Jeffrey Hutzelman jhutz@cmu.edu
Mon, 07 Feb 2011 16:46:25 -0500


--On Monday, February 07, 2011 03:23:37 PM -0500 Derrick Brashear 
<shadow@gmail.com> wrote:

> On Mon, Feb 7, 2011 at 3:08 PM, David Boyes <dboyes@sinenomine.net> wrote:
>>
>>
>> On 2/7/11 3:02 PM, "Chaskiel Grundman" <cg2v@andrew.cmu.edu> wrote:
>>
>>>>
>>>> enum ippack { IPv4=1, IPv6Bytes=2, IPv6Shorts=3, IPV6Ints=4 };
>>> We need to define a single canonical form of ipv6 address. it's up to
>>> the endpoints to translate whatever their in6_addr is to/from that
>>> form. Other than that, this is the right idea.
>>
>> Amen. Long form, please.
>
> all of those are different representations of the same number of
> bytes. so, "long form" means you'd like one of the 3 options already
> here?
>
> if you'd like a literal mapping of the colon-separated octet-sets to
> array elements, you'd be suggesting the array IPv6Shorts in this
> proposal. that's fine with me too.

Treat it as an opaque vector.  An IPv6 address is not actually an array of 
16- or 32-bit integers, and treating it that way means you're going to have 
to jump through hoops to get the byte order right when local byte order is 
not the same as network order.  Better to just treat the whole thing as an 
opaque bitstring, which is what it is.