forked from extern/endlessh
Check for IPV6_V6ONLY before using it
This is necessary for supporting OmniOS (Solaris), which doesn't actually document how to actually define this flag. This platform also requires LDLIBS='-lsocket -lnsl' when compiling.
This commit is contained in:
parent
2f418df897
commit
08a9dfe97e
@ -430,11 +430,13 @@ server_create(int port)
|
|||||||
if (r == -1)
|
if (r == -1)
|
||||||
logmsg(LOG_DEBUG, "errno = %d, %s", errno, strerror(errno));
|
logmsg(LOG_DEBUG, "errno = %d, %s", errno, strerror(errno));
|
||||||
|
|
||||||
|
#if defined(IPV6_V6ONLY)
|
||||||
value = 0;
|
value = 0;
|
||||||
r = setsockopt(s, SOL_SOCKET, IPV6_V6ONLY, &value, sizeof(value));
|
r = setsockopt(s, SOL_SOCKET, IPV6_V6ONLY, &value, sizeof(value));
|
||||||
logmsg(LOG_DEBUG, "setsockopt(IPV6_V6ONLY, false) = %d", r);
|
logmsg(LOG_DEBUG, "setsockopt(IPV6_V6ONLY, false) = %d", r);
|
||||||
if (r == -1)
|
if (r == -1)
|
||||||
logmsg(LOG_DEBUG, "errno = %d, %s", errno, strerror(errno));
|
logmsg(LOG_DEBUG, "errno = %d, %s", errno, strerror(errno));
|
||||||
|
#endif /* IPV6_V6ONLY */
|
||||||
|
|
||||||
struct sockaddr_in6 addr = {
|
struct sockaddr_in6 addr = {
|
||||||
.sin6_family = AF_INET6,
|
.sin6_family = AF_INET6,
|
||||||
|
Loading…
Reference in New Issue
Block a user