PATCH: innd: separate sockets for IPv4 and IPV6

Bill Davidsen davidsen at tmr.com
Wed Apr 9 14:30:16 UTC 2008


Julien ÉLIE wrote:
> Hi Miquel,
>
>   
>> You have to do the setsockopt on every newly opened socket just before
>> bind().
>>     
>
> All right.
>
>
>   
>> Completely untested of course, probably doesn't even compile.
>>     
>
> Thanks for the patch.  It compiles very well.
> And it seems to work since "netstat -tn" gives without it:
>
> tcp6       0      0 ::ffff:91.121.26.68:119 ::ffff:85.25.133.:60767 ESTABLISHED
> tcp6       0      0 ::ffff:91.121.26.68:119 ::ffff:87.106.161:53225 ESTABLISHED
>
> whereas only real IPv6 connexions are marked when your patch is applied.
>
>
>   
>> +++ inn-CURRENT-20080324/lib/network.c 2008-03-24 21:16:15.000000000 +0100
>> @@ -241,6 +244,12 @@
>>     }
>>     network_set_reuseaddr(fd);
>>
>> +#ifdef IPV6_V6ONLY
>> +    flag = 1;
>> +    if (setsockopt (fd, IPPROTO_IPV6, IPV6_V6ONLY, &flag, sizeof(flag)) < 0)
>> +        sysdie("cannot set IPv6 socket to v6only");
>> +#endif
>> +
>>     /* Accept "any" or "all" in the bind address to mean 0.0.0.0. */
>>     if (!strcmp(address, "any") || !strcmp(address, "all"))
>>         address = "::";
>>     
>
> Shouldn't it be a "syswarn" here instead of a "sysdie"?
>
>   
Unless I misunderstand the intent of "V6ONLY" here, if you can't set the 
socket type you are not operating as requested, and sysdie is probably  
the correct action. syswarn would leave the server in an unintended and 
probably undesirable operating mode, if I read this right.
-- 
Bill Davidsen <davidsen at tmr.com>
  "Woe unto the statesman who makes war without a reason that will still
  be valid when the war is over..." Otto von Bismark 





More information about the inn-workers mailing list