Bug 11691

Summary: "udhcpc -n -b" still exits after backgrounding on no lease
Product: Busybox Reporter: Andrey <ahippo>
Component: NetworkingAssignee: unassigned
Status: RESOLVED FIXED    
Severity: normal CC: ahippo, busybox-cvs
Priority: P5    
Version: 1.30.x   
Target Milestone: ---   
Hardware: All   
OS: Linux   
URL: https://unix.stackexchange.com/questions/202839/overriding-udchcp-flags-used-by-ifup-in-busybox
Host: Target:
Build:
Attachments: Minimal .config
Proposed fix

Description Andrey 2019-02-22 19:59:52 UTC
Running "udhcpc -n -b" causes udhcpc to go into background and then exit after some timeout unless a lease is obtained.
It's probably arguable what's the proper behavior is,
but I expect "-b" switch to override "-n" switch.

A particular use-case is managing udhcpc from ifupdown.
Currently, ifupdown passes "-n" to udhcpc by default (unless compiled with other options), and there is no way to override this without recompiling busybox.

It looks like, the code actually tries to favor "-b" over "-n", but doesn't clear "-n" flag while clearing "-b" before backgrounding.
Comment 1 Andrey 2019-02-22 20:56:18 UTC
Created attachment 7951 [details]
Minimal .config
Comment 2 Andrey 2019-02-22 21:18:03 UTC
Created attachment 7956 [details]
Proposed fix
Comment 3 Andrey 2019-02-22 21:21:17 UTC
A simple reproducer:
ip link add type veth
ip link set veth0 up
busybox udhcpc -n -i veth0 -b -S
Comment 4 Denys Vlasenko 2019-02-27 07:32:19 UTC
fixed in git:

commit 87e216294af9eec39c0c1d553555f8a98c15db38
Author: Andrey Mazo <ahippo@yandex.com>
Date:   Fri Feb 22 16:46:19 2019 -0500

    udhcpc: don't exit after backgrounding on -n -b