[Dnsmasq-discuss] dumping current dhcp leases without always updating the leasefile curing normal ?

Simon Kelley simon at thekelleys.org.uk
Tue Oct 15 16:55:30 BST 2013


On 15/10/13 16:32, Rick Jones wrote:
>>>> More context about what youre trying to achieve would help.
>>>
>>> What I would like to be able to do is "know" (make an informed guess)
>>> which of the clients which could have a lease probably have a lease (or
>>> probably do not have a lease), but in an environment where I might have
>>> either rather busy dnsmasq processes, or a large number of individually
>>> not very busy dnsmasq processes and want to minimize the storage load.
>>> But I don't need to know all the time, just occasionally and not
>>> necessarily on a schedule and not necessarily all the dnsmasq processes.
>>> So, I figured some sort of "dump your current leases" feature would
>>> satisfy that.
>>>
>>> I cannot really rely on the clients being willing to respond to the
>>> likes of ping, they may only respond to things they've initiated
>>> themselves. I also do not have other access to the clients (eg their
>>> console). So, all I can think of presently is trying to ask the dnsmasq
>>> process(es) what it believes its active leases happen to be.
>>>
>>> thanks,
>>>
>>> rick
>>> BTW, sorry about botching the last part of the subject there.
>>>
>>
>> You could achieve the two aims "minimise storage load" and "know about
>> dnsmasq leases" by implementing the lease database in some sort of
>> lightweight database. Dnsmasq is designed so it can be without a lease
>> file completely. At startup you prime the in-memory copy of the lease
>> database via a DHCP-script "init" call, and then whilst dnsmasq is
>> running is makes calls to the DHCP script as the data changes which can
>> be used to update the database.
>
> Is there more about the "reduce the writes to be nice to flash" changes
> written-up somewhere?

There's a description of the HAVE_BROKEN_RTC mode, which is what we're 
talking about, in src/config.h and a description moving the lease 
database out of the lease-file (in this case into WRT NVRAM)  in 
contrib/wrt/README. That directory has example scripts too, but they 
pre-date DHCPv6 and need work.


Cheers,

Simon.

>
> thanks for all the suggestions,
>
> rick jones
>
>




More information about the Dnsmasq-discuss mailing list