]> git.ipfire.org Git - thirdparty/bind9.git/commitdiff
FreeBSD fixes - proper affinity setting, don't use SO_REUSEPORT
authorWitold Krecicki <wpk@isc.org>
Fri, 26 Oct 2018 12:41:48 +0000 (14:41 +0200)
committerWitold Kręcicki <wpk@isc.org>
Thu, 15 Nov 2018 08:21:17 +0000 (08:21 +0000)
lib/isc/pthreads/thread.c
lib/isc/unix/socket.c

index 94801d5085605edce5bce9f6cc28ec5ee746849b..4795b5ba08af444a9765f6599d28addf79f68a01 100644 (file)
@@ -110,7 +110,7 @@ isc_thread_setaffinity(int cpu) {
        CPU_ZERO(&cpuset);
        CPU_SET(cpu, &cpuset);
        if (cpuset_setaffinity(CPU_LEVEL_WHICH, CPU_WHICH_TID, -1,
-           &cpuset, sizeof(cpuset)) != 0) {
+           sizeof(cpuset), &cpuset) != 0) {
                return (ISC_R_FAILURE);
        }
 #elif defined(HAVE_PTHREAD_SETAFFINITY_NP)
index 8989381c7ccd3a8762be3feaf61dc933be83f4ac..3af85b79c5ea0bfdc52a5e2491b4c67d2b17b38b 100644 (file)
@@ -3280,8 +3280,6 @@ process_fds(isc__socketthread_t *thread, struct kevent *events,
        bool readable, writable;
        bool done = false;
        bool have_ctlevent = false;
-       INSIST(thread->threadid == 0);
-
        if (nevents == thread->nevents) {
                /*
                 * This is not an error, but something unexpected.  If this
@@ -5455,7 +5453,12 @@ static bool              hasreuseport = false;
 
 static void
 init_hasreuseport() {
-#ifdef SO_REUSEPORT
+/*
+ * SO_REUSEPORT works very differently on *BSD and on Linux (because why not).
+ * We only want to use it on Linux, if it's available. On BSD we want to dup()
+ * sockets instead of re-binding them.
+ */
+#if defined(SO_REUSEPORT) && defined(__linux__)
        int sock, yes = 1;
        sock = socket(AF_INET, SOCK_DGRAM, 0);
        if (sock < 0) {