From de9498f1ab1fb8ca92eae74b459d4dec38203161 Mon Sep 17 00:00:00 2001 From: Charles Kerr Date: Tue, 15 Dec 2009 16:48:26 +0000 Subject: [PATCH] (trunk libT) #2669 "Apply IPV6_V6ONLY to the IPv6 DHT socket" -- committed jch's patch for 1.80 --- libtransmission/tr-dht.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/libtransmission/tr-dht.c b/libtransmission/tr-dht.c index 106eae41b..c84056674 100644 --- a/libtransmission/tr-dht.c +++ b/libtransmission/tr-dht.c @@ -319,10 +319,18 @@ tr_dhtInit(tr_session *ss, const tr_address * tr_addr) goto fail; if(tr_globalIPv6()) { + int one = 1; dht6_socket = socket(PF_INET6, SOCK_DGRAM, 0); if(dht6_socket < 0) goto fail; +#ifdef IPV6_V6ONLY + /* Since we always open an IPv4 socket on the same port, this + shouldn't matter. But I'm superstitious. */ + setsockopt(dht6_socket, IPPROTO_IPV6, IPV6_V6ONLY, + &one, sizeof(one)); +#endif + rebind_ipv6(1); }