udhcpd server lease expiration issue

Denys Vlasenko vda.linux at googlemail.com
Thu Jan 1 17:53:35 UTC 2009


On Thursday 01 January 2009 08:57, Mahavir Jain wrote:
> Hi,
> 
> I was working with busybox 1.12.0 . I found that dhcp server never
> shows amount time remaining in lease to expire with,
> 
> $ dumpleases -f /var/lib/udhcpd.lease
> 
> It just shows amount of lease allocated.

You need to set auto_time in udhcpd config file to something
smaller than default 7200 seconds (2 hours) in order to make udhcpd
write out lease file more often. Or "killall -USR1 udhcpd"
to force it to do that.

Unfortunately current leasefile format is stupid, it does not
allow to figure out how old (stale) is it, and lease times
are encoded as offsets from "current time" (which is not in the file!)
Thus, "watch dumpleases -f /var/lib/udhcpd.lease" will never
show you how lease times tick down to zero,
they will be unchanged until udhcpd rewrites the file.

> I also tried -r option but it 
> didn't work either.

-r option is the default, it won't change anything. -a option
is supposed to show "absolute" expiration time, but is broken.
Add these lines in networking/udhcp/dumpleases.c:

               } else /* -a */
+{
+                      expires += time(NULL);
                       fputs(ctime(&expires), stdout);
+}

to fix it.

> Please let me know whether it's issue or something 
> wrong with my settings....?   Because we should know when lease is
> expired for specific client...

You need to report your udhcpd problems so that I can fix them.
You are doing that just right. Thanks.
--
vda


More information about the busybox mailing list