Commit b9a0594c authored by Marek Vavruša's avatar Marek Vavruša

net: V6ONLY for bound sockets only

parent 557fe443
......@@ -62,14 +62,6 @@ int net_unbound_socket(int type, struct sockaddr_storage *ss)
return socket;
}
/* Make the socket IPv6 only to allow 'any' for IPv4 and IPv6 at the same time. */
if (ss->ss_family == AF_INET6) {
/* Do not support mapping IPv4 in IPv6 sockets. */
int flag = 1;
(void) setsockopt(socket, IPPROTO_IPV6, IPV6_V6ONLY,
&flag, sizeof(flag));
}
return socket;
}
......@@ -94,6 +86,12 @@ int net_bound_socket(int type, struct sockaddr_storage *ss)
unlink(addr_str);
}
/* Make the socket IPv6 only to allow 'any' for IPv4 and IPv6 at the same time. */
if (ss->ss_family == AF_INET6) {
(void) setsockopt(socket, IPPROTO_IPV6, IPV6_V6ONLY,
&flag, sizeof(flag));
}
/* Bind to specified address. */
int ret = bind(socket, (struct sockaddr *)ss, sockaddr_len(ss));
if (ret < 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