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

45d60a
diff -up dhcp-4.2.5/client/dhclient.c.bind-iface dhcp-4.2.5/client/dhclient.c
45d60a
--- dhcp-4.2.5/client/dhclient.c.bind-iface	2015-02-03 12:24:08.076213363 +0100
45d60a
+++ dhcp-4.2.5/client/dhclient.c	2015-02-03 12:25:02.399168410 +0100
45d60a
@@ -2670,6 +2670,14 @@ void send_request (cpp)
45d60a
 
45d60a
 	if (destination.sin_addr.s_addr != INADDR_BROADCAST &&
45d60a
 	    fallback_interface) {
45d60a
+#if defined(SO_BINDTODEVICE)
45d60a
+		if (setsockopt(fallback_interface -> wfdesc, SOL_SOCKET,
45d60a
+			       SO_BINDTODEVICE, client->interface->name,
45d60a
+			       strlen(client->interface->name)) < 0) {
45d60a
+			log_error("%s:%d: Failed to bind fallback interface"
45d60a
+				  " to %s: %m", MDL, client->interface->name);
45d60a
+		}
45d60a
+#endif
45d60a
 		result = send_packet(fallback_interface, NULL, &client->packet,
45d60a
 				     client->packet_length, from, &destination,
45d60a
 				     NULL);
45d60a
@@ -2679,6 +2687,13 @@ void send_request (cpp)
45d60a
 				  client->packet_length,
45d60a
 				  fallback_interface->name);
45d60a
 		}
45d60a
+#if defined(SO_BINDTODEVICE)
45d60a
+		if (setsockopt(fallback_interface -> wfdesc, SOL_SOCKET,
45d60a
+			       SO_BINDTODEVICE, NULL, 0) < 0) {
45d60a
+			log_fatal("%s:%d: Failed to unbind fallback interface:"
45d60a
+				  " %m", MDL);
45d60a
+		}
45d60a
+#endif
45d60a
         }
45d60a
 	else {
45d60a
 		/* Send out a packet. */
45d60a
@@ -2758,6 +2773,14 @@ void send_release (cpp)
45d60a
 	      ntohs (destination.sin_port), client -> xid);
45d60a
 
45d60a
 	if (fallback_interface) {
45d60a
+#if defined(SO_BINDTODEVICE)
45d60a
+		if (setsockopt(fallback_interface -> wfdesc, SOL_SOCKET,
45d60a
+			       SO_BINDTODEVICE, client->interface->name,
45d60a
+			       strlen(client->interface->name)) < 0) {
45d60a
+			log_error("%s:%d: Failed to bind fallback interface"
45d60a
+				  " to %s: %m", MDL, client->interface->name);
45d60a
+		}
45d60a
+#endif
45d60a
 		result = send_packet(fallback_interface, NULL, &client->packet,
45d60a
 				      client->packet_length, from, &destination,
45d60a
 				      NULL);
45d60a
@@ -2767,6 +2790,13 @@ void send_release (cpp)
45d60a
 				  client->packet_length,
45d60a
 				  fallback_interface->name);
45d60a
 		}
45d60a
+#if defined(SO_BINDTODEVICE)
45d60a
+		if (setsockopt(fallback_interface -> wfdesc, SOL_SOCKET,
45d60a
+			       SO_BINDTODEVICE, NULL, 0) < 0) {
45d60a
+			log_fatal("%s:%d: Failed to unbind fallback interface:"
45d60a
+				  " %m", MDL);
45d60a
+		}
45d60a
+#endif
45d60a
         } else {
45d60a
 		/* Send out a packet. */
45d60a
 		result = send_packet(client->interface, NULL, &client->packet,