PATCH: innd: separate sockets for IPv4 and IPV6

Julien ÉLIE julien at trigofacile.com
Wed Apr 9 15:29:23 UTC 2008


Hi Bill,

>> 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.

I asked because syswarn is as often as not used in lib/network.c.
There is:

    /* Create the socket. */
    fd = socket(PF_INET6, SOCK_STREAM, IPPROTO_IP);
    if (fd < 0) {
        if (errno != EAFNOSUPPORT && errno != EPROTONOSUPPORT)
            syswarn("cannot create IPv6 socket for %s,%hu", address, port);
        return -1;
    }
    network_set_reuseaddr(fd);

#ifdef IPV6_V6ONLY
    flag = 1;
    if (setsockopt(fd, IPPROTO_IPV6, IPV6_V6ONLY, &flag, sizeof(flag)) < 0)
        syswarn("cannot set IPv6 socket to v6only");
#endif


Do you think sysdie should be better here than a syswarn and a "return -1"?
(which is currently not returned)

I wonder whether everything should die in case only one socket failed
(while all the previous ones are good).

-- 
Julien ÉLIE

« -- Poussez pas derrière !
  -- Pas si vite devant ! » (Astérix)



More information about the inn-workers mailing list