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

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