Blame SOURCES/0017-Send-unicast-request-release-via-correct-interface.patch

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