From 326484bed8214ba96bcd1a9a4d0657de31ce92e9 Mon Sep 17 00:00:00 2001 From: Bert Hubert Date: Thu, 11 Oct 2012 09:39:08 +0000 Subject: [PATCH] move to IPV6_V6ONLY, warn if it fails but charge on regardless. git-svn-id: svn://svn.powerdns.com/pdns/trunk/pdns@2799 d19b8d6e-7fed-0310-83ef-9ca221ded41b --- pdns/nameserver.cc | 5 +++-- pdns/tcpreceiver.cc | 9 ++++++--- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/pdns/nameserver.cc b/pdns/nameserver.cc index 60195b3f4..3d31c099d 100644 --- a/pdns/nameserver.cc +++ b/pdns/nameserver.cc @@ -174,8 +174,9 @@ void UDPNameserver::bindIPv6() if(IsAnyAddress(locala)) { int val=1; - setsockopt(s, IPPROTO_IP, GEN_IP_PKTINFO, &val, sizeof(val)); - setsockopt(s, IPPROTO_IPV6, IPV6_RECVPKTINFO, &val, sizeof(val)); + setsockopt(s, IPPROTO_IP, GEN_IP_PKTINFO, &val, sizeof(val)); // linux supports this, so why not - might fail on other systems + setsockopt(s, IPPROTO_IPV6, IPV6_RECVPKTINFO, &val, sizeof(val)); + setsockopt(s, IPPROTO_IPV6, IPV6_V6ONLY, &val, sizeof(val)); // if this fails, we report an error in tcpreceiver too } if(::bind(s, (sockaddr*)&locala, sizeof(locala))<0) { diff --git a/pdns/tcpreceiver.cc b/pdns/tcpreceiver.cc index f3fe7c1c3..06c7e0602 100644 --- a/pdns/tcpreceiver.cc +++ b/pdns/tcpreceiver.cc @@ -194,6 +194,7 @@ catch(NetworkError& ae) { static void proxyQuestion(shared_ptr packet) { int sock=socket(AF_INET, SOCK_STREAM, 0); + Utility::setCloseOnExec(sock); if(sock < 0) throw NetworkError("Error making TCP connection socket to recursor: "+stringerror()); @@ -822,7 +823,7 @@ TCPNameserver::TCPNameserver() for(vector::const_iterator laddr=locals.begin();laddr!=locals.end();++laddr) { int s=socket(AF_INET,SOCK_STREAM,0); Utility::setCloseOnExec(s); - + if(s<0) throw AhuException("Unable to acquire TCP socket: "+stringerror()); @@ -833,7 +834,7 @@ TCPNameserver::TCPNameserver() L<