Commit 0b4d5b09 authored by Niels Möller's avatar Niels Möller
Browse files

(make_lshd_port): Set the IPPROTO_IPV6ONLY socket

option when listening on an IPv6 socket.

Rev: src/lshd.c:1.187
parent 16bcebaf
......@@ -325,6 +325,14 @@ make_lshd_port(struct lshd_context *ctx, socklen_t addr_len, struct sockaddr *ad
if (setsockopt(fd, SOL_SOCKET, SO_REUSEADDR, &yes, sizeof (yes)) <0)
werror("setsockopt SO_REUSEADDR failed: %e.\n", errno);
if (addr->sa_family == AF_INET6)
if (setsockopt(fd, IPPROTO_IPV6, IPV6_V6ONLY, &yes, sizeof(yes)) < 0)
werror("setsockopt IPV6_V6ONLY failed: %e.\n", errno);
if (bind(fd, addr, addr_len) < 0)
werror("bind failed: %e.\n", errno);
Supports Markdown
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