FreeBSD jail detect IPv6 not accessible.

git-svn-id: file:///svn/unbound/trunk@1586 be551aaa-1e26-0410-a405-d3ace91eadb9
This commit is contained in:
Wouter Wijngaards 2009-04-06 10:20:08 +00:00
parent 62fca9e1fb
commit d745581dbd
2 changed files with 9 additions and 2 deletions

View 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

View 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()));