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

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