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

This commit is contained in:
Jiri Popelka 2015-02-03 12:10:11 +01:00
parent 938f7b9f6c
commit 8e6888336c
2 changed files with 69 additions and 1 deletions

View File

@ -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,

View File

@ -18,7 +18,7 @@
Summary: Dynamic host configuration protocol software
Name: dhcp
Version: 4.3.1
Release: 20%{?dist}
Release: 21%{?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.
@ -79,6 +79,7 @@ Patch39: dhcp-relay-hop-limit.patch
Patch40: dhcp-ldapgssapi.patch
Patch41: dhcp-option97-pxe-client-id.patch
Patch42: dhcp-stateless-DUID-LLT.patch
Patch43: dhcp-client-request-release-bind-iface.patch
Patch100: dhcp-bind996.patch
BuildRequires: autoconf
@ -382,6 +383,9 @@ rm -rf includes/isc-dhcp
# (Submitted to dhcp-bugs@isc.org - [ISC-Bugs #38144])
%patch42 -p1 -b .stateless-DUID-LLT
# send unicast request/release via correct interface (#800561, #1177351)
%patch43 -p1 -b .bind-iface
# to build against bind-9.9.6
%patch100 -p1 -b .bind996
@ -686,6 +690,9 @@ done
%doc doc/html/
%changelog
* Tue Feb 03 2015 Jiri Popelka <jpopelka@redhat.com> - 12:4.3.1-21
- send unicast request/release via correct interface (#800561, #1177351)
* Mon Feb 02 2015 Tomas Hozza <thozza@redhat.com> - 12:4.3.1-20
- rebuild against bind-9.10.2rc1