Ignoring UIDs in dhcpd

Brian De Wolf bldewolf at csupomona.edu
Fri Jul 15 02:11:01 UTC 2011


We've got a lab with dualbooting that's eating up twice as many leases
as necessary and I'd like to have both OS instances use the same
lease (the same old story, really).  We've actually had this issue for a
while but were never in a position to upgrade dhcpd to solve it (old
servers, etc).

In fact, I actually thought this was resolved with a new option, but
it appears "allow/deny duplicates" doesn't apply to every DHCP
transaction.  The man page indicates it actually only works when a host
match based on hardware address occurs, but even in a test environment
I couldn't produce any different behavior (and usually host
declarations specify a fixed-address, making it impossible for that
host to have duplicate leases).

I also couldn't find where the "duplicates" option was added in the
changelog.  I'm curious now what problem it was intended to solve. Can
anyone enlighten me?

Anyway, since it didn't appear to be an existing option, I started
searching for patches or discussion about it.  I couldn't find any
patches more recent than ~2007, so I'm not sure if people gave up,
solved it some other way, or just fell off the map.  Has anyone come up
with a working solution for this?

The length of the existing patches from 2006/2007 made me wonder if I
should bother trying to hack something in like this but then I stumbled
on a dirty but simple idea:  Add an option to determine whether the
DHCP server even reads the UID from the packets.  A patch that
maintains the UID information but doesn't use it has to touch a lot of
different places, but doing it this way (since dhcpd already handles
dhcp packets without UIDs just fine) makes it tiny.  There's a few
problems:  you lose the UID information, old lease files with UIDs in
them won't match new clients (sounds like a problem for grep to
solve).  But it sure seems like it will keep my clients from getting
multiple leases...

So here's a silly proof of concept patch that makes the change permanent
(adding config options is a separate daunting task in itself).  Any
comments/ideas?  Would this sort of option/change cause any
catastrophic behavior?


diff -ur dhcp-4.2.1-P1/server/dhcp.c dhcp-4.2.1-P1-new/server/dhcp.c
--- dhcp-4.2.1-P1/server/dhcp.c	2010-09-08 23:52:37.000000000 -0700
+++ dhcp-4.2.1-P1-new/server/dhcp.c	2011-07-14 17:22:20.000000000 -0700
@@ -2279,7 +2279,7 @@
 	/* Record the uid, if given... */
 	oc = lookup_option (&dhcp_universe, packet -> options,
-	if (oc &&
+	if (0 && oc &&
 	    evaluate_option_cache (&d1, packet, lease,
 				   (struct client_state *)0,
 				   packet -> options, state -> options,

More information about the dhcp-users mailing list