summaryrefslogtreecommitdiff
path: root/common/socket.c
diff options
context:
space:
mode:
authorFrancis Dupont <fdupont@isc.org>2017-06-22 16:25:34 +0200
committerFrancis Dupont <fdupont@isc.org>2017-06-22 16:25:34 +0200
commitbf0b1863713a24d6daa01038b4ab82ca75bb83d3 (patch)
tree9af9366a7f8d48a6f769010065d517af3f304a37 /common/socket.c
parent3f2eb206639e5e08b8a07e2c6cad479445bc1654 (diff)
downloadisc-dhcp-bf0b1863713a24d6daa01038b4ab82ca75bb83d3.tar.gz
Ignore ENOPROTOOPT on SO_REUSEPORT for RedHat
Diffstat (limited to 'common/socket.c')
-rw-r--r--common/socket.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/common/socket.c b/common/socket.c
index e8851b4c..779fc02e 100644
--- a/common/socket.c
+++ b/common/socket.c
@@ -219,11 +219,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) && *do_multicast) {
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");
}