[BusyBox] Lease remembering in udhcpc?

Rainer Weikusat rainer.weikusat at sncag.com
Sun Aug 21 16:17:58 UTC 2005

Josef Wolf <> writes:
> I have installed busybox with udhcpc, and it's working great that far.
> There are just two things I am not entirely happy with:
> 1. When the dhcp server can't be reached, udhcpc disables the interface.
>    I think it would be better to reuse the last ackquired lease as long
>    as it is not expired.  Rfc2131 allows this behavior in section 3.2.3.
> 2. While default.script can be used to store the ackquired lease somewhere,
>    there is no way to read and reuse this information at startup.
> I would like to fix this, but I'm not entirely sure what would be the
> best way.  My first approach would be:
> - Every time a lease is received, write it into a cache file.
> - When the server can't be reached, read in the cache file reuse the
>   stored lease if it is still valid.
> This would fix both cases above.
> Opinions?

I think it would be more logical to have the client only run the DHCP script
with "deconfig" as an argument in main if it is in INIT_SELECTING
state and hasn't sent a packet yet (ie packet_num == 0). That would
take care of the initial deconfig-calls (before entering the loop) and
would then only deconfigure the interface again if the lease has
actually expired.

The second is not so easy, though, because all times in DHCP are
relative to the beginning of a particular negotiation cycle, which
means that the client can neither reliably determine if the lease is still
valid (the host clock could have changed arbitrarily in the meantime)
nor does it know if it is still usable at all (client might be running
on a different subnet).

More information about the busybox mailing list