diff options
author | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2015-03-13 10:28:02 +0000 |
---|---|---|
committer | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2015-03-13 10:28:02 +0000 |
commit | a2a7dc001e561d157ae0a312fcd8d0490719b60c (patch) | |
tree | 72080ef354e3709fb832339a87f88c2dee7440f7 /src | |
parent | 8d9516871b70786a63f80601dbe7336cf7e3a138 (diff) | |
download | rspamd-a2a7dc001e561d157ae0a312fcd8d0490719b60c.tar.gz rspamd-a2a7dc001e561d157ae0a312fcd8d0490719b60c.zip |
Try to workaround V6_V6ONLY.
Diffstat (limited to 'src')
-rw-r--r-- | src/libutil/addr.c | 9 |
1 files changed, 9 insertions, 0 deletions
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) { |