On 2016/05/17 08:27, Brent Cook wrote:
> This patch came by way of the openntpd github. Linux (and possibly others)
> will attempt to bind to 0.0.0.0 when binding to '::' and return an error if
> it can't, unless IPV6_V6ONLY is set. See
> https://github.com/openntpd-portable/openntpd-portable/issues/19
> 
> OK as an in-tree patch? OpenBSD seems to adopt a more liberal
> interpretation and not return a failure in the same scenario. (The patch
> against the 5.7 tree, but you get the idea)
> 
> diff -uNr openntpd-5.7p4/src/server.c new/src/server.c
> --- openntpd-5.7p4/src/server.c 2015-03-25 04:18:56.000000000 +0300
> +++ new/src/server.c    2016-03-05 18:06:07.946888570 +0300
> @@ -40,6 +40,7 @@
>         size_t                   sa6len = sizeof(struct in6_addr);
>         u_int                    new_cnt = 0;
>         int                      tos = IPTOS_LOWDELAY;
> +       int                      on = 1;
>         int                      rdomain, fd;
> @@ -139,6 +140,12 @@
>                     IPPROTO_IP, IP_TOS, &tos, sizeof(tos)) == -1)
>                         log_warn("setsockopt IPTOS_LOWDELAY");
> 
> +#ifdef IPV6_V6ONLY
> +               if (la->sa.ss_family == AF_INET6 && setsockopt(la->fd,
> +                   IPPROTO_IPV6, IPV6_V6ONLY, &on, sizeof(on)) == -1)
> +                       log_warn("setsockopt IPV6_V6ONLY");
> +#endif

Does it need the ifdef? It's standard ipv6 api..

Reply via email to