summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFrancis Dupont <fdupont@isc.org>2017-06-22 16:28:55 +0200
committerFrancis Dupont <fdupont@isc.org>2017-06-22 16:28:55 +0200
commit3210343d1e7f626ab1368e2a37ccc3eb1846cc70 (patch)
treeadad98d47dd0ade253a53879a06c80aabe8ddbc3
parentb16ddfe1960a09cbb01dce6410483042e3f5f086 (diff)
downloadisc-dhcp-3210343d1e7f626ab1368e2a37ccc3eb1846cc70.tar.gz
Ignore ENOPROTOOPT on SO_REUSEPORT for RedHat
-rw-r--r--common/socket.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/common/socket.c b/common/socket.c
index c49317a0..0f5af494 100644
--- a/common/socket.c
+++ b/common/socket.c
@@ -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");
}