]>
Commit | Line | Data |
---|---|---|
d8feb2d7 SS |
1 | diff -up dhcp-4.3.4/client/dhclient.c.bind-iface dhcp-4.3.4/client/dhclient.c |
2 | --- dhcp-4.3.4/client/dhclient.c.bind-iface 2016-04-29 13:06:50.595257108 +0200 | |
3 | +++ dhcp-4.3.4/client/dhclient.c 2016-04-29 13:08:30.237281528 +0200 | |
4 | @@ -3023,6 +3023,14 @@ void send_request (cpp) | |
5 | #endif | |
6 | if (destination.sin_addr.s_addr != INADDR_BROADCAST && | |
7 | fallback_interface) { | |
8 | +#if defined(SO_BINDTODEVICE) | |
9 | + if (setsockopt(fallback_interface -> wfdesc, SOL_SOCKET, | |
10 | + SO_BINDTODEVICE, client->interface->name, | |
11 | + strlen(client->interface->name)) < 0) { | |
12 | + log_error("%s:%d: Failed to bind fallback interface" | |
13 | + " to %s: %m", MDL, client->interface->name); | |
14 | + } | |
15 | +#endif | |
16 | result = send_packet(fallback_interface, NULL, &client->packet, | |
17 | client->packet_length, from, &destination, | |
18 | NULL); | |
19 | @@ -3032,6 +3040,13 @@ void send_request (cpp) | |
20 | client->packet_length, | |
21 | fallback_interface->name); | |
22 | } | |
23 | +#if defined(SO_BINDTODEVICE) | |
24 | + if (setsockopt(fallback_interface -> wfdesc, SOL_SOCKET, | |
25 | + SO_BINDTODEVICE, NULL, 0) < 0) { | |
26 | + log_fatal("%s:%d: Failed to unbind fallback interface:" | |
27 | + " %m", MDL); | |
28 | + } | |
29 | +#endif | |
30 | } | |
31 | else { | |
32 | /* Send out a packet. */ | |
33 | @@ -3144,6 +3159,14 @@ void send_release (cpp) | |
34 | } else | |
35 | #endif | |
36 | if (fallback_interface) { | |
37 | +#if defined(SO_BINDTODEVICE) | |
38 | + if (setsockopt(fallback_interface -> wfdesc, SOL_SOCKET, | |
39 | + SO_BINDTODEVICE, client->interface->name, | |
40 | + strlen(client->interface->name)) < 0) { | |
41 | + log_error("%s:%d: Failed to bind fallback interface" | |
42 | + " to %s: %m", MDL, client->interface->name); | |
43 | + } | |
44 | +#endif | |
45 | result = send_packet(fallback_interface, NULL, &client->packet, | |
46 | client->packet_length, from, &destination, | |
47 | NULL); | |
48 | @@ -3153,6 +3176,13 @@ void send_release (cpp) | |
49 | client->packet_length, | |
50 | fallback_interface->name); | |
51 | } | |
52 | +#if defined(SO_BINDTODEVICE) | |
53 | + if (setsockopt(fallback_interface -> wfdesc, SOL_SOCKET, | |
54 | + SO_BINDTODEVICE, NULL, 0) < 0) { | |
55 | + log_fatal("%s:%d: Failed to unbind fallback interface:" | |
56 | + " %m", MDL); | |
57 | + } | |
58 | +#endif | |
59 | } else { | |
60 | /* Send out a packet. */ | |
61 | result = send_packet(client->interface, NULL, &client->packet, |