base-files: Allow subtargets to define base-files.mk
[openwrt/openwrt.git] / package / utils / busybox / patches / 204-udhcpc_src_ip_rebind.patch
1 --- a/networking/udhcp/dhcpc.c
2 +++ b/networking/udhcp/dhcpc.c
3 @@ -673,10 +673,10 @@ static void add_client_options(struct dh
4 * client reverts to using the IP broadcast address.
5 */
6
7 -static int raw_bcast_from_client_config_ifindex(struct dhcp_packet *packet)
8 +static int raw_bcast_from_client_config_ifindex(struct dhcp_packet *packet, uint32_t src_nip)
9 {
10 return udhcp_send_raw_packet(packet,
11 - /*src*/ INADDR_ANY, CLIENT_PORT,
12 + /*src*/ src_nip, CLIENT_PORT,
13 /*dst*/ INADDR_BROADCAST, SERVER_PORT, MAC_BCAST_ADDR,
14 client_config.ifindex);
15 }
16 @@ -687,7 +687,7 @@ static int bcast_or_ucast(struct dhcp_pa
17 return udhcp_send_kernel_packet(packet,
18 ciaddr, CLIENT_PORT,
19 server, SERVER_PORT);
20 - return raw_bcast_from_client_config_ifindex(packet);
21 + return raw_bcast_from_client_config_ifindex(packet, ciaddr);
22 }
23
24 /* Broadcast a DHCP discover packet to the network, with an optionally requested IP */
25 @@ -715,7 +715,7 @@ static NOINLINE int send_discover(uint32
26
27 if (msgs++ < 3)
28 bb_info_msg("Sending discover...");
29 - return raw_bcast_from_client_config_ifindex(&packet);
30 + return raw_bcast_from_client_config_ifindex(&packet, INADDR_ANY);
31 }
32
33 /* Broadcast a DHCP request message */
34 @@ -759,7 +759,7 @@ static NOINLINE int send_select(uint32_t
35
36 addr.s_addr = requested;
37 bb_info_msg("Sending select for %s...", inet_ntoa(addr));
38 - return raw_bcast_from_client_config_ifindex(&packet);
39 + return raw_bcast_from_client_config_ifindex(&packet, INADDR_ANY);
40 }
41
42 /* Unicast or broadcast a DHCP renew message */
43 @@ -827,7 +827,7 @@ static NOINLINE int send_decline(/*uint3
44 udhcp_add_simple_option(&packet, DHCP_SERVER_ID, server);
45
46 bb_info_msg("Sending decline...");
47 - return raw_bcast_from_client_config_ifindex(&packet);
48 + return raw_bcast_from_client_config_ifindex(&packet, INADDR_ANY);
49 }
50 #endif
51