summaryrefslogtreecommitdiffhomepage
path: root/dbutil.c
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
commitc1fe2ec5ae8b96e905009d46a7a914b304fa18c8 (patch)
tree5d74e341f78965712ded1d1c91ecae0a2fdc0658 /dbutil.c
parent81cacd9f1556484b9bfdf3e127c29262ea7a76f4 (diff)
Try bind IPV6_V6ONLY
--HG-- extra : convert_revision : cfe965c1503984cafaa98b684269db99bec310eb
Diffstat (limited to 'dbutil.c')
-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) {