[PATCH 08/19] udhcpc: refresh ifindex before sending data.

Florian Fainelli florian at alphacore.org
Tue Sep 25 12:06:07 UTC 2012


From: Felix Fietkau <nbd at openwrt.org>

When running on a bridge the ifindex may have changed (e.g. the member
interface were added/removed or if the status of the bridge changed).
Refresh the interface interface index before processing the next packet.

Signed-off-by: Felix Fietkau <nbd at openwrt.org>
---
 networking/udhcp/dhcpc.c |    6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/networking/udhcp/dhcpc.c b/networking/udhcp/dhcpc.c
index f1013f4..7d38d9d 100644
--- a/networking/udhcp/dhcpc.c
+++ b/networking/udhcp/dhcpc.c
@@ -1390,6 +1390,12 @@ int udhcpc_main(int argc UNUSED_PARAM, char **argv)
 		/* silence "uninitialized!" warning */
 		unsigned timestamp_before_wait = timestamp_before_wait;
 
+		/* When running on a bridge, the ifindex may have changed (e.g. if
+		 * member interfaces were added/removed or if the status of the
+		 * bridge changed).
+		 * Workaround: refresh it here before processing the next packet */
+		udhcp_read_interface(client_config.interface, &client_config.ifindex, NULL, client_config.client_mac);
+
 		//bb_error_msg("sockfd:%d, listen_mode:%d", sockfd, listen_mode);
 
 		/* Was opening raw or udp socket here
-- 
1.7.9.5



More information about the busybox mailing list