dhcpd lease problems?

Alan DeKok adekok at infoblox.com
Tue Jun 6 18:11:22 UTC 2006

David W. Hankins wrote:

> 'range' statements are allocated (eg 'malloc', but not) in one chunk.
> That means:
> 	range;
> Is one contiguous allocation of memory.
> To piecemeal out leases within that range would require we somehow
> keep meta-state..."do not free() this lease"

   See dhcp_lease_free().  No leases are free'd.  Ever.  They're put 
onto a free list.  So it doesn't matter how they're allocated: singly, 
or in a contiguous block.

   The only issue is that if a host object over-rides a dynamic lease, 
then the dynamic lease MUST be removed from lease_ip_addr_hash() before 
expire_all_pools() is called.

>...and would require we
> check for host fixed-addresses upon "instantiating" (initializing)
> each individual lease after the entire configuration (and dhcpd.leases,
> which may include host statements as well) was loaded.

   Yes.  "if trying to create dynamic lease AND host exists, discard 
dynamic lease.  If trying to create host AND dynamic lease exists, 
discard dynamic lease.  If reading a lease from the leases file AND a 
host exists, discard the lease".

> There's more...too much more...
> It simply isn't workable.

   What am I missing, then?

> Host statements and dynamic leases are two separate systems.  They
> always will be.

   Sure, but removing overlaps isn't the same as tying the two systems 
together.  You could remove overlaps via a Perl script that reads 
dhcpd.conf, figures out where the hosts intersect with a range, and then 
writes a new dhcpd.conf, where the ranges were split around the hosts.

   And if it can be done that way, it shoul dbe possible (somehow) to do 
the same thing at run-time, when dhcpd is bootstrapping itself.

   Alan DeKok.

More information about the dhcp-users mailing list