|
|
cab8d5 |
From ffbad34b310ab2db6a686c85f5c0a0e52c0680c8 Mon Sep 17 00:00:00 2001
|
|
|
cab8d5 |
From: Simon Kelley <simon@thekelleys.org.uk>
|
|
|
cab8d5 |
Date: Wed, 14 Aug 2013 15:53:57 +0100
|
|
|
cab8d5 |
Subject: [PATCH] Set SOREUSEADDR as well as SOREUSEPORT on DHCP sockets when
|
|
|
cab8d5 |
both available.
|
|
|
cab8d5 |
|
|
|
cab8d5 |
Signed-off-by: Tomas Hozza <thozza@redhat.com>
|
|
|
cab8d5 |
---
|
|
|
cab8d5 |
src/dhcp.c | 8 ++++----
|
|
|
cab8d5 |
src/dhcp6.c | 8 ++++----
|
|
|
cab8d5 |
2 files changed, 8 insertions(+), 8 deletions(-)
|
|
|
cab8d5 |
|
|
|
cab8d5 |
diff --git a/src/dhcp.c b/src/dhcp.c
|
|
|
cab8d5 |
index 333a327..b95a4ba 100644
|
|
|
cab8d5 |
--- a/src/dhcp.c
|
|
|
cab8d5 |
+++ b/src/dhcp.c
|
|
|
cab8d5 |
@@ -70,15 +70,15 @@ static int make_fd(int port)
|
|
|
cab8d5 |
support it. This handles the introduction of REUSEPORT on Linux. */
|
|
|
cab8d5 |
if (option_bool(OPT_NOWILD) || option_bool(OPT_CLEVERBIND))
|
|
|
cab8d5 |
{
|
|
|
cab8d5 |
- int rc = -1, porterr = 0;
|
|
|
cab8d5 |
+ int rc = 0;
|
|
|
cab8d5 |
|
|
|
cab8d5 |
#ifdef SO_REUSEPORT
|
|
|
cab8d5 |
if ((rc = setsockopt(fd, SOL_SOCKET, SO_REUSEPORT, &oneopt, sizeof(oneopt))) == -1 &&
|
|
|
cab8d5 |
- errno != ENOPROTOOPT)
|
|
|
cab8d5 |
- porterr = 1;
|
|
|
cab8d5 |
+ errno == ENOPROTOOPT)
|
|
|
cab8d5 |
+ rc = 0;
|
|
|
cab8d5 |
#endif
|
|
|
cab8d5 |
|
|
|
cab8d5 |
- if (rc == -1 && !porterr)
|
|
|
cab8d5 |
+ if (rc != -1)
|
|
|
cab8d5 |
rc = setsockopt(fd, SOL_SOCKET, SO_REUSEADDR, &oneopt, sizeof(oneopt));
|
|
|
cab8d5 |
|
|
|
cab8d5 |
if (rc == -1)
|
|
|
cab8d5 |
diff --git a/src/dhcp6.c b/src/dhcp6.c
|
|
|
cab8d5 |
index 17e03e5..89af7dd 100644
|
|
|
cab8d5 |
--- a/src/dhcp6.c
|
|
|
cab8d5 |
+++ b/src/dhcp6.c
|
|
|
cab8d5 |
@@ -55,15 +55,15 @@ void dhcp6_init(void)
|
|
|
cab8d5 |
support it. This handles the introduction of REUSEPORT on Linux. */
|
|
|
cab8d5 |
if (option_bool(OPT_NOWILD) || option_bool(OPT_CLEVERBIND))
|
|
|
cab8d5 |
{
|
|
|
cab8d5 |
- int rc = -1, porterr = 0;
|
|
|
cab8d5 |
+ int rc = 0;
|
|
|
cab8d5 |
|
|
|
cab8d5 |
#ifdef SO_REUSEPORT
|
|
|
cab8d5 |
if ((rc = setsockopt(fd, SOL_SOCKET, SO_REUSEPORT, &oneopt, sizeof(oneopt))) == -1 &&
|
|
|
cab8d5 |
- errno != ENOPROTOOPT)
|
|
|
cab8d5 |
- porterr = 1;
|
|
|
cab8d5 |
+ errno == ENOPROTOOPT)
|
|
|
cab8d5 |
+ rc = 0;
|
|
|
cab8d5 |
#endif
|
|
|
cab8d5 |
|
|
|
cab8d5 |
- if (rc == -1 && !porterr)
|
|
|
cab8d5 |
+ if (rc != -1)
|
|
|
cab8d5 |
rc = setsockopt(fd, SOL_SOCKET, SO_REUSEADDR, &oneopt, sizeof(oneopt));
|
|
|
cab8d5 |
|
|
|
cab8d5 |
if (rc == -1)
|
|
|
cab8d5 |
--
|
|
|
cab8d5 |
1.8.3.1
|
|
|
cab8d5 |
|