From: bert hubert Date: Thu, 8 Jan 2015 19:45:44 +0000 (+0100) Subject: we relied on an unitialized variable for enabling UDP timestamps, plus set IPV6_V6ONL... X-Git-Tag: rec-3.7.0-rc1~44 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=0dfa94ab569be493d3c6106fb5bb661f7fa739be;p=pdns we relied on an unitialized variable for enabling UDP timestamps, plus set IPV6_V6ONLY when binding --- diff --git a/pdns/pdns_recursor.cc b/pdns/pdns_recursor.cc index 22811e0fe..09dffc405 100644 --- a/pdns/pdns_recursor.cc +++ b/pdns/pdns_recursor.cc @@ -1101,7 +1101,10 @@ void makeTCPServerSockets() L<= 0) { if(i==locals.begin()) @@ -1156,10 +1159,15 @@ void makeUDPServerSockets() throw PDNSException("Making a UDP server socket for resolver: "+netstringerror()); } setSocketTimestamps(fd); - int one; + if(IsAnyAddress(sin)) { + int one=1; setsockopt(fd, IPPROTO_IP, GEN_IP_PKTINFO, &one, sizeof(one)); // linux supports this, so why not - might fail on other systems setsockopt(fd, IPPROTO_IPV6, IPV6_RECVPKTINFO, &one, sizeof(one)); + if(sin.sin6.sin6_family == AF_INET6 && setsockopt(fd, IPPROTO_IPV6, IPV6_V6ONLY, &one, sizeof(one)) < 0) { + L<