]> git.ipfire.org Git - thirdparty/unbound.git/commitdiff
- so-reuseport is available on BSDs(such as FreeBSD 10) and OS/X.
authorWouter Wijngaards <wouter@nlnetlabs.nl>
Fri, 27 Jun 2014 14:11:57 +0000 (14:11 +0000)
committerWouter Wijngaards <wouter@nlnetlabs.nl>
Fri, 27 Jun 2014 14:11:57 +0000 (14:11 +0000)
git-svn-id: file:///svn/unbound/trunk@3153 be551aaa-1e26-0410-a405-d3ace91eadb9

daemon/daemon.c
doc/Changelog
doc/example.conf.in
doc/unbound.conf.5.in
services/listen_dnsport.c

index 3406d79400fe27057400169d2012ef3f3c7b3195..fd9d670e0df255fd87fb4e23912f3d3c64d82bf5 100644 (file)
@@ -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
index 14b03df8b67879ecabefa686758052091b8ed5b5..673365f6769705c2b909e8b3dab92f530edf1655 100644 (file)
@@ -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.
index d3249824a82da796a2f304c482764c19b23870a1..9cc7e02008ce5e3e7feaa078ef07dd7665c47c59 100644 (file)
@@ -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
index d175b4a0bf5abff3d57ce378668f210f9cbdb981..d98492ca34a3d1bcfc5bd36ac67324802d52b48f 100644 (file)
@@ -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.
index badd303d9e292549ac93702cf7b68f232a208665..e1d5f8b6f60f1fbe1d43f74d7040ed0cd17fdaa6 100644 (file)
@@ -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,