udhcpc: periodically reread our ifindex and mac
authorDenys Vlasenko <vda.linux@googlemail.com>
Wed, 20 Oct 2010 19:38:29 +0000 (21:38 +0200)
committerDenys Vlasenko <vda.linux@googlemail.com>
Wed, 20 Oct 2010 19:38:29 +0000 (21:38 +0200)
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
networking/udhcp/dhcpc.c

index f685a1d22fca94dd15e5b8e8f32ec53d8bca0453..f0c8ace2ddb890c404106c6c70212066517fbf05 100644 (file)
@@ -1167,6 +1167,16 @@ int udhcpc_main(int argc UNUSED_PARAM, char **argv)
                 * resend discover/renew/whatever
                 */
                if (retval == 0) {
+                       /* 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).
+                        * Refresh ifindex and client_mac:
+                        */
+                       udhcp_read_interface(client_config.interface,
+                               &client_config.ifindex,
+                               NULL,
+                               client_config.client_mac);
+
                        /* We will restart the wait in any case */
                        already_waited_sec = 0;