pre-creating reserved leases

Foggi, Nicola NFOGGI at depaul.edu
Fri Feb 27 18:05:46 UTC 2009


Found the 'find_lease' function, gonna go through it step by step, but something definitely wacky going on, the only change made to the server between Feb 19 and Feb 20 was a reload due to a "peer holds all leases" error on an unrelated scope:

== FEB 19 ==
Feb 19 11:27:14 dhcp-sac-1s dhcpd: DHCPDISCOVER from 00:1e:0b:09:8e:bd (NPI098EBD) via 10.0.232.1
Feb 19 11:27:15 dhcp-sac-1s dhcpd: DHCPOFFER on 10.0.232.79 to 00:1e:0b:09:8e:bd (NPI098EBD) via 10.0.232.1
Feb 19 11:27:20 dhcp-sac-1s dhcpd: DHCPREQUEST for 10.0.232.79 (10.0.141.242) from 00:1e:0b:09:8e:bd (NPI098EBD) via 10.0.232.1
Feb 19 11:27:20 dhcp-sac-1s dhcpd: DHCPACK on 10.0.232.79 to 00:1e:0b:09:8e:bd (NPI098EBD) via 10.0.232.1

(this is a copy of the lease as seen today not back on the 19th, but nothing on the lease changed with the reserved flag during the time)
lease 10.0.232.79 {
  starts 6 2009/02/21 02:33:55;
  ends 6 2009/02/21 04:12:31;
  tstp 6 2009/02/21 04:12:31;
  tsfp 6 2009/02/21 04:12:31;
  atsfp 6 2009/02/21 04:12:31;
  cltt 4 2009/02/19 22:34:12;
  binding state free;
  reserved;
  hardware ethernet 00:1e:0b:09:8e:bd;
  set remote-handle = %81;
}

== FEB 20 ==
Feb 20 22:12:53 dhcp-sac-1s dhcpd: DHCPDISCOVER from 00:1e:0b:09:8e:bd (NPI098EBD) via 10.0.232.1
Feb 20 22:12:54 dhcp-sac-1s dhcpd: DHCPOFFER on 10.0.232.114 to 00:1e:0b:09:8e:bd (NPI098EBD) via 10.0.232.1
Feb 20 22:12:59 dhcp-sac-1s dhcpd: DHCPREQUEST for 10.0.232.114 (10.0.141.242) from 00:1e:0b:09:8e:bd (NPI098EBD) via 10.0.232.1
Feb 20 22:12:59 dhcp-sac-1s dhcpd: DHCPACK on 10.0.232.114 to 00:1e:0b:09:8e:bd (NPI098EBD) via 10.0.232.1

(not this lease is from today after I had the printer release the ip)
lease 10.0.232.114 {
  starts 5 2009/02/27 16:02:44;
  ends 5 2009/02/27 16:11:59;
  tstp 5 2009/02/27 16:11:59;
  tsfp 5 2009/02/27 16:11:59;
  atsfp 5 2009/02/27 16:11:59;
  cltt 5 2009/02/27 16:02:44;
  binding state free;
  hardware ethernet 00:1e:0b:09:8e:bd;
}



-----Original Message-----
From: dhcp-users-bounces at lists.isc.org on behalf of David W. Hankins
Sent: Fri 2/27/2009 11:56 AM
To: Users of ISC DHCP
Subject: Re: pre-creating reserved leases
 
On Fri, Feb 27, 2009 at 11:51:03AM -0600, Foggi, Nicola wrote:
> Started looking through the source code, i can't seem to find anyplace where it looks in the reserved pool during a DHCPDISCOVER, at this point are the reserved leases stored in a separate pool?  (Still digging deeper into the code, but getting way past what I can dive into, so have to bring in some backup to dig deeper).

Prior to allocating a "fresh" address, the server tries to find the
'best' existing lease for the client using the client id or hardware
address fields.  I think the sorting algorithm prefers reserved
leases, followed by active leases, followed by the most recently
active lease.  I think the function is literally called 'find_lease'.

Reserved leases are only found in that manner - they are never found
as "brand new allocations to clients for the first time," so the
queue of reserved leases linked list never needs to be inspected
like the free and backup queues are.

-- 
David W. Hankins	"If you don't do it right the first time,
Software Engineer		     you'll just have to do it again."
Internet Systems Consortium, Inc.		-- Jack T. Hankins

-------------- next part --------------
A non-text attachment was scrubbed...
Name: winmail.dat
Type: application/ms-tnef
Size: 4209 bytes
Desc: not available
URL: <https://lists.isc.org/pipermail/dhcp-users/attachments/20090227/ab5e801d/attachment.bin>


More information about the dhcp-users mailing list