From c1fe2ec5ae8b96e905009d46a7a914b304fa18c8 Mon Sep 17 00:00:00 2001 From: Matt Johnston Date: Thu, 20 Oct 2011 13:45:43 +0000 Subject: [PATCH] Try bind IPV6_V6ONLY --HG-- extra : convert_revision : cfe965c1503984cafaa98b684269db99bec310eb --- dbutil.c | 10 ++++++++++ 1 file changed, 10 insertions(+) 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) {