[dnsmasq/f19] Use SO_REUSEPORT and SO_REUSEADDR if possible for DHCPv4/6 (#981973)

Tomas Hozza thozza at fedoraproject.org
Thu Aug 15 09:59:00 UTC 2013


commit 8bc11e35c875ede7c8b5aac3be9c4dcf8afbb7ee
Author: Tomas Hozza <thozza at redhat.com>
Date:   Thu Aug 15 11:49:26 2013 +0200

    Use SO_REUSEPORT and SO_REUSEADDR if possible for DHCPv4/6 (#981973)
    
    Change fix for the Bug #981973 after discussion with the upstream.
    
    Signed-off-by: Tomas Hozza <thozza at redhat.com>

 ....66-Dont_use_SO_REUSEPORT_on_dhcp4_socket.patch |   17 -----
 ...ADDR-as-well-as-SOREUSEPORT-on-DHCP-socke.patch |   63 ++++++++++++++++++++
 dnsmasq.spec                                       |    9 ++-
 3 files changed, 69 insertions(+), 20 deletions(-)
---
diff --git a/dnsmasq-2.66-Set-SOREUSEADDR-as-well-as-SOREUSEPORT-on-DHCP-socke.patch b/dnsmasq-2.66-Set-SOREUSEADDR-as-well-as-SOREUSEPORT-on-DHCP-socke.patch
new file mode 100644
index 0000000..3d05210
--- /dev/null
+++ b/dnsmasq-2.66-Set-SOREUSEADDR-as-well-as-SOREUSEPORT-on-DHCP-socke.patch
@@ -0,0 +1,63 @@
+From ffbad34b310ab2db6a686c85f5c0a0e52c0680c8 Mon Sep 17 00:00:00 2001
+From: Simon Kelley <simon at thekelleys.org.uk>
+Date: Wed, 14 Aug 2013 15:53:57 +0100
+Subject: [PATCH] Set SOREUSEADDR as well as SOREUSEPORT on DHCP sockets when
+ both available.
+
+Signed-off-by: Tomas Hozza <thozza at redhat.com>
+---
+ src/dhcp.c  | 8 ++++----
+ src/dhcp6.c | 8 ++++----
+ 2 files changed, 8 insertions(+), 8 deletions(-)
+
+diff --git a/src/dhcp.c b/src/dhcp.c
+index 333a327..b95a4ba 100644
+--- a/src/dhcp.c
++++ b/src/dhcp.c
+@@ -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)
+-- 
+1.8.3.1
+
diff --git a/dnsmasq.spec b/dnsmasq.spec
index 4dfe44e..f519aa5 100644
--- a/dnsmasq.spec
+++ b/dnsmasq.spec
@@ -13,7 +13,7 @@
 
 Name:           dnsmasq
 Version:        2.66
-Release:        9%{?extraversion}%{?dist}
+Release:        10%{?extraversion}%{?dist}
 Summary:        A lightweight DHCP/caching DNS server
 
 Group:          System Environment/Daemons
@@ -61,8 +61,8 @@ Patch16:        %{name}-2.66-Allow-constructed-ranges-from-interface-address-at-
 Patch17:        %{name}-2.66-Dont-BIND-DHCP-socket-if-more-interfaces-may-come.patch
 # commit 625ac28c61b0a5e6a252db00d72fbac6d88718fd
 Patch18:        %{name}-2.66-Fix_crash_with_empty_DHCP_string_options.patch
-# Don't use SO_REUSEPORT on DHCPv4 socket to prevent conflicts with ISC DHCP 
-Patch19:        %{name}-2.66-Dont_use_SO_REUSEPORT_on_dhcp4_socket.patch
+# commit ffbad34b310ab2db6a686c85f5c0a0e52c0680c8
+Patch19:        %{name}-2.66-Set-SOREUSEADDR-as-well-as-SOREUSEPORT-on-DHCP-socke.patch
 
 
 BuildRoot:      %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
@@ -199,6 +199,9 @@ rm -rf $RPM_BUILD_ROOT
 %{_mandir}/man1/dhcp_*
 
 %changelog
+* Thu Aug 15 2013 Tomas Hozza <thozza at redhat.com> - 2.66-10
+- Use SO_REUSEPORT and SO_REUSEADDR if possible for DHCPv4/6 (#981973)
+
 * Mon Aug 12 2013 Tomas Hozza <thozza at redhat.com> - 2.66-9
 - Don't use SO_REUSEPORT on DHCPv4 socket to prevent conflicts with ISC DHCP (#981973)
 


More information about the scm-commits mailing list