DHCP leasetime
Ravi Paluri
rpaluri at qti.qualcomm.com
Tue Feb 28 09:06:35 PST 2023
Thanks Eric for the reply.
What is the letter that we need to mention if leasetime is in seconds? Is it 's'?
Also, can you help clarify if we don’t specify the letter and only give number to leasetime (as below), how does the dnsmasq interpret?
dhcp. at dhcp[0].leasetime='12'
Thanks,
Ravi
-----Original Message-----
From: Eric <evil.function at proton.me>
Sent: Monday, February 27, 2023 9:53 PM
To: Ravi Paluri (QUIC) <quic_rpaluri at quicinc.com>
Cc: openwrt-devel at lists.openwrt.org
Subject: Re: DHCP leasetime
WARNING: This email originated from outside of Qualcomm. Please be wary of any links or attachments, and do not enable macros.
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