[Dnsmasq-discuss] Notification when a system gets a lease

richardvoigt at gmail.com richardvoigt at gmail.com
Wed Dec 8 02:51:33 GMT 2010


On Tue, Dec 7, 2010 at 3:51 PM, Simon Kelley <simon at thekelleys.org.uk> wrote:
> richardvoigt at gmail.com wrote:
>> You should get a "renew" notification to the script whenever a client
>> boots (assuming that the client is configured to renew a lease at
>> boot, most are but it isn't strictly necessary if there's still time
>> left on the last lease).
>
> Actually, that's not always true. What you get is an "old" event when
> the lease database changes. Normally, the client renewing the lease
> changes the expiry time and therefore triggers this, but an infinite
> lease renewed is still an infinite lease, so no joy.

Oh that's right.  You can detect renewals by the combination of "old"
with certain environment variables.  When dnsmasq lists all the leases
at startup, it only has the data stored in the leasefile (or external
lease database, if leasefile-ro is used) and so some of the variables
are unavailable.  But when a renewal request comes in, all those
variables are populated.

The man page even says "DNSMASQ_INTERFACE stores the name of the
interface on which the request arrived; this is not set for "old"
actions when dnsmasq restarts."

I use leasefile-ro and a postgre sql database storing the leases, and
definitely do log lease renewals using that mechanism.

>
> You could just make the default lease time very long, so that it's
> infinite for practical purposes, but the expiry time still changes when
> the client reboots.
>
> Simon.
>



More information about the Dnsmasq-discuss mailing list