From: Wouter Wijngaards Date: Wed, 17 Feb 2016 08:02:32 +0000 (+0000) Subject: - Set IPPROTO_IP6 for ipv6 sockets otherwise invalid argument error. X-Git-Tag: release-1.5.8~14 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=df8ff4f7459727cf0c00a4b0f3014aac819d18a8;p=thirdparty%2Funbound.git - Set IPPROTO_IP6 for ipv6 sockets otherwise invalid argument error. git-svn-id: file:///svn/unbound/trunk@3625 be551aaa-1e26-0410-a405-d3ace91eadb9 --- diff --git a/doc/Changelog b/doc/Changelog index b290fbe40..758e55edd 100644 --- a/doc/Changelog +++ b/doc/Changelog @@ -1,3 +1,6 @@ +16 February 2016: Wouter + - Set IPPROTO_IP6 for ipv6 sockets otherwise invalid argument error. + 15 February 2016: Wouter - ip-transparent option for FreeBSD with IP_BINDANY socket option. - wait for sendto to drain socket buffers when they are full. diff --git a/services/listen_dnsport.c b/services/listen_dnsport.c index e7a14979f..be63439e6 100644 --- a/services/listen_dnsport.c +++ b/services/listen_dnsport.c @@ -189,8 +189,8 @@ create_udp_sock(int family, int socktype, struct sockaddr* addr, } #elif defined(IP_BINDANY) if (transparent && - setsockopt(s, IPPROTO_IP, IP_BINDANY, (void*)&on, - (socklen_t)sizeof(on)) < 0) { + setsockopt(s, (family==AF_INET6? IPPROTO_IPV6:IPPROTO_IP), + IP_BINDANY, (void*)&on, (socklen_t)sizeof(on)) < 0) { log_warn("setsockopt(.. IP_BINDANY ..) failed: %s", strerror(errno)); }