dhcpd 3.1.2b1 failover with reserved flags

Foggi, Nicola NFOGGI at depaul.edu
Tue Nov 17 05:35:56 UTC 2009

>> --- failover.c.orig     2008-09-24 11:20:26.000000000 -0500
>> +++ failover.c  2009-03-26 16:52:46.000000000 -0500
>> @@ -6068,6 +6068,18 @@
>>                         if (peer -> i_am == primary)
>>                                 return 1;
>> +                       if (lease->flags & RESERVED_LEASE)
>> +                               return 1;
>> +
>> +                        /* If lease is RESERVED allow secondary to allocate
>> +                         * lease
>> +                         */
>> +
>> +                        if ((peer -> i_am == secondary) &&
>> +                             (lease->flags & RESERVED_LEASE)) {
>> +                                return 1;
>> +                        }

> These two conditionals you've added overlap.  Unless there is a bug
> elsewhere, neither should be necessary; reserved and bootp leases are
> set to the local system's free state when they are expired.

I wish i could find my notes on the exact troubleshooting, but if i remember, what i was seeing there were some conditions where the server was ignoring the reserved flag.  I think the problem was around if a client hadn't been online for awhile or had RELEASED the lease so it was a binding state free, the client would not always receive it's ip.  At this time it was pretty predictable using an HP jet direct card set to dhcp, then switching it to static which would generate a DHCPRELEASE and then back to dhcp to generate the request again.  When I was running the debugging if i remember correctly the first "if" statement fixed it on the primary server and the second "if" statement fixed it on the secondary server.  The reserved lease had to be in a binding state of free to encounter the problem i think.

> So this code should never be exercised.

I think it was around line 3134 and 3201 of dhcp.c which was is under find_lease under the failover portion.  During debugging i would get  a "not mine to allocate" message for hosts attempting a DHCPDISCOVER, and then would be issued an ip other than there reserved lease.   Those were calling lease_mine_to_reallocate which i then found in failover.c which is where i made the fix.  If I was reading it correctly, if the lease was not active, and failed the "lease_mine_to_reallocate" it would not "find" that lease and move to the next, or create a new.  Is there something I missed in the find_lease part of dhcp.c that could of fixed the same thing?

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

More information about the dhcp-users mailing list