diff options
author | Simon Kelley <simon@thekelleys.org.uk> | 2013-08-14 15:53:57 +0100 |
---|---|---|
committer | Simon Kelley <simon@thekelleys.org.uk> | 2013-08-14 15:53:57 +0100 |
commit | ffbad34b310ab2db6a686c85f5c0a0e52c0680c8 (patch) | |
tree | ce94aedc9352e929a3d7da1d0425f873dbfd9be4 | |
parent | f086d3964151831051d02ac030eaa4c10329fa3f (diff) | |
download | dnsmasq-ffbad34b310ab2db6a686c85f5c0a0e52c0680c8.tar.gz |
Set SOREUSEADDR as well as SOREUSEPORT on DHCP sockets when both available.
-rw-r--r-- | src/dhcp.c | 8 | ||||
-rw-r--r-- | src/dhcp6.c | 8 |
2 files changed, 8 insertions, 8 deletions
@@ -70,15 +70,15 @@ static int make_fd(int port) support it. This handles the introduction of REUSEPORT on Linux. */ if (option_bool(OPT_NOWILD) || option_bool(OPT_CLEVERBIND)) { - int rc = -1, porterr = 0; + int rc = 0; #ifdef SO_REUSEPORT if ((rc = setsockopt(fd, SOL_SOCKET, SO_REUSEPORT, &oneopt, sizeof(oneopt))) == -1 && - errno != ENOPROTOOPT) - porterr = 1; + errno == ENOPROTOOPT) + rc = 0; #endif - if (rc == -1 && !porterr) + if (rc != -1) rc = setsockopt(fd, SOL_SOCKET, SO_REUSEADDR, &oneopt, sizeof(oneopt)); if (rc == -1) diff --git a/src/dhcp6.c b/src/dhcp6.c index 17e03e5..89af7dd 100644 --- a/src/dhcp6.c +++ b/src/dhcp6.c @@ -55,15 +55,15 @@ void dhcp6_init(void) support it. This handles the introduction of REUSEPORT on Linux. */ if (option_bool(OPT_NOWILD) || option_bool(OPT_CLEVERBIND)) { - int rc = -1, porterr = 0; + int rc = 0; #ifdef SO_REUSEPORT if ((rc = setsockopt(fd, SOL_SOCKET, SO_REUSEPORT, &oneopt, sizeof(oneopt))) == -1 && - errno != ENOPROTOOPT) - porterr = 1; + errno == ENOPROTOOPT) + rc = 0; #endif - if (rc == -1 && !porterr) + if (rc != -1) rc = setsockopt(fd, SOL_SOCKET, SO_REUSEADDR, &oneopt, sizeof(oneopt)); if (rc == -1) |