Commit b19782e4 authored by Magnus Holmgren's avatar Magnus Holmgren Committed by Niels Möller

Set the IPV6_V6ONLY socket option on AF_INET6 sockets.

parent ba12d923
2013-04-19 Magnus Holmgren <holmgren@debian.org>
* src/io.c (io_bind_sockaddr): Set the IPV6_V6ONLY socket option
on AF_INET6 sockets.
* src/unix_random.c (random_init): Show the intended error message
when no seed file exists, instead of one about a locking error.
......
......@@ -1690,6 +1690,13 @@ io_bind_sockaddr(struct sockaddr *local,
{
int yes = 1;
setsockopt(s, SOL_SOCKET, SO_REUSEADDR, (char*)&yes, sizeof yes);
#if WITH_IPV6 && defined (IPV6_V6ONLY)
if (local->sa_family == AF_INET6)
{
if (setsockopt(s, IPPROTO_IPV6, IPV6_V6ONLY, &yes, sizeof(yes)) < 0)
werror("setsockopt IPV6_V6ONLY failed: %e.\n", errno);
}
#endif
}
if (bind(s, local, length) < 0)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment