summaryrefslogtreecommitdiffhomepage
path: root/dbutil.c
diff options
context:
space:
mode:
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) {