mirror of
https://github.com/NLnetLabs/unbound.git
synced 2025-12-20 23:00:56 -05:00
- so-reuseport is available on BSDs(such as FreeBSD 10) and OS/X.
git-svn-id: file:///svn/unbound/trunk@3153 be551aaa-1e26-0410-a405-d3ace91eadb9
This commit is contained in:
parent
0aff3e3fca
commit
6fcdb08164
5 changed files with 15 additions and 11 deletions
|
|
@ -266,7 +266,7 @@ daemon_open_shared_ports(struct daemon* daemon)
|
|||
daemon->ports = NULL;
|
||||
}
|
||||
/* see if we want to reuseport */
|
||||
#if defined(__linux__) && defined(SO_REUSEPORT)
|
||||
#ifdef SO_REUSEPORT
|
||||
if(daemon->cfg->so_reuseport && daemon->cfg->num_threads > 0)
|
||||
daemon->reuseport = 1;
|
||||
#endif
|
||||
|
|
@ -449,7 +449,7 @@ thread_start(void* arg)
|
|||
tube_close_write(worker->cmd);
|
||||
close_other_pipes(worker->daemon, worker->thread_num);
|
||||
#endif
|
||||
#if defined(__linux__) && defined(SO_REUSEPORT)
|
||||
#ifdef SO_REUSEPORT
|
||||
if(worker->daemon->cfg->so_reuseport)
|
||||
port_num = worker->thread_num;
|
||||
else
|
||||
|
|
|
|||
|
|
@ -1,3 +1,6 @@
|
|||
27 June 2014: Wouter
|
||||
- so-reuseport is available on BSDs(such as FreeBSD 10) and OS/X.
|
||||
|
||||
26 June 2014: Wouter
|
||||
- unbound-control status reports if so-reuseport was successful.
|
||||
- iana portlist updated.
|
||||
|
|
|
|||
|
|
@ -85,7 +85,7 @@ server:
|
|||
# 0 is system default. Use 4m to handle spikes on very busy servers.
|
||||
# so-sndbuf: 0
|
||||
|
||||
# on Linux(3.9+) use SO_REUSEPORT to distribute queries over threads.
|
||||
# use SO_REUSEPORT to distribute queries over threads.
|
||||
# so-reuseport: no
|
||||
|
||||
# EDNS reassembly buffer to advertise to UDP peers (the actual buffer
|
||||
|
|
|
|||
|
|
@ -262,8 +262,9 @@ to so\-rcvbuf.
|
|||
.B so\-reuseport: \fI<yes or no>
|
||||
If yes, then open dedicated listening sockets for incoming queries for each
|
||||
thread and try to set the SO_REUSEPORT socket option on each socket. May
|
||||
distribute incoming queries to threads more evenly. Default is no. Only
|
||||
supported on Linux >= 3.9. You can enable it (on any platform and kernel),
|
||||
distribute incoming queries to threads more evenly. Default is no. On Linux
|
||||
it is supported in kernels >= 3.9. On other systems, FreeBSD, OSX it may
|
||||
also work. You can enable it (on any platform and kernel),
|
||||
it then attempts to open the port and passes the option if it was available
|
||||
at compile time, if that works it is used, if it fails, it continues
|
||||
silently (unless verbosity 3) without the option.
|
||||
|
|
|
|||
|
|
@ -153,8 +153,8 @@ create_udp_sock(int family, int socktype, struct sockaddr* addr,
|
|||
#endif
|
||||
}
|
||||
#endif /* SO_REUSEADDR */
|
||||
#if defined(__linux__) && defined(SO_REUSEPORT)
|
||||
/* Linux specific: try to set SO_REUSEPORT so that incoming
|
||||
#ifdef SO_REUSEPORT
|
||||
/* try to set SO_REUSEPORT so that incoming
|
||||
* queries are distributed evenly among the receiving threads.
|
||||
* Each thread must have its own socket bound to the same port,
|
||||
* with SO_REUSEPORT set on each socket.
|
||||
|
|
@ -172,7 +172,7 @@ create_udp_sock(int family, int socktype, struct sockaddr* addr,
|
|||
}
|
||||
#else
|
||||
(void)reuseport;
|
||||
#endif /* defined(__linux__) && defined(SO_REUSEPORT) */
|
||||
#endif /* defined(SO_REUSEPORT) */
|
||||
}
|
||||
if(rcv) {
|
||||
#ifdef SO_RCVBUF
|
||||
|
|
@ -491,8 +491,8 @@ create_tcp_accept_sock(struct addrinfo *addr, int v6only, int* noproto,
|
|||
return -1;
|
||||
}
|
||||
#endif /* SO_REUSEADDR */
|
||||
#if defined(__linux__) && defined(SO_REUSEPORT)
|
||||
/* Linux specific: try to set SO_REUSEPORT so that incoming
|
||||
#ifdef SO_REUSEPORT
|
||||
/* try to set SO_REUSEPORT so that incoming
|
||||
* connections are distributed evenly among the receiving threads.
|
||||
* Each thread must have its own socket bound to the same port,
|
||||
* with SO_REUSEPORT set on each socket.
|
||||
|
|
@ -510,7 +510,7 @@ create_tcp_accept_sock(struct addrinfo *addr, int v6only, int* noproto,
|
|||
}
|
||||
#else
|
||||
(void)reuseport;
|
||||
#endif /* defined(__linux__) && defined(SO_REUSEPORT) */
|
||||
#endif /* defined(SO_REUSEPORT) */
|
||||
#if defined(IPV6_V6ONLY)
|
||||
if(addr->ai_family == AF_INET6 && v6only) {
|
||||
if(setsockopt(s, IPPROTO_IPV6, IPV6_V6ONLY,
|
||||
|
|
|
|||
Loading…
Reference in a new issue