summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatt Johnston <matt@ucc.asn.au>2011-10-20 13:45:43 +0000
committerMatt Johnston <matt@ucc.asn.au>2011-10-20 13:45:43 +0000
commit413fda92f15dfa9a82067dd7b4ed661b1612edd5 (patch)
tree5d74e341f78965712ded1d1c91ecae0a2fdc0658
parent60943377ba4e6c90f1a8deb6a83bb957eb128b23 (diff)
downloaddropbear-413fda92f15dfa9a82067dd7b4ed661b1612edd5.tar.gz
Try bind IPV6_V6ONLY
-rw-r--r--dbutil.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/dbutil.c b/dbutil.c
index dbf4019..abbd040 100644
--- a/dbutil.c
+++ b/dbutil.c
@@ -254,6 +254,16 @@ int dropbear_listen(const char* address, const char* port,
linger.l_linger = 5;
setsockopt(sock, SOL_SOCKET, SO_LINGER, (void*)&linger, sizeof(linger));
+#ifdef IPV6_V6ONLY
+ if (res->ai_family == AF_INET6) {
+ int on = 1;
+ if (setsockopt(sock, IPPROTO_IPV6, IPV6_V6ONLY,
+ &on, sizeof(on)) == -1) {
+ dropbear_log(LOG_WARNING, "Couldn't set IPV6_V6ONLY");
+ }
+ }
+#endif
+
set_sock_priority(sock);
if (bind(sock, res->ai_addr, res->ai_addrlen) < 0) {