[Dnsmasq-discuss] Lease search ignoring client IP on DHCP release

Legacy, Allain Allain.Legacy at windriver.com
Tue Sep 13 17:40:46 BST 2016

When a DHCP release message is received that contains only a client h/w address and IP address (i.e., no Client ID provided) is there a reason why dnsmasq is not using the combination of MAC+IP to search the lease DB?   We have noticed that in cases where there are multiple leases against the same MAC address for different subnets that the release will fail with "unknown lease" when the search returns a lease other than the one for the client IP address.

For example, given these contents of the lease file:

1473863856 90:e2:ba:a3:9b:d4 node0-vlan123 71:70:61:71:60:68:62:2d:30:3a:69:6e:66:72:61:90:e2:ba:a3:9b:d4
1473863844 90:e2:ba:a3:9b:d4 node0-vlan456 00:03:00:01:90:e2:ba:a3:9b:d4

If the following DHCP release message is received from an invocation of "dhcp_release" without a CID:

15:07:44.209079 00:00:00:00:00:00 > 00:00:00:00:00:00, ethertype IPv4 (0x0800), length 590: (tos 0x0, ttl 64, id 43166, offset 0, flags [DF], proto UDP (17), length 576) > [bad udp cksum 0x1b98 -> 0xf2bf!] BOOTP/DHCP, Request from 90:e2:ba:a3:9b:d4, length 548, Flags [none] (0x0000)
          Client-Ethernet-Address 90:e2:ba:a3:9b:d4
          Vendor-rfc1048 Extensions
            Magic Cookie 0x63825363
            DHCP-Message Option 53, length 1: Release
            Server-ID Option 54, length 4:

Then dnsmasq produces the following log and does not delete either of the leases.

2016-09-13T15:10:05.000 node1 dnsmasq-dhcp[164963]: info DHCPRELEASE(mgmt0) 90:e2:ba:a3:9b:d4 unknown lease

My suspicion is that the search is returning the lease for the address instead of the address and then this code is rejecting the lease because of a mismatch between lease->addr and mess->ciaddr.

      if (lease && lease->addr.s_addr == mess->ciaddr.s_addr)
       lease_prune(lease, now);
       message = _("unknown lease");

Is this a bug or intentional behavior to align with some subtlety of the DHCP/BOOTP protocol?


Allain Legacy, Software Developer
direct 613.270.2279  fax 613.492.7870 skype allain.legacy


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.thekelleys.org.uk/pipermail/dnsmasq-discuss/attachments/20160913/7138eb08/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: image001.png
Type: image/png
Size: 1807 bytes
Desc: image001.png
URL: <http://lists.thekelleys.org.uk/pipermail/dnsmasq-discuss/attachments/20160913/7138eb08/attachment.png>

More information about the Dnsmasq-discuss mailing list