[Dnsmasq-discuss] Reg: Info related to leases file

Simon Kelley simon at thekelleys.org.uk
Tue Sep 24 16:15:47 BST 2013


On 24/09/13 15:31, Vladislav Grishenko wrote:
> Hi Simon,
>
>> However, if you're interested in the MAC addresses of clients, the very
> latest
>> dnsmasq code can determine that in most cases. The MAC address is not
>> stored in the leases file, but it can be used to key configurations to
> particular
>> MAC addresses, and it's made available to the DHCP lease external script,
> so
>> an external application can use it.
>
> Storing MACs for DHCPv6 clients is just exactly I'm looking for.
> In my scenario, lease file is used to obtain current list of DHCP4/6 clients
> as some status information, the latter usage of this info is:
> * DHCP4/6 reservation, it's MAC-based, because client DHCP6 DUID-LLT is
> dynamic by the nature, thanks for implementing this approach
> * client blocking, it's MAC bases too
> So, storing lease info with MAC for DHCPv6 clients (if available, that is
> highly likely for direct-connected clients) is the simplest way for my case
> without usage any other leasudump-like api
>
> Best Regards, Vladislav Grishenko
>
>
>

I realise that adding to MAC to the leasefile for DHCPv6 clients would 
make this possible, but I'm reluctant to change the leasefile format.


One way to do this now is to script (as script or with Lua) something 
which maintains an extended lease database. It's actually possible to do 
without the leasefile at all (which saves on writes to flash 
filesystems) and have the script maintain the database in any database 
engine you like.

Another possibility for a future enhancement is to add a method to the 
DBus interface to read the lease database. There's a lot of information 
that can be known about a lease/client that will never go into the 
leases file, but could be accessible this way: look at all the 
environment variables set when the DHCP script is run.

Cheers,

Simon.



More information about the Dnsmasq-discuss mailing list