DHCP leasetime
Eric
evil.function at proton.me
Mon Feb 27 08:22:35 PST 2023
On Monday, February 27th, 2023 at 06:32, Ravi Paluri (QUIC) <quic_rpaluri at quicinc.com> wrote:
> Hi all,
> We see that the DHCP leasetime can be configured either in days or hours or minutes etc. as below:
> dhcp. at dhcp[0].leasetime='12h'
>
> Query:
> If we don't specify the letter i.e., d, h, or m and just specify the number (as below), then how does dnsmasq interpret the leasetime?
> dhcp. at dhcp[0].leasetime='12'
>
> If possible, can you point me to the source code for this?
>
> Thanks,
> Ravi
The dnsmasq man page states that:
The lease time is in seconds, or minutes (eg 45m) or hours (eg 1h) or "infinite".
I would assume that odhcpd follows the same convention in order to avoid playing with conversions.
The source for lease holding for IPv4 appears to be in these two files, not sure where odhcpd handles IPv6 lease times...
https://thekelleys.org.uk/gitweb/?p=dnsmasq.git;a=blob;f=src/lease.c;h=8a7b975640bb2c432636370868f1c452e4f55ead;hb=HEAD
https://github.com/openwrt/odhcpd/blob/master/src/dhcpv4.c
More information about the openwrt-devel
mailing list