[Dnsmasq-discuss] old event to dhcp-script on lease expiry
Simon Kelley
simon at thekelleys.org.uk
Fri Jun 27 19:28:00 UTC 2014
On 27/06/14 19:40, Nehal J Wani wrote:
>> An "old" event is not generated when a lease is _renewed_ (ie when the
>> only thing that changes is the expiration time) unless the option
>> leasefile-ro is set. Note that setting leasefile-ro has a bunch of other
>> effects too.
>>
>> When a lease _expires_ (ie the end time of the lease is reached without
>> it being renewed) then a a "del" event is generated.
>
> So, if I understand correctly, there is no way to maintain the leases
> file database *and* have my own script catch all events? Why does
> dnsmasq put such restrictions?
That's correct. The reason for the behaviour is mainly historical. At
first, the script received just the events needed to log the existance
of leases. Later, the ability to use the script to maintain the lease
database was added, and for that, changes to the expiration time had to
be noted. THe old behaviour (when leasefile-ro is not set) stayed for
backwards compatibility.
> It would be cool to have both
> concurrently.
As a pragmatic approach, the patch to get the behaviour you want is very
small.
>
> Another question, not very much related to dnsmasq, is that when a
> machine receives a lease for a particular period, when should it query
> the DHCP again for a new lease? Is it bound to do so, by some RFC? Or
> is a matter of choice by the developer?
The server can include the information in the lease. There are three
options which it can include. The length of the lease is mandatory, and
there are two options called T1 and T2. T1 is the time after which the
client should renew the lease by doing unicast to the server which gave
it the lease. T2 is the time after which the client should try
broadcasting if it fails to renew the lease, to give the other half of a
failover pair a chance to reply. T1 defaults to half of the lease time,
and T2 to 7/8ths of the leasetime. In practise it's very rare to use
other values for these. Dnsmasq always send T1 as half lease time and T2
as 7/8th the lease time. It doesn't allow them to be configured
differently. The RFC the details this is RFC 2131.
Cheers,
Simon.
>
More information about the Dnsmasq-discuss
mailing list