[Dnsmasq-discuss] double DHCP leases
Nikos Mavrogiannopoulos
nmav at gennetsa.com
Thu Aug 28 13:23:25 BST 2008
I've come across to a situation where dnsmasq was giving two IP
addresses to certain (windows) hosts. The problem was that the windows
host was requesting two times for an IP but having a different client
identifier (check the wireshark output). I've fixed this using the
attached patch. In that patch I make lease_find_by_client() to return
the lease of any of the MAC and the ClientID match. The previous
behaviour was that if client IDs are there, it didn't check the MAC
address. What was the reason for that?
regards,
Nikos
-------------- next part --------------
Index: lease.c
===================================================================
--- lease.c (revision 593)
+++ lease.c (working copy)
@@ -295,19 +295,16 @@
{
struct dhcp_lease *lease;
- if (clid)
- for (lease = leases; lease; lease = lease->next)
- if (lease->clid && clid_len == lease->clid_len &&
+ for (lease = leases; lease; lease = lease->next) {
+ if (clid && lease->clid && clid_len == lease->clid_len &&
memcmp(clid, lease->clid, clid_len) == 0)
return lease;
-
- for (lease = leases; lease; lease = lease->next)
- if ((!lease->clid || !clid) &&
- hw_len != 0 &&
- lease->hwaddr_len == hw_len &&
+ else if (hwaddr && lease->hwaddr_len == hw_len &&
lease->hwaddr_type == hw_type &&
memcmp(hwaddr, lease->hwaddr, hw_len) == 0)
- return lease;
+ return lease;
+
+ }
return NULL;
}
-------------- next part --------------
A non-text attachment was scrubbed...
Name: wireshark.out.gz
Type: application/x-gzip
Size: 3964 bytes
Desc: not available
Url : http://lists.thekelleys.org.uk/pipermail/dnsmasq-discuss/attachments/20080828/c2f94374/wireshark.out.bin
More information about the Dnsmasq-discuss
mailing list