]> git.ipfire.org Git - thirdparty/bind9.git/commitdiff
handle systems without IPv4
authorMark Andrews <marka@isc.org>
Mon, 19 Nov 2018 01:27:56 +0000 (12:27 +1100)
committerMark Andrews <marka@isc.org>
Fri, 23 Nov 2018 01:05:53 +0000 (12:05 +1100)
lib/isc/unix/socket.c

index 7e1c616afdb07abe11854c9526ad11ac1129c92a..2a5648c126b838c640da5a2402fa1f7235ffc3c6 100644 (file)
@@ -5453,9 +5453,13 @@ init_hasreuseport() {
        int sock, yes = 1;
        sock = socket(AF_INET, SOCK_DGRAM, 0);
        if (sock < 0) {
-               return;
-       } else if (setsockopt(sock, SOL_SOCKET, SO_REUSEADDR,
-                             (void *)&yes, sizeof(yes)) < 0)
+               sock = socket(AF_INET6, SOCK_DGRAM, 0);
+               if (sock < 0) {
+                       return;
+               }
+       }
+       if (setsockopt(sock, SOL_SOCKET, SO_REUSEADDR,
+                      (void *)&yes, sizeof(yes)) < 0)
        {
                close(sock);
                return;