Blame SOURCES/dhcp-client-request-release-bind-iface.patch

26a25c
diff -up dhcp-4.3.4/client/dhclient.c.bind-iface dhcp-4.3.4/client/dhclient.c
26a25c
--- dhcp-4.3.4/client/dhclient.c.bind-iface	2016-04-29 13:06:50.595257108 +0200
26a25c
+++ dhcp-4.3.4/client/dhclient.c	2016-04-29 13:08:30.237281528 +0200
26a25c
@@ -3023,6 +3023,14 @@ void send_request (cpp)
26a25c
 #endif
26a25c
 	if (destination.sin_addr.s_addr != INADDR_BROADCAST &&
26a25c
 	    fallback_interface) {
26a25c
+#if defined(SO_BINDTODEVICE)
26a25c
+		if (setsockopt(fallback_interface -> wfdesc, SOL_SOCKET,
26a25c
+			       SO_BINDTODEVICE, client->interface->name,
26a25c
+			       strlen(client->interface->name)) < 0) {
26a25c
+			log_error("%s:%d: Failed to bind fallback interface"
26a25c
+				  " to %s: %m", MDL, client->interface->name);
26a25c
+		}
26a25c
+#endif
26a25c
 		result = send_packet(fallback_interface, NULL, &client->packet,
26a25c
 				     client->packet_length, from, &destination,
26a25c
 				     NULL);
26a25c
@@ -3032,6 +3040,13 @@ void send_request (cpp)
26a25c
 				  client->packet_length,
26a25c
 				  fallback_interface->name);
26a25c
 		}
26a25c
+#if defined(SO_BINDTODEVICE)
26a25c
+		if (setsockopt(fallback_interface -> wfdesc, SOL_SOCKET,
26a25c
+			       SO_BINDTODEVICE, NULL, 0) < 0) {
26a25c
+			log_fatal("%s:%d: Failed to unbind fallback interface:"
26a25c
+				  " %m", MDL);
26a25c
+		}
26a25c
+#endif
26a25c
         }
26a25c
 	else {
26a25c
 		/* Send out a packet. */
26a25c
@@ -3144,6 +3159,14 @@ void send_release (cpp)
26a25c
 	} else
26a25c
 #endif
26a25c
 	if (fallback_interface) {
26a25c
+#if defined(SO_BINDTODEVICE)
26a25c
+		if (setsockopt(fallback_interface -> wfdesc, SOL_SOCKET,
26a25c
+			       SO_BINDTODEVICE, client->interface->name,
26a25c
+			       strlen(client->interface->name)) < 0) {
26a25c
+			log_error("%s:%d: Failed to bind fallback interface"
26a25c
+				  " to %s: %m", MDL, client->interface->name);
26a25c
+		}
26a25c
+#endif
26a25c
 		result = send_packet(fallback_interface, NULL, &client->packet,
26a25c
 				      client->packet_length, from, &destination,
26a25c
 				      NULL);
26a25c
@@ -3153,6 +3176,13 @@ void send_release (cpp)
26a25c
 				  client->packet_length,
26a25c
 				  fallback_interface->name);
26a25c
 		}
26a25c
+#if defined(SO_BINDTODEVICE)
26a25c
+		if (setsockopt(fallback_interface -> wfdesc, SOL_SOCKET,
26a25c
+			       SO_BINDTODEVICE, NULL, 0) < 0) {
26a25c
+			log_fatal("%s:%d: Failed to unbind fallback interface:"
26a25c
+				  " %m", MDL);
26a25c
+		}
26a25c
+#endif
26a25c
         } else {
26a25c
 		/* Send out a packet. */
26a25c
 		result = send_packet(client->interface, NULL, &client->packet,