2019-03-01 11:50:13 +00:00
|
|
|
From 8a2b491f79aab1f04feac89586dfab1e55b47adb Mon Sep 17 00:00:00 2001
|
|
|
|
From: Pavel Zhukov <pzhukov@redhat.com>
|
|
|
|
Date: Thu, 21 Feb 2019 10:39:36 +0100
|
|
|
|
Subject: [PATCH 17/21] Send unicast request/release via correct interface
|
|
|
|
Cc: pzhukov@redhat.com
|
|
|
|
|
|
|
|
(#800561, #1177351)
|
|
|
|
(Submitted to dhcp-bugs@isc.org - [ISC-Bugs #30544])
|
|
|
|
---
|
|
|
|
client/dhclient.c | 30 ++++++++++++++++++++++++++++++
|
|
|
|
1 file changed, 30 insertions(+)
|
|
|
|
|
|
|
|
diff --git a/client/dhclient.c b/client/dhclient.c
|
|
|
|
index ccc98e4..27fde69 100644
|
|
|
|
--- a/client/dhclient.c
|
|
|
|
+++ b/client/dhclient.c
|
|
|
|
@@ -3171,6 +3171,14 @@ void send_request (cpp)
|
2016-05-02 13:17:32 +00:00
|
|
|
#endif
|
2015-02-03 11:10:11 +00:00
|
|
|
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);
|
2019-03-01 11:50:13 +00:00
|
|
|
@@ -3180,6 +3188,13 @@ void send_request (cpp)
|
2015-02-03 11:10:11 +00:00
|
|
|
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. */
|
2019-03-01 11:50:13 +00:00
|
|
|
@@ -3297,6 +3312,14 @@ void send_release (cpp)
|
2016-05-02 13:17:32 +00:00
|
|
|
} else
|
|
|
|
#endif
|
2015-02-03 11:10:11 +00:00
|
|
|
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);
|
2019-03-01 11:50:13 +00:00
|
|
|
@@ -3306,6 +3329,13 @@ void send_release (cpp)
|
2015-02-03 11:10:11 +00:00
|
|
|
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,
|
2019-03-01 11:50:13 +00:00
|
|
|
--
|
|
|
|
2.14.5
|
|
|
|
|