[PATCH 1/1] udhcpc: don't exit after backgrounding on -n -b
Andrey
ahippo at yandex.com
Tue Feb 26 17:41:58 UTC 2019
26.02.2019, 11:20, "Denys Vlasenko" <vda.linux at googlemail.com>:
> On Fri, Feb 22, 2019 at 10:46 PM <ahippo at yandex.com> wrote:
>> 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.
>
> To clarify: the goal is to deal with this situation:
>
> config IFUPDOWN_UDHCPC_CMD_OPTIONS
> string "ifup udhcpc command line options"
> default "-R -n"
>
> And %udhcpc_opts% only can _add_ options, not remove -n
>
> Thus, with default IFUPDOWN_UDHCPC_CMD_OPTIONS, -n is always passed?
> This is the problem?
Yes, exactly.
An alternative solution is obviously to recompile busybox with IFUPDOWN_UDHCPC_CMD_OPTIONS="-R -b",
but it may not be always feasible (like in my case).
Would changing the defaults for IFUPDOWN_UDHCPC_CMD_OPTIONS to "-R -b" be a reasonable thing to do?
For example, yocto uses "-R -b" [1, 2].
If so, I can quickly cook up the patch.
[1] http://git.yoctoproject.org/cgit/cgit.cgi/poky/tree/meta/recipes-core/busybox/busybox.inc#n131
[2] https://bugzilla.yoctoproject.org/show_bug.cgi?id=6339
Thank you,
Andrey.
More information about the busybox
mailing list