Discussion:
[Dnsmasq-discuss] dnsmasq leases file format specification
Sergey Nechaev
2016-06-08 19:56:59 UTC
Permalink
Hello, Simon

Could you (or anyone) please provide description of leases file format?
I’ve searched through this mail list, but failed to find full description.

We are preparing improvement to Openstack Neutron network subsystem, which enables releasing
of unneeded DHCPv6 leases and description of leases file format is necessary for code review.

The review and discussion is here: http://review.openstack.org/#/c/301747/ <http://review.openstack.org/#/c/301747/>

Many thanks in advance
--
With best regards,
Sergey Nechaev
Nicolas Cavallari
2016-06-09 17:42:00 UTC
Permalink
Post by Sergey Nechaev
Hello, Simon
Could you (or anyone) please provide description of leases file format?
I’ve searched through this mail list, but failed to find full description.
The code that writes it is in lease_update_file() in src/lease.c.
The code that reads it is in lease_init().

A DHCPv4 lease entry consists of these fields separated by spaces:

- The expiration time (seconds since unix epoch) or duration
(if dnsmasq is compiled with HAVE_BROKEN_RTC) of the lease.
0 means infinite.

- The link address, in format XX-YY:YY:YY[...], where XX is the ARP
hardware type. "XX-" may be omitted for Ethernet.

- The IPv4 address

- The hostname (sent by the client or assigned by dnsmasq)
or '*' for none.

- The client identifier (colon-separated hex bytes)
or '*' for none.

A DHCPv6 lease entry has these fields:

- The expiration time or duration

- The IAID as a Big Endian decimal number, prefixed by T for
IA_TAs (temporary addresses).

- The IPv6 address

- The hostname or '*'

- The client DUID (colon-separated hex bytes) or '*' if unknown.[1]

For DHCPv6, there must also be exactly one special entry indicating
the DUID of the server. This line contains two fields:

- The string "duid".

- The DUID of the server.


[1] This field seems to be written but is never read back. A bug maybe ?
Post by Sergey Nechaev
We are preparing improvement to Openstack Neutron network subsystem,
which enables releasing
of unneeded DHCPv6 leases and description of leases file format is
necessary for code review.
Just pointing out that since dnsmasq 2.73, if you use dbus, you can
dynamically remove leases with just a D-Bus call:

dbus-send --system --print-reply \
--dest=uk.org.thekelleys.dnsmasq \
/uk/org/thekelleys/dnsmasq \
uk.org.thekelleys.dnsmasq.DeleteDhcpLease \
string:"$IPV4_OR_IPV6_ADDRESS"

Loading...