]> git.ipfire.org Git - thirdparty/dhcp.git/commitdiff
Ignore ENOPROTOOPT on SO_REUSEPORT for RedHat
authorFrancis Dupont <fdupont@isc.org>
Thu, 22 Jun 2017 14:28:55 +0000 (16:28 +0200)
committerFrancis Dupont <fdupont@isc.org>
Thu, 22 Jun 2017 14:28:55 +0000 (16:28 +0200)
common/socket.c

index c49317a05de1c5619c6f0ca953fcb1aa3a694cf7..0f5af4946e7ffe3713f470717581225176c220de 100644 (file)
@@ -213,11 +213,14 @@ if_register_socket(struct interface_info *info, int family,
         * respective interfaces.  This does not (and should not) affect
         * DHCPv4 sockets; we can't yet support BSD sockets well, much
         * less multiple sockets. Make sense only with multicast.
+        * RedHat defines SO_REUSEPORT with a kernel which does not support
+        * it and returns ENOPROTOOPT so in this case ignore the error.
         */
        if (local_family == AF_INET6) {
                flag = 1;
-               if (setsockopt(sock, SOL_SOCKET, SO_REUSEPORT,
-                              (char *)&flag, sizeof(flag)) < 0) {
+               if ((setsockopt(sock, SOL_SOCKET, SO_REUSEPORT,
+                               (char *)&flag, sizeof(flag)) < 0) &&
+                   (errno != ENOPROTOOPT)) {
                        log_fatal("Can't set SO_REUSEPORT option on dhcp "
                                  "socket: %m");
                }