From: Vsevolod Stakhov Date: Fri, 13 Mar 2015 10:28:02 +0000 (+0000) Subject: Try to workaround V6_V6ONLY. X-Git-Tag: 0.9.0~507 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=a2a7dc001e561d157ae0a312fcd8d0490719b60c;p=rspamd.git Try to workaround V6_V6ONLY. --- diff --git a/src/libutil/addr.c b/src/libutil/addr.c index 1cfe2992b..7a9c49557 100644 --- a/src/libutil/addr.c +++ b/src/libutil/addr.c @@ -487,6 +487,15 @@ rspamd_inet_address_listen (const rspamd_inet_addr_t *addr, gint type, } setsockopt (fd, SOL_SOCKET, SO_REUSEADDR, (const void *)&on, sizeof (gint)); + +#ifdef HAVE_IPV6_V6ONLY + if (addr->af == AF_INET6) { + /* We need to set this flag to avoid errors */ + on = 1; + setsockopt (fd, SOL_IPV6, IPV6_V6ONLY, (const void *)&on, sizeof (gint)); + } +#endif + r = bind (fd, sa, addr->slen); if (r == -1) { if (!async || errno != EINPROGRESS) {