Subject: Re: c-ares + IPv6 problem

Re: c-ares + IPv6 problem

From: David Stuart <dstuart_at_counterpath.com>
Date: Mon, 16 May 2011 11:35:27 -0400

I suppose the 46 length is just supposed to be for the address portion,
not including the zone ID. I wonder if there's a constant somewhere for
the zone ID? Will look ..

On 11-05-16 11:17 AM, David Stuart wrote:
> Ah, I didn't notice those, thanks. I'll change it.
>
> Also I think the IPv6 one might be wrong, according to this page (and
> other people's comments):
>
> http://www.microsoft.com/technet/prodtechnol/windowsserver2003/library/iis/1ecff3af-36c2-41b5-957a-8bcc6fac8abc.mspx
>
> The longest IPv6 address is actually something like:
>
> 1111:2222:3333:4444:5555:6666:123.123.123.123%1234567890 (57 chars long)
>
>
>
> On 11-05-16 09:45 AM, Steinar H. Gunderson wrote:
>> Den 16. mai 2011 15:38 skrev Peter Pentchev <roam_at_ringlet.net> følgende:
>>>> + const size_t ipv4_size = sizeof("255.255.255.255,") - 1;
>>>> + const size_t ipv6_size = sizeof("ffff:ffff:ffff:ffff:ffff:ffff:255.255.255.255,") - 1;
>>> Hmm, theoretically speaking, an IPv6 address might be even longer than
>>> that (think link-local addresses with %ifname at the end). However,
>>> I stronly doubt somebody would actually *use* something much longer...
>>> but then again, this last sentence fragment has led to some very, very
>>> bad buffer overflow exploits over the last twenty years :)
>>
>> And in any case, you will probably want to use these definitions
>> instead of rolling your own:
>>
>> /usr/include/netinet/in.h:#define INET_ADDRSTRLEN 16
>> /usr/include/netinet/in.h:#define INET6_ADDRSTRLEN 46
>>
>> /* Steinar */
>

-- 
David Stuart, CounterPath
Email: dstuart (at) counterpath (dot) com
Phone: (613) 254-8886 x2234  Web: http://www.counterpath.com/
Address: 310 - 350 Terry Fox Drive, Kanata Ontario, K2K 2P5
Received on 2011-05-16