Best way to use dhcpc / avahi without delaying other init scripts ?

Mark Jackson mpfj-list at newflow.co.uk
Tue Apr 30 18:47:52 UTC 2013


On 30/04/13 19:28, Avery Pennarun wrote:
> On Tue, Apr 30, 2013 at 2:24 PM, Mark Jackson <mpfj-list at newflow.co.uk> wrote:
>> Ideally I'd like udhcpc to start up, try to get a lease and, if the
>> lease request fails, use avahi to get a local ip address.
>>
>> I have this working, but the dhcp request can taken some time (or even
>> fail if no dhcp server is present), and I am seeing delays of several
>> seconds before my other init scripts run.  I have dual ethernet ports
>> leading to about a 10seconf delay if no dhcp server is present.
>>
>> To prevent other init scripts from being delayed, udhcpc should
>> instantly go into background mode (see [1]).
> 
> Maybe you just want to background the whole chunk of logic using an sh block?
> 
> (
>    dhcpc -b ...
>    ...if it failed to get an address from dhcp, do something else...
> ) &

Possibly, but udhcpc isn't called directly ... it's called from ifup /
ifdown.

I guess I could try "ifup -a &" in the network init script.

Cheers
Mark J.


More information about the busybox mailing list