[PATCH 1/1] udhcpc: don't exit after backgrounding on -n -b

ahippo at yandex.com ahippo at yandex.com
Fri Feb 22 21:46:19 UTC 2019


From: Andrey Mazo <ahippo at yandex.com>

Currently, running "udhcpc -n -b" causes udhcpc to go to background and
then exit after some time unless a lease is obtained.

It's not very useful to do so
as the calling process doesn't know
if the lease was obtained or not anyway.

The code actually tries to favor "-b" over "-n",
but doesn't clear "-n" flag while clearing "-b" after backgrounding.

So, clear "-n" flag after going into background.
This effectively makes "-b" override "-n" completely
and "-n -b" behave the same as "-b".

This allows to override default "-n" option, passed to udhcpc by ifupdown,
without recompiling busybox.

URL: https://bugs.busybox.net/11691

Signed-off-by: Andrey Mazo <ahippo at yandex.com>
---
 networking/udhcp/dhcpc.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/networking/udhcp/dhcpc.c b/networking/udhcp/dhcpc.c
index dcec8cdfd..99ff6e839 100644
--- a/networking/udhcp/dhcpc.c
+++ b/networking/udhcp/dhcpc.c
@@ -1485,6 +1485,8 @@ int udhcpc_main(int argc UNUSED_PARAM, char **argv)
 					client_background();
 					/* do not background again! */
 					opt = ((opt & ~OPT_b) | OPT_f);
+					/* do not abort after backgrounding */
+					opt &= ~OPT_n;
 				} else
 #endif
 				if (opt & OPT_n) { /* abort if no lease */

base-commit: e563f9e851c78f5c13cb9828ddb11ca981fd6331
-- 
2.19.2



More information about the busybox mailing list