mirror of
https://github.com/strongswan/strongswan.git
synced 2025-10-04 00:00:14 -04:00
socket-default: Use IPv6-only mode for IPv6 sockets
Otherwise, we can't open a dedicated IPv4 socket on the same port as the IPv6 socket already is set up do receive IPv4 packets (unless we'd again enable SO_REUSEADDR). Fixes: 83da13371292 ("socket-default: Don't set SO_REUSEADDR on IKE sockets anymore")
This commit is contained in:
parent
7433f1672a
commit
ebaaacc459
@ -699,6 +699,14 @@ static int open_socket(private_socket_default_socket_t *this,
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (family == AF_INET6 &&
|
||||
setsockopt(skt, SOL_IPV6, IPV6_V6ONLY, &on, sizeof(on)) < 0)
|
||||
{
|
||||
DBG1(DBG_NET, "unable to set IPV6_V6ONLY on socket: %s", strerror(errno));
|
||||
close(skt);
|
||||
return -1;
|
||||
}
|
||||
|
||||
/* bind the socket */
|
||||
if (bind(skt, &addr.sockaddr, addrlen) < 0)
|
||||
{
|
||||
|
Loading…
x
Reference in New Issue
Block a user