Commit b6dfc76c authored by Juliusz Chroboczek's avatar Juliusz Chroboczek

Set IPV6_V6ONLY on the protocol socket.

parent e3e18efc
...@@ -42,14 +42,11 @@ babel_socket(int port) ...@@ -42,14 +42,11 @@ babel_socket(int port)
if(s < 0) if(s < 0)
return -1; return -1;
rc = setsockopt(s, SOL_SOCKET, SO_REUSEADDR, &one, sizeof(one)); rc = setsockopt(s, IPPROTO_IPV6, IPV6_V6ONLY, &one, sizeof(one));
if(rc < 0) if(rc < 0)
goto fail; goto fail;
memset(&sin6, 0, sizeof(sin6)); rc = setsockopt(s, SOL_SOCKET, SO_REUSEADDR, &one, sizeof(one));
sin6.sin6_family = AF_INET6;
sin6.sin6_port = htons(port);
rc = bind(s, (struct sockaddr*)&sin6, sizeof(sin6));
if(rc < 0) if(rc < 0)
goto fail; goto fail;
...@@ -76,6 +73,13 @@ babel_socket(int port) ...@@ -76,6 +73,13 @@ babel_socket(int port)
if(rc < 0) if(rc < 0)
goto fail; goto fail;
memset(&sin6, 0, sizeof(sin6));
sin6.sin6_family = AF_INET6;
sin6.sin6_port = htons(port);
rc = bind(s, (struct sockaddr*)&sin6, sizeof(sin6));
if(rc < 0)
goto fail;
return s; return s;
fail: fail:
......
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