openwrt/package/busybox/patches/243-udhcpc_changed_ifindex....

16 lines
672 B
Diff

--- a/networking/udhcp/dhcpc.c
+++ b/networking/udhcp/dhcpc.c
@@ -319,6 +319,12 @@ int udhcpc_main(int argc ATTRIBUTE_UNUSE
for (;;) {
unsigned 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 */
+ read_interface(client_config.interface, &client_config.ifindex, NULL, client_config.arp);
+
if (listen_mode != LISTEN_NONE && sockfd < 0) {
if (listen_mode == LISTEN_KERNEL)
sockfd = listen_socket(/*INADDR_ANY,*/ CLIENT_PORT, client_config.interface);