From: Francis Dupont Date: Wed, 21 Jun 2017 14:37:47 +0000 (+0200) Subject: [5243] Ignored ENOPROTOOPT on SO_REUSEPORT for RedHat X-Git-Tag: trac5227_base~17^2~1 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=7a6c2e54cc97128b8802de896abd7a16b5662017;p=thirdparty%2Fkea.git [5243] Ignored ENOPROTOOPT on SO_REUSEPORT for RedHat --- diff --git a/src/lib/dhcp/pkt_filter_inet6.cc b/src/lib/dhcp/pkt_filter_inet6.cc index 9fae4d9cd2..89acad6107 100644 --- a/src/lib/dhcp/pkt_filter_inet6.cc +++ b/src/lib/dhcp/pkt_filter_inet6.cc @@ -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.");