]> git.ipfire.org Git - thirdparty/unbound.git/commitdiff
FreeBSD jail detect IPv6 not accessible.
authorWouter Wijngaards <wouter@nlnetlabs.nl>
Mon, 6 Apr 2009 10:20:08 +0000 (10:20 +0000)
committerWouter Wijngaards <wouter@nlnetlabs.nl>
Mon, 6 Apr 2009 10:20:08 +0000 (10:20 +0000)
git-svn-id: file:///svn/unbound/trunk@1586 be551aaa-1e26-0410-a405-d3ace91eadb9

doc/Changelog
services/listen_dnsport.c

index 3f8405a8ba0b499a5110bbdd92596b01dd113eb7..c28ebbbe346eb5cfb7d9e011b1fa15d07b8af45a 100644 (file)
@@ -1,5 +1,6 @@
 6 April 2009: Wouter
        - windows compile fix.
+       - Detect FreeBSD jail without ipv6 addresses assigned.
 
 3 April 2009: Wouter
        - Fixed a bug that caused messages to be stored in the cache too 
index 797be106e596d90e280380abe6681210a83944d9..3171c433c95dc26ed38f7d0cd9eca85cd6d72c9f 100644 (file)
@@ -169,7 +169,10 @@ create_udp_sock(int family, int socktype, struct sockaddr* addr,
 #ifndef USE_WINSOCK
 #ifdef EADDRINUSE
                *inuse = (errno == EADDRINUSE);
-               if(errno != EADDRINUSE)
+               /* detect freebsd jail with no ipv6 permission */
+               if(family==AF_INET6 && errno==EINVAL)
+                       *noproto = 1;
+               else if(errno != EADDRINUSE)
                        log_err("can't bind socket: %s", strerror(errno));
 #endif
 #else /* USE_WINSOCK */
@@ -249,7 +252,10 @@ create_tcp_accept_sock(struct addrinfo *addr, int v6only, int* noproto)
 #endif /* IPV6_V6ONLY */
        if(bind(s, addr->ai_addr, addr->ai_addrlen) != 0) {
 #ifndef USE_WINSOCK
-               log_err("can't bind socket: %s", strerror(errno));
+               /* detect freebsd jail with no ipv6 permission */
+               if(addr->ai_family==AF_INET6 && errno==EINVAL)
+                       *noproto = 1;
+               else log_err("can't bind socket: %s", strerror(errno));
 #else
                log_err("can't bind socket: %s", 
                        wsa_strerror(WSAGetLastError()));