Discussion:
[Dnsmasq-discuss] Dsmasq tags, options, matches understanding (Re: Dnsmasq dhcp lease file)
Simon Kelley
2015-09-22 14:52:04 UTC
Permalink
Hi Simon,
I would like to understand how tags (setting tags, matching tags
for dhcp-range, dhcp-option, dhcp-match) work. Is there any
documentation I can refer? Please let me know.
Or we have all the info here -
http://www.thekelleys.org.uk/dnsmasq/docs/dnsmasq-man.html
That pretty much covers it.
Also, what are the guidelines that dnsmasq follow in assigning the
IP addresses if there are multiple configurations that matches a
DHCP request (for e.g. both dhcp range and dhcp-host configurations
match for the incoming DHCP request)? Please let me know.
In that case it's undefined. Any dhcp-range which matches the tags or
any dhcp-range which is not qualified with tags. The only condition
that it defined is that a dhcp-range which has tags will be used
before dhcp-range without tags. The tagless dhcp-range could still be
used if, for example, a tagged dhcp-range was full up, with all the
avail able addresses in use.


Cheers,

Simon.
Thanks, Siva
On Fri, Aug 21, 2015 at 12:57 PM, Sivabalakrishnan M <
Thanks much Simon. Yes, this helps. Got it.
Thanks, Siva
On Fri, Aug 21, 2015 at 12:50 PM, Simon Kelley
The expiry time is passed to the script in an enviromment variable
called DNSMASQ_LEASE_EXPIRES. There are a hold heap of these
variables, documented in the man page.
As an aside, the reason it's done like this is because the first
version of the script was provided with only the information in
the argv. When extra information was added, it was done via the
environment to maintain backwards compatiblity.
Cheers,
Simon.
Hi,
We are using dnsmasq for dhcp and tftp server in our
project. And for leases file, our requirement is to
maintain the leases information in our database without
using dnsmasq.leases file.
For this, we plan to use "--dhcp-script=" option to provide
our script path that would be invoked by dnsmasq for
updating leases (add, del, old arguments). Also, we will be
using "--leasefile-ro" option so that dnsmasq doesn't use
dnsmasq.leases file at all and during reboot or init time,
dnsmasq will invoke our script with "init" argument so that
our script will retrieve the information from our config
database and print it to stdout.
While going through dnsmasq source code, it looks like for
updating the leases (add, del, old), dnsmasq doesn't seem
to provide the lease time expiry in epoch format (MAC
address, IP address, host name, client id are given). So,
we are not sure how we can maintain leases on our own.
Could you please clarify on this?
The following is the code in helper.c file (function -
create_helper(), line number is 563) that am referring
(version 2.75). As we see here, we are not passing lease
expiry time while invoking the script. Please help on this
or let me know if am missing anything on this.
if (err == 0) { execl(daemon->lease_change_command, p ? p+1
: daemon->lease_change_command, action_str, is6 ?
daemon->packet : daemon->dhcp_buff, daemon->addrbuff,
hostname, (char*)NULL); err = errno; }
Thanks a lot for the help.
Thanks, Siva
Loading...