udhcpd server lease expiration issue

Denys Vlasenko vda.linux at googlemail.com
Sat Jan 3 15:13:21 UTC 2009


On Friday 02 January 2009 05:29, Mahavir Jain wrote:
> Hi,
> 
> Thanks for making sure that i am not wrong.(Reply)
> 
> This is my udhcpd.conf file,
> 
> start 192.168.1.100
> end 192.168.1.200
> interface br0
> opt      lease  86400
> opt     router  192.168.1.1
> opt     subnet  255.255.255.0
> opt     dns     192.168.1.1
> opt     domain     localdomain
> max_leases     101
> lease_file     /var/lib/udhcpd.leases

auto_time is not set, thus udhcpd uses default value of 7200 seconds.

> In busybox 1.5.0 , i was able to fix it as
> 
>  printf(" %-15s ", inet_ntoa(addr));
>  expires = ntohl(lease.expires);
>  +  expires -= time(0);

What do you plan to achieve by doing it?

>  if (mode == REMAINING) {
>                         if (!expires)
>                                 printf("expired\n");
> 
> Adding same thing to get amount of time remaining in busybox 1.12.0
> gives me some decrementing count in
> 
> $ dumpleases -f /var/lib/udhcpd.lease
> 
> as 4015678 & then it keeps in decrementing . I think its due to format
> of unix time , i am not able to convert it to actual seconds.

Because the value is bogus now. It does not mean anything.

> Any help regarding this....? As i want to upgrade to latest busybox.

Set auto_time to 30 seconds in config file, and do not do
that "expires -= time(0)", it isn't right.
--
vda


More information about the busybox mailing list