aboutsummaryrefslogtreecommitdiffstats
path: root/main/busybox/udhcpc.patch
diff options
context:
space:
mode:
authorNatanael Copa <ncopa@alpinelinux.org>2017-05-23 18:43:11 +0200
committerNatanael Copa <ncopa@alpinelinux.org>2017-05-23 18:43:11 +0200
commit7569d2dc1122e5b01cfb5b2ade1431dc01fcfae6 (patch)
tree6845e89f8a69e12ff6e28ddc74bdb8af12849712 /main/busybox/udhcpc.patch
parent158728fbc6d3813059c12bcbeab64f681c38df2f (diff)
downloadaports-7569d2dc1122e5b01cfb5b2ade1431dc01fcfae6.tar.gz
aports-7569d2dc1122e5b01cfb5b2ade1431dc01fcfae6.tar.bz2
aports-7569d2dc1122e5b01cfb5b2ade1431dc01fcfae6.tar.xz
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.
Diffstat (limited to 'main/busybox/udhcpc.patch')
-rw-r--r--main/busybox/udhcpc.patch36
1 files changed, 36 insertions, 0 deletions
diff --git a/main/busybox/udhcpc.patch b/main/busybox/udhcpc.patch
new file mode 100644
index 0000000000..baf7c6138e
--- /dev/null
+++ b/main/busybox/udhcpc.patch
@@ -0,0 +1,36 @@
+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;