mirror of
https://github.com/NLnetLabs/unbound.git
synced 2025-12-24 00:29:58 -05:00
- make ip-transparent option work on OpenBSD.
git-svn-id: file:///svn/unbound/trunk@4393 be551aaa-1e26-0410-a405-d3ace91eadb9
This commit is contained in:
parent
d41209512e
commit
10b8997cc5
3 changed files with 23 additions and 7 deletions
|
|
@ -1,5 +1,6 @@
|
||||||
2 November 2017: Wouter
|
2 November 2017: Wouter
|
||||||
- Fix #1913: ub_ctx_config is under circumstances thread-safe.
|
- Fix #1913: ub_ctx_config is under circumstances thread-safe.
|
||||||
|
- make ip-transparent option work on OpenBSD.
|
||||||
|
|
||||||
31 October 2017: Wouter
|
31 October 2017: Wouter
|
||||||
- Document that errno is left informative on libunbound config read
|
- Document that errno is left informative on libunbound config read
|
||||||
|
|
|
||||||
|
|
@ -293,7 +293,8 @@ are going to exist later on, with host failover configuration. This is
|
||||||
a lot like interface\-automatic, but that one services all interfaces
|
a lot like interface\-automatic, but that one services all interfaces
|
||||||
and with this option you can select which (future) interfaces unbound
|
and with this option you can select which (future) interfaces unbound
|
||||||
provides service on. This option needs unbound to be started with root
|
provides service on. This option needs unbound to be started with root
|
||||||
permissions on some systems. The option uses IP_BINDANY on FreeBSD systems.
|
permissions on some systems. The option uses IP_BINDANY on FreeBSD systems
|
||||||
|
and SO_BINDANY on OpenBSD systems.
|
||||||
.TP
|
.TP
|
||||||
.B ip\-freebind: \fI<yes or no>
|
.B ip\-freebind: \fI<yes or no>
|
||||||
If yes, then use IP_FREEBIND socket option on sockets where unbound
|
If yes, then use IP_FREEBIND socket option on sockets where unbound
|
||||||
|
|
|
||||||
|
|
@ -167,7 +167,7 @@ create_udp_sock(int family, int socktype, struct sockaddr* addr,
|
||||||
int freebind, int use_systemd)
|
int freebind, int use_systemd)
|
||||||
{
|
{
|
||||||
int s;
|
int s;
|
||||||
#if defined(SO_REUSEADDR) || defined(SO_REUSEPORT) || defined(IPV6_USE_MIN_MTU) || defined(IP_TRANSPARENT) || defined(IP_BINDANY) || defined(IP_FREEBIND)
|
#if defined(SO_REUSEADDR) || defined(SO_REUSEPORT) || defined(IPV6_USE_MIN_MTU) || defined(IP_TRANSPARENT) || defined(IP_BINDANY) || defined(IP_FREEBIND) || defined (SO_BINDANY)
|
||||||
int on=1;
|
int on=1;
|
||||||
#endif
|
#endif
|
||||||
#ifdef IPV6_MTU
|
#ifdef IPV6_MTU
|
||||||
|
|
@ -182,7 +182,7 @@ create_udp_sock(int family, int socktype, struct sockaddr* addr,
|
||||||
#ifndef IPV6_V6ONLY
|
#ifndef IPV6_V6ONLY
|
||||||
(void)v6only;
|
(void)v6only;
|
||||||
#endif
|
#endif
|
||||||
#if !defined(IP_TRANSPARENT) && !defined(IP_BINDANY)
|
#if !defined(IP_TRANSPARENT) && !defined(IP_BINDANY) && !defined(SO_BINDANY)
|
||||||
(void)transparent;
|
(void)transparent;
|
||||||
#endif
|
#endif
|
||||||
#if !defined(IP_FREEBIND)
|
#if !defined(IP_FREEBIND)
|
||||||
|
|
@ -281,7 +281,14 @@ create_udp_sock(int family, int socktype, struct sockaddr* addr,
|
||||||
log_warn("setsockopt(.. IP%s_BINDANY ..) failed: %s",
|
log_warn("setsockopt(.. IP%s_BINDANY ..) failed: %s",
|
||||||
(family==AF_INET6?"V6":""), strerror(errno));
|
(family==AF_INET6?"V6":""), strerror(errno));
|
||||||
}
|
}
|
||||||
#endif /* IP_TRANSPARENT || IP_BINDANY */
|
#elif defined(SO_BINDANY)
|
||||||
|
if (transparent &&
|
||||||
|
setsockopt(s, SOL_SOCKET, SO_BINDANY, (void*)&on,
|
||||||
|
(socklen_t)sizeof(on)) < 0) {
|
||||||
|
log_warn("setsockopt(.. SO_BINDANY ..) failed: %s",
|
||||||
|
strerror(errno));
|
||||||
|
}
|
||||||
|
#endif /* IP_TRANSPARENT || IP_BINDANY || SO_BINDANY */
|
||||||
}
|
}
|
||||||
#ifdef IP_FREEBIND
|
#ifdef IP_FREEBIND
|
||||||
if(freebind &&
|
if(freebind &&
|
||||||
|
|
@ -592,7 +599,7 @@ create_tcp_accept_sock(struct addrinfo *addr, int v6only, int* noproto,
|
||||||
int* reuseport, int transparent, int mss, int freebind, int use_systemd)
|
int* reuseport, int transparent, int mss, int freebind, int use_systemd)
|
||||||
{
|
{
|
||||||
int s;
|
int s;
|
||||||
#if defined(SO_REUSEADDR) || defined(SO_REUSEPORT) || defined(IPV6_V6ONLY) || defined(IP_TRANSPARENT) || defined(IP_BINDANY) || defined(IP_FREEBIND)
|
#if defined(SO_REUSEADDR) || defined(SO_REUSEPORT) || defined(IPV6_V6ONLY) || defined(IP_TRANSPARENT) || defined(IP_BINDANY) || defined(IP_FREEBIND) || defined(SO_BINDANY)
|
||||||
int on = 1;
|
int on = 1;
|
||||||
#endif
|
#endif
|
||||||
#ifdef HAVE_SYSTEMD
|
#ifdef HAVE_SYSTEMD
|
||||||
|
|
@ -601,7 +608,7 @@ create_tcp_accept_sock(struct addrinfo *addr, int v6only, int* noproto,
|
||||||
#ifdef USE_TCP_FASTOPEN
|
#ifdef USE_TCP_FASTOPEN
|
||||||
int qlen;
|
int qlen;
|
||||||
#endif
|
#endif
|
||||||
#if !defined(IP_TRANSPARENT) && !defined(IP_BINDANY)
|
#if !defined(IP_TRANSPARENT) && !defined(IP_BINDANY) && !defined(SO_BINDANY)
|
||||||
(void)transparent;
|
(void)transparent;
|
||||||
#endif
|
#endif
|
||||||
#if !defined(IP_FREEBIND)
|
#if !defined(IP_FREEBIND)
|
||||||
|
|
@ -736,7 +743,14 @@ create_tcp_accept_sock(struct addrinfo *addr, int v6only, int* noproto,
|
||||||
log_warn("setsockopt(.. IP%s_BINDANY ..) failed: %s",
|
log_warn("setsockopt(.. IP%s_BINDANY ..) failed: %s",
|
||||||
(addr->ai_family==AF_INET6?"V6":""), strerror(errno));
|
(addr->ai_family==AF_INET6?"V6":""), strerror(errno));
|
||||||
}
|
}
|
||||||
#endif /* IP_TRANSPARENT || IP_BINDANY */
|
#elif defined(SO_BINDANY)
|
||||||
|
if (transparent &&
|
||||||
|
setsockopt(s, SOL_SOCKET, SO_BINDANY, (void*)&on, (socklen_t)
|
||||||
|
sizeof(on)) < 0) {
|
||||||
|
log_warn("setsockopt(.. SO_BINDANY ..) failed: %s",
|
||||||
|
strerror(errno));
|
||||||
|
}
|
||||||
|
#endif /* IP_TRANSPARENT || IP_BINDANY || SO_BINDANY */
|
||||||
if(
|
if(
|
||||||
#ifdef HAVE_SYSTEMD
|
#ifdef HAVE_SYSTEMD
|
||||||
!got_fd_from_systemd &&
|
!got_fd_from_systemd &&
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue