Huge thanks to our Platinum Members Endace and LiveAction,
and our Silver Member Veeam, for supporting the Wireshark Foundation and project.

Wireshark-dev: Re: [Wireshark-dev] IPv6 longest representation vs INET6_ADDRSTRLEN

From: Sake Blok <sake@xxxxxxxxxx>
Date: Sat, 14 May 2011 18:30:54 +0200
On 5 mei 2011, at 19:41, Gerald Combs wrote:
> On 5/5/11 6:01 AM, Jakub Zawadzki wrote:
>> On Thu, May 05, 2011 at 02:01:06PM +0200, Jakub Zawadzki wrote:
>>> IMHO when IPv4-mapping is used the longest address is:
>>> ::ffff:255.255.255.255 (22B)
>>> 
>>> Anyone knows inet_ntop(AF_INET6, ..) implementation which can actually use 46 bytes?
>> 
>> Maybe some inet_ntop() implementation don't generate short addresses? (0000 instead of ::)
>> so ipv4 mapped address would be: "0000:0000:0000:0000:0000:0000:255.255.255.255"
>> 
>> I think I'll just copy inet_ntop6() from wsutil/inet_ntop.c to address_to_str.c...
> 
> RFC 2553 section 6.6 and MSDN's InetNtop documentation both specify 46
> characters, but you'd think that if an implementation was smart enough
> to check for v4-mapped addresses it would be smart enough to compress
> zeroes.

There is also the "IPv6 mixed notation" (or "Trailing dotted decimal notation" as Microsoft calls it) which displays the last 32 bits of a (general) IPv6 address in dotted decimal. This could indeed lead to 45 byte strings:

IE   2001:db8:1234:5678:9abc:def0:192.168.123.234

(OK, this is 44 bytes, but I wanted to stick to the 2001:db8::/32 example prefix)

Cheers,


Sake