mirror of
http://thekelleys.org.uk/git/dnsmasq.git
synced 2026-11-24 20:32:00 +00:00
Set SOREUSEADDR as well as SOREUSEPORT on DHCP sockets when both available.
This commit is contained in:
1 parent
f086d39641
commit
ffbad34b31
2 files changed
+8
-8
No files matched your search
+4
-4
@@ -70,15 +70,15 @@ static int make_fd(int port)
|
|||||||
support it. This handles the introduction of REUSEPORT on Linux. */
|
support it. This handles the introduction of REUSEPORT on Linux. */
|
||||||
if (option_bool(OPT_NOWILD) || option_bool(OPT_CLEVERBIND))
|
if (option_bool(OPT_NOWILD) || option_bool(OPT_CLEVERBIND))
|
||||||
{
|
{
|
||||||
int rc = -1, porterr = 0;
|
int rc = 0;
|
||||||
|
|
||||||
#ifdef SO_REUSEPORT
|
#ifdef SO_REUSEPORT
|
||||||
if ((rc = setsockopt(fd, SOL_SOCKET, SO_REUSEPORT, &oneopt, sizeof(oneopt))) == -1 &&
|
if ((rc = setsockopt(fd, SOL_SOCKET, SO_REUSEPORT, &oneopt, sizeof(oneopt))) == -1 &&
|
||||||
errno != ENOPROTOOPT)
|
errno == ENOPROTOOPT)
|
||||||
porterr = 1;
|
rc = 0;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (rc == -1 && !porterr)
|
if (rc != -1)
|
||||||
rc = setsockopt(fd, SOL_SOCKET, SO_REUSEADDR, &oneopt, sizeof(oneopt));
|
rc = setsockopt(fd, SOL_SOCKET, SO_REUSEADDR, &oneopt, sizeof(oneopt));
|
||||||
|
|
||||||
if (rc == -1)
|
if (rc == -1)
|
||||||
|
|||||||
+4
-4
@@ -55,15 +55,15 @@ void dhcp6_init(void)
|
|||||||
support it. This handles the introduction of REUSEPORT on Linux. */
|
support it. This handles the introduction of REUSEPORT on Linux. */
|
||||||
if (option_bool(OPT_NOWILD) || option_bool(OPT_CLEVERBIND))
|
if (option_bool(OPT_NOWILD) || option_bool(OPT_CLEVERBIND))
|
||||||
{
|
{
|
||||||
int rc = -1, porterr = 0;
|
int rc = 0;
|
||||||
|
|
||||||
#ifdef SO_REUSEPORT
|
#ifdef SO_REUSEPORT
|
||||||
if ((rc = setsockopt(fd, SOL_SOCKET, SO_REUSEPORT, &oneopt, sizeof(oneopt))) == -1 &&
|
if ((rc = setsockopt(fd, SOL_SOCKET, SO_REUSEPORT, &oneopt, sizeof(oneopt))) == -1 &&
|
||||||
errno != ENOPROTOOPT)
|
errno == ENOPROTOOPT)
|
||||||
porterr = 1;
|
rc = 0;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (rc == -1 && !porterr)
|
if (rc != -1)
|
||||||
rc = setsockopt(fd, SOL_SOCKET, SO_REUSEADDR, &oneopt, sizeof(oneopt));
|
rc = setsockopt(fd, SOL_SOCKET, SO_REUSEADDR, &oneopt, sizeof(oneopt));
|
||||||
|
|
||||||
if (rc == -1)
|
if (rc == -1)
|
||||||
|
|||||||
Reference in new issue
Block a user