[RFC 1/2] udhcpc: Wait for interface to become available
Sven Eckelmann
sven.eckelmann at open-mesh.com
Tue Nov 15 12:47:58 UTC 2016
From: Marek Lindner <marek.lindner at open-mesh.com>
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 <marek.lindner at open-mesh.com>
Signed-off-by: Sven Eckelmann <sven.eckelmann at open-mesh.com>
---
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
More information about the busybox
mailing list