[dhcp/f21] send unicast request/release via correct interface (#800561, #1177351)

Jiří Popelka jpopelka at fedoraproject.org
Tue Feb 3 12:04:16 UTC 2015


commit 90b54352d367af90c5d774597403486d2a8636bb
Author: Jiri Popelka <jpopelka at redhat.com>
Date:   Tue Feb 3 12:10:11 2015 +0100

    send unicast request/release via correct interface (#800561, #1177351)

 dhcp-client-request-release-bind-iface.patch |   61 ++++++++++++++++++++++++++
 dhcp.spec                                    |    9 +++-
 2 files changed, 69 insertions(+), 1 deletions(-)
---
diff --git a/dhcp-client-request-release-bind-iface.patch b/dhcp-client-request-release-bind-iface.patch
new file mode 100644
index 0000000..e6df2c1
--- /dev/null
+++ b/dhcp-client-request-release-bind-iface.patch
@@ -0,0 +1,61 @@
+diff -up dhcp-4.3.1/client/dhclient.c.bind-iface dhcp-4.3.1/client/dhclient.c
+--- dhcp-4.3.1/client/dhclient.c.bind-iface	2015-02-03 12:06:57.040989568 +0100
++++ dhcp-4.3.1/client/dhclient.c	2015-02-03 12:08:28.716684946 +0100
+@@ -2661,6 +2661,14 @@ void send_request (cpp)
+ 
+ 	if (destination.sin_addr.s_addr != INADDR_BROADCAST &&
+ 	    fallback_interface) {
++#if defined(SO_BINDTODEVICE)
++		if (setsockopt(fallback_interface -> wfdesc, SOL_SOCKET,
++			       SO_BINDTODEVICE, client->interface->name,
++			       strlen(client->interface->name)) < 0) {
++			log_error("%s:%d: Failed to bind fallback interface"
++				  " to %s: %m", MDL, client->interface->name);
++		}
++#endif
+ 		result = send_packet(fallback_interface, NULL, &client->packet,
+ 				     client->packet_length, from, &destination,
+ 				     NULL);
+@@ -2670,6 +2678,13 @@ void send_request (cpp)
+ 				  client->packet_length,
+ 				  fallback_interface->name);
+ 		}
++#if defined(SO_BINDTODEVICE)
++		if (setsockopt(fallback_interface -> wfdesc, SOL_SOCKET,
++			       SO_BINDTODEVICE, NULL, 0) < 0) {
++			log_fatal("%s:%d: Failed to unbind fallback interface:"
++				  " %m", MDL);
++		}
++#endif
+         }
+ 	else {
+ 		/* Send out a packet. */
+@@ -2749,6 +2764,14 @@ void send_release (cpp)
+ 	      ntohs (destination.sin_port), ntohl(client -> xid));
+ 
+ 	if (fallback_interface) {
++#if defined(SO_BINDTODEVICE)
++		if (setsockopt(fallback_interface -> wfdesc, SOL_SOCKET,
++			       SO_BINDTODEVICE, client->interface->name,
++			       strlen(client->interface->name)) < 0) {
++			log_error("%s:%d: Failed to bind fallback interface"
++				  " to %s: %m", MDL, client->interface->name);
++		}
++#endif
+ 		result = send_packet(fallback_interface, NULL, &client->packet,
+ 				      client->packet_length, from, &destination,
+ 				      NULL);
+@@ -2758,6 +2781,13 @@ void send_release (cpp)
+ 				  client->packet_length,
+ 				  fallback_interface->name);
+ 		}
++#if defined(SO_BINDTODEVICE)
++		if (setsockopt(fallback_interface -> wfdesc, SOL_SOCKET,
++			       SO_BINDTODEVICE, NULL, 0) < 0) {
++			log_fatal("%s:%d: Failed to unbind fallback interface:"
++				  " %m", MDL);
++		}
++#endif
+         } else {
+ 		/* Send out a packet. */
+ 		result = send_packet(client->interface, NULL, &client->packet,
diff --git a/dhcp.spec b/dhcp.spec
index 77bbccf..717b566 100644
--- a/dhcp.spec
+++ b/dhcp.spec
@@ -18,7 +18,7 @@
 Summary:  Dynamic host configuration protocol software
 Name:     dhcp
 Version:  4.3.1
-Release:  11%{?dist}
+Release:  12%{?dist}
 # NEVER CHANGE THE EPOCH on this package.  The previous maintainer (prior to
 # dcantrell maintaining the package) made incorrect use of the epoch and
 # that's why it is at 12 now.  It should have never been used, but it was.
@@ -77,6 +77,7 @@ Patch37:  dhcp-dhc6-life.patch
 Patch38:  dhcp-skip-vlan.patch
 Patch39:  dhcp-relay-hop-limit.patch
 
+Patch40:  dhcp-client-request-release-bind-iface.patch
 Patch100: dhcp-bind996.patch
 
 BuildRequires: autoconf
@@ -335,6 +336,9 @@ rm -rf includes/isc-dhcp
 # (Submitted to dhcp-bugs at isc.org - [ISC-Bugs #37426])
 %patch39 -p1 -b .hop-limit
 
+# send unicast request/release via correct interface (#800561, #1177351)
+%patch40 -p1 -b .bind-iface
+
 # to build against bind-9.9.6
 %patch100 -p1 -b .bind996
 
@@ -609,6 +613,9 @@ done
 %doc doc/html/
 
 %changelog
+* Tue Feb 03 2015 Jiri Popelka <jpopelka at redhat.com> - 12:4.3.1-12
+- send unicast request/release via correct interface (#800561, #1177351)
+
 * Wed Nov 19 2014 Jiri Popelka <jpopelka at redhat.com> - 12:4.3.1-11
 - amend post scriptlets for #1120656
 


More information about the scm-commits mailing list