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

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