socket-dynamic: Use IPv6-only mode for IPv6 sockets
Same as the previous commit.
Fixes: 5f9ad62a81 ("socket-dynamic: Don't set SO_REUSEADDR on IKE sockets anymore")
This commit is contained in:
@@ -410,7 +410,13 @@ static int open_socket(private_socket_dynamic_socket_t *this,
|
|||||||
DBG1(DBG_NET, "could not open socket: %s", strerror(errno));
|
DBG1(DBG_NET, "could not open socket: %s", strerror(errno));
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
if (family == AF_INET6 &&
|
||||||
|
setsockopt(fd, SOL_IPV6, IPV6_V6ONLY, &on, sizeof(on)) < 0)
|
||||||
|
{
|
||||||
|
DBG1(DBG_NET, "unable to set IPV6_V6ONLY on socket: %s", strerror(errno));
|
||||||
|
close(fd);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
if (bind(fd, &addr.s, addrlen) < 0)
|
if (bind(fd, &addr.s, addrlen) < 0)
|
||||||
{
|
{
|
||||||
DBG1(DBG_NET, "unable to bind socket: %s", strerror(errno));
|
DBG1(DBG_NET, "unable to bind socket: %s", strerror(errno));
|
||||||
|
|||||||
Reference in New Issue
Block a user