|
|
f9ed25 |
From 193c4d7631fd623efa601f52fdab6018bf8be771 Mon Sep 17 00:00:00 2001
|
|
|
f9ed25 |
From: Pavel Zhukov <pzhukov@redhat.com>
|
|
|
f9ed25 |
Date: Thu, 21 Feb 2019 10:39:36 +0100
|
|
|
f9ed25 |
Subject: [PATCH 17/26] Send unicast request/release via correct interface
|
|
|
f9ed25 |
Cc: pzhukov@redhat.com
|
|
|
f9ed25 |
|
|
|
f9ed25 |
(#800561, #1177351)
|
|
|
f9ed25 |
(Submitted to dhcp-bugs@isc.org - [ISC-Bugs #30544])
|
|
|
f9ed25 |
---
|
|
|
f9ed25 |
client/dhclient.c | 30 ++++++++++++++++++++++++++++++
|
|
|
f9ed25 |
1 file changed, 30 insertions(+)
|
|
|
f9ed25 |
|
|
|
f9ed25 |
diff --git a/client/dhclient.c b/client/dhclient.c
|
|
|
f9ed25 |
index ccc98e4..27fde69 100644
|
|
|
f9ed25 |
--- a/client/dhclient.c
|
|
|
f9ed25 |
+++ b/client/dhclient.c
|
|
|
f9ed25 |
@@ -3171,6 +3171,14 @@ void send_request (cpp)
|
|
|
f9ed25 |
#endif
|
|
|
f9ed25 |
if (destination.sin_addr.s_addr != INADDR_BROADCAST &&
|
|
|
f9ed25 |
fallback_interface) {
|
|
|
f9ed25 |
+#if defined(SO_BINDTODEVICE)
|
|
|
f9ed25 |
+ if (setsockopt(fallback_interface -> wfdesc, SOL_SOCKET,
|
|
|
f9ed25 |
+ SO_BINDTODEVICE, client->interface->name,
|
|
|
f9ed25 |
+ strlen(client->interface->name)) < 0) {
|
|
|
f9ed25 |
+ log_error("%s:%d: Failed to bind fallback interface"
|
|
|
f9ed25 |
+ " to %s: %m", MDL, client->interface->name);
|
|
|
f9ed25 |
+ }
|
|
|
f9ed25 |
+#endif
|
|
|
f9ed25 |
result = send_packet(fallback_interface, NULL, &client->packet,
|
|
|
f9ed25 |
client->packet_length, from, &destination,
|
|
|
f9ed25 |
NULL);
|
|
|
f9ed25 |
@@ -3180,6 +3188,13 @@ void send_request (cpp)
|
|
|
f9ed25 |
client->packet_length,
|
|
|
f9ed25 |
fallback_interface->name);
|
|
|
f9ed25 |
}
|
|
|
f9ed25 |
+#if defined(SO_BINDTODEVICE)
|
|
|
f9ed25 |
+ if (setsockopt(fallback_interface -> wfdesc, SOL_SOCKET,
|
|
|
f9ed25 |
+ SO_BINDTODEVICE, NULL, 0) < 0) {
|
|
|
f9ed25 |
+ log_fatal("%s:%d: Failed to unbind fallback interface:"
|
|
|
f9ed25 |
+ " %m", MDL);
|
|
|
f9ed25 |
+ }
|
|
|
f9ed25 |
+#endif
|
|
|
f9ed25 |
}
|
|
|
f9ed25 |
else {
|
|
|
f9ed25 |
/* Send out a packet. */
|
|
|
f9ed25 |
@@ -3297,6 +3312,14 @@ void send_release (cpp)
|
|
|
f9ed25 |
} else
|
|
|
f9ed25 |
#endif
|
|
|
f9ed25 |
if (fallback_interface) {
|
|
|
f9ed25 |
+#if defined(SO_BINDTODEVICE)
|
|
|
f9ed25 |
+ if (setsockopt(fallback_interface -> wfdesc, SOL_SOCKET,
|
|
|
f9ed25 |
+ SO_BINDTODEVICE, client->interface->name,
|
|
|
f9ed25 |
+ strlen(client->interface->name)) < 0) {
|
|
|
f9ed25 |
+ log_error("%s:%d: Failed to bind fallback interface"
|
|
|
f9ed25 |
+ " to %s: %m", MDL, client->interface->name);
|
|
|
f9ed25 |
+ }
|
|
|
f9ed25 |
+#endif
|
|
|
f9ed25 |
result = send_packet(fallback_interface, NULL, &client->packet,
|
|
|
f9ed25 |
client->packet_length, from, &destination,
|
|
|
f9ed25 |
NULL);
|
|
|
f9ed25 |
@@ -3306,6 +3329,13 @@ void send_release (cpp)
|
|
|
f9ed25 |
client->packet_length,
|
|
|
f9ed25 |
fallback_interface->name);
|
|
|
f9ed25 |
}
|
|
|
f9ed25 |
+#if defined(SO_BINDTODEVICE)
|
|
|
f9ed25 |
+ if (setsockopt(fallback_interface -> wfdesc, SOL_SOCKET,
|
|
|
f9ed25 |
+ SO_BINDTODEVICE, NULL, 0) < 0) {
|
|
|
f9ed25 |
+ log_fatal("%s:%d: Failed to unbind fallback interface:"
|
|
|
f9ed25 |
+ " %m", MDL);
|
|
|
f9ed25 |
+ }
|
|
|
f9ed25 |
+#endif
|
|
|
f9ed25 |
} else {
|
|
|
f9ed25 |
/* Send out a packet. */
|
|
|
f9ed25 |
result = send_packet(client->interface, NULL, &client->packet,
|
|
|
f9ed25 |
--
|
|
|
f9ed25 |
2.14.5
|
|
|
f9ed25 |
|