Subject: Re: Fw: [Bugme-new] [Bug 7665] New: getsockopt(IPV6_*CAST_HOPS) returns -1

From: Rémi Denis-Courmont <[email-masked]>
Date: Tue, 12 Dec 2006 23:38:24 +0100

Le mardi 12 décembre 2006 22:16, vous avez écrit :
> > I don't reckon -1 could be the hop limit value.
>
> -1 means un-initialized.

Sure, -1 means "kernel default" for setsockopt(), but it is not 
specified for getsockopt().

> The following patch seems to work for me, but this code has behaved
> this way for a while, so don't know if it will break any existing
> apps.

Google Codesearch for "getsockopt IPV6_MULTICAST_HOPS" yields a bunch of 
apps that seem to assume a valid hop limit is returned, none of which 
detects -1. I believe applying your patch would fix much more apps than 
it is going to break. Hopefully those not handling -1 will somehow cast 
it to 255 if it is ever re-used, but I can also imagine some broken 
SDP-or-similar with "/-1" or "/4294967295" as a hop limit.

Thanks,

-- 
Rémi Denis-Courmont