]> git.ipfire.org Git - thirdparty/kea.git/commitdiff
[5243] Ignored ENOPROTOOPT on SO_REUSEPORT for RedHat
authorFrancis Dupont <fdupont@isc.org>
Wed, 21 Jun 2017 14:37:47 +0000 (16:37 +0200)
committerFrancis Dupont <fdupont@isc.org>
Wed, 21 Jun 2017 14:37:47 +0000 (16:37 +0200)
src/lib/dhcp/pkt_filter_inet6.cc

index 9fae4d9cd29d39dc9ec2b4ffe1c3b2e2cde174a0..89acad61075f4f89d712a45e67fb145ac260f63f 100644 (file)
@@ -80,8 +80,11 @@ PktFilterInet6::openSocket(const Iface& iface,
     // in6addr_any (binding to port). Binding to port is required on some
     // operating systems, e.g. NetBSD and OpenBSD so as the socket can
     // join the socket to multicast group.
-    if (setsockopt(sock, SOL_SOCKET, SO_REUSEPORT,
-                   (char *)&flag, sizeof(flag)) < 0) {
+    // RedHat defines SO_REUSEPORT but the kernel does not support it
+    // and returns ENOPROTOOPT so ignore this error.
+    if ((setsockopt(sock, SOL_SOCKET, SO_REUSEPORT,
+                    (char *)&flag, sizeof(flag)) < 0) &&
+        (errno != ENOPROTOOPT)) {
         close(sock);
         isc_throw(SocketConfigError, "Can't set SO_REUSEPORT option on IPv6"
                   " socket.");