From f945fb1489f7d285c7f17d64fbe259637d3ef790 Mon Sep 17 00:00:00 2001 From: Natanael Copa Date: Thu, 6 Jul 2017 13:39:15 +0200 Subject: [PATCH] udhcpc: Don't background if -n is given we need add -b to our udhcpc options to prevent boot forever if there are no dhcp server. We also need a way for users to disable this behavior by making it possible to set -n option at runtime. --- networking/udhcp/dhcpc.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/networking/udhcp/dhcpc.c b/networking/udhcp/dhcpc.c index 0b14b0332..623b87fbb 100644 --- a/networking/udhcp/dhcpc.c +++ b/networking/udhcp/dhcpc.c @@ -1469,19 +1469,19 @@ int udhcpc_main(int argc UNUSED_PARAM, char **argv) } leasefail: udhcp_run_script(NULL, "leasefail"); + if (opt & OPT_n) { /* abort if no lease */ + bb_error_msg("no lease, failing"); + retval = 1; + goto ret; + } #if BB_MMU /* -b is not supported on NOMMU */ if (opt & OPT_b) { /* background if no lease */ bb_error_msg("no lease, forking to background"); client_background(); /* do not background again! */ opt = ((opt & ~OPT_b) | OPT_f); - } else -#endif - if (opt & OPT_n) { /* abort if no lease */ - bb_error_msg("no lease, failing"); - retval = 1; - goto ret; } +#endif /* wait before trying again */ timeout = tryagain_timeout; packet_num = 0;