Discussion:
[Dnsmasq-discuss] Query: DNSMASQ_LEASE_EXPIRES
Nehal J Wani
2016-09-22 09:51:31 UTC
Permalink
Hi!

According to the man page of dnsmasq, DNSMASQ_LEASE_EXPIRES stores the
time of lease expiry and DNSMASQ_TIME_REMAINING stores the number of
seconds until expiry and these are passed to the script specified to
the option --dhcp-script.

Consider the scenario when the configuration has specified 'infinite'
as the value of <lease time> for a particular dhcp-range. In this
case, the value of DNSMASQ_LEASE_EXPIRES is always 0 and
DNSMASQ_TIME_REMAINING is not even present. Is this an expected
behaviour?

Another query: the value of lease-time is stored in an unsigned int
while parsing the options and it is different in struct script_data.
Is there a specific reason behind choosing different datatypes?

Cheers!
Nehal J Wani
Simon Kelley
2016-12-21 23:28:04 UTC
Permalink
On Thu, Sep 22, 2016 at 3:21 PM, Nehal J Wani
Post by Nehal J Wani
Hi!
According to the man page of dnsmasq, DNSMASQ_LEASE_EXPIRES
stores the time of lease expiry and DNSMASQ_TIME_REMAINING stores
the number of seconds until expiry and these are passed to the
script specified to the option --dhcp-script.
Consider the scenario when the configuration has specified
'infinite' as the value of <lease time> for a particular
dhcp-range. In this case, the value of DNSMASQ_LEASE_EXPIRES is
always 0 and DNSMASQ_TIME_REMAINING is not even present. Is this
an expected behaviour?
Yes. 0 is used as a special value which represents "infinite". There's
no sensible value for time_remaining in this case, so that behaviour
seems reasonable too. This doesn;t appear to be documented well in the
man page, patch gratefully accepted :)
Post by Nehal J Wani
Another query: the value of lease-time is stored in an unsigned
int while parsing the options and it is different in struct
script_data. Is there a specific reason behind choosing different
datatypes?
I don't think so. leases longer than 2^31 seconds are pretty unlikely,
so either will do to represent them.

Cheers,

Simon.
Ping! :-)
Loading...