From: Marek Lindner <[email protected]>

udhcpc can fail to read the interface information when it was just created
dynamically. Instead of failing directly, udhcpc can wait 2 seconds and
retry 5 times to get data from it.

Signed-off-by: Marek Lindner <[email protected]>
Signed-off-by: Sven Eckelmann <[email protected]>
---
This is a rather old patch which was used together with OpenWrt before
netifd was used. Maybe someone still has interests in this workaround (or
in a variant of it)...
---
 networking/udhcp/dhcpc.c | 18 +++++++++++++-----
 1 file changed, 13 insertions(+), 5 deletions(-)

diff --git a/networking/udhcp/dhcpc.c b/networking/udhcp/dhcpc.c
index 1c10511..10b9e0f 100644
--- a/networking/udhcp/dhcpc.c
+++ b/networking/udhcp/dhcpc.c
@@ -1362,11 +1362,19 @@ int udhcpc_main(int argc UNUSED_PARAM, char **argv)
                udhcp_str2optset(optstr, &client_config.options);
        }
 
-       if (udhcp_read_interface(client_config.interface,
-                       &client_config.ifindex,
-                       NULL,
-                       client_config.client_mac)
-       ) {
+       for (timeout = 0; timeout < 5; timeout++) {
+               if (!udhcp_read_interface(client_config.interface,
+                               &client_config.ifindex,
+                               NULL,
+                               client_config.client_mac)
+               ) {
+                       break;
+               }
+
+               sleep(2);
+       }
+
+       if (timeout == 5) {
                return 1;
        }
 
-- 
2.10.2

_______________________________________________
busybox mailing list
[email protected]
http://lists.busybox.net/mailman/listinfo/busybox

Reply via email to