Commit 7569d2dc authored by Natanael Copa's avatar Natanael Copa

main/busybox: let udhcpc background if there are no lease

We need to prevent ifup get stuck forever if there are no lease so we
add -b to udhcp opts.

To give users a way to disable this, we patch udhcpc to only respect -b
flag if -n is not given.
parent 158728fb
......@@ -2,7 +2,7 @@
# Maintainer: Natanael Copa <ncopa@alpinelinux.org>
pkgname=busybox
pkgver=1.26.2
pkgrel=3
pkgrel=4
pkgdesc="Size optimized toolbox of many common UNIX utilities"
url=http://busybox.net
arch="all"
......@@ -31,6 +31,7 @@ source="http://busybox.net/downloads/$pkgname-$pkgver.tar.bz2
0013-ash-make-shellexec-capable-of-using-separate-argv-0-.patch
0014-ash-implement-exec-a-ARGV0-CMD-ARGV1.patch
0015-syslogd-adjust-timezone-option.patch
udhcpc.patch
fix-tests.patch
location-for-cpio.patch
......@@ -164,10 +165,11 @@ f82caa1dc4395f266b024a7face267a916a80ead95f3d392b10fd397d0fdf62703e3078357bc7196
bf3e7c400e718fbc19fda19d7304ed938e5c59f45d5d1ba6eafd8f62a984d40419dbefd9f6840ac7f220d00abfae67e8f31be78b4c2e25310b265bca8beb91a2 0013-ash-make-shellexec-capable-of-using-separate-argv-0-.patch
cb7aa4d5d22596bc8c6510cb653599dd8cf4c3a5312e93adfc6411d811376db2ad3b506a111322f46aa9929a5337e22a169da4ea250fd4b39e703adbc8792a2d 0014-ash-implement-exec-a-ARGV0-CMD-ARGV1.patch
c37d1583cfb32e7aa077e7f4ea121dd3b2e3cf989a3dca2793126bcd89eb6d8eb6fae948085565807c2fb98d8dc92a2907cc03d988d1a47305d3e588ac268c5b 0015-syslogd-adjust-timezone-option.patch
1375aa41038d80ef21ac3cd239999f813fd9a2e5ec062f34ed221d75e312f5e17e4bfcac4b20450139059dd586cfeda2b10c02b9cc17416c828e9a1ea3421601 udhcpc.patch
2adfc6c71cfcc5df12edef13228c92b34c7782615e60effc97e6e7a9aa7e015c24c7b3950a8a9a2bf3ba5efd43a08ad45b16b35b03c90275807380e0600cb70d fix-tests.patch
f26e090f5de0096ba5c4d46989ebe0ab5fa64c8bf54cd37ddec302fddfde23eac914858d86cc52bf3b5780a8e81ea2612ef6e713df2828e52c606f86a6816f39 location-for-cpio.patch
a9b1403c844c51934637215307dd9e2adb9458921047acff0d86dcf229b6e0027f4b2c6cdaa25a58407aad9d098fb5685d58eb5ff8d2aa3de4912cdea21fe54c acpid.logrotate
d4b9f4a09dcf08ec9f7a66c5250465e3a6dd9beb15140a462a1464110824426c732399e4dab4e6a33073626d4db0e76085b218cd0521027e57ce9f918ff1af29 busyboxconfig
43e5b1c699fffea4e41621faee8b3d28774e5888070113ae98a940c6837efec617bac7c78c34a2c982cbcccf25a67691c480be8ba4b8e552eed8bb0d3a09dac8 busyboxconfig
c1dd56509277c59751907a27f067f1622191ddfd498acfe390d83136d36a41f2bdfc2fd4daf35af77219a66fb00fea20483f34112afd5df2ccd9f36ab548e66f bbsuid.c
a1127c8a384294135e11500fde7ead33b73d24b11c21911b08447a4c4ef71d7a9965d6466f60f2da64e3b877213b0a3e924a5add3c5333ee3ecde8c2a91c5e02 dad.if-up
4e7c291a70e879b74c0fc07c54a73ef50537d8be68fee6b2d409425c07afd2d67f9b6afcd8c33a7971014913cc5de85e45079681c9e77200c6cc2f34acfba6d2 nologin.c"
......@@ -934,7 +934,7 @@ CONFIG_FEATURE_UDHCP_RFC3397=y
CONFIG_FEATURE_UDHCP_8021Q=y
CONFIG_UDHCPC_DEFAULT_SCRIPT="/usr/share/udhcpc/default.script"
CONFIG_UDHCPC_SLACK_FOR_BUGGY_SERVERS=80
CONFIG_IFUPDOWN_UDHCPC_CMD_OPTIONS=""
CONFIG_IFUPDOWN_UDHCPC_CMD_OPTIONS="-b"
#
# Print Utilities
......
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.
diff --git a/networking/udhcp/dhcpc.c b/networking/udhcp/dhcpc.c
index 6aa6731fb..2c0307413 100644
--- a/networking/udhcp/dhcpc.c
+++ b/networking/udhcp/dhcpc.c
@@ -1504,19 +1504,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;
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment