Adaptive lease time patch

Christof Chen christof at chen.de
Tue Sep 13 08:51:20 UTC 2005


I am rather optimistic that the current patch already addresses most of your 
concerns.

> lease->ends might be less than cur_time - particularly when a lease is
> freshly allocated, which will certainly wind up in a value greater than
> min lease time.

Can you give me an example?  TIME/time_t  is signed  (long int, at least on 
the GNU C Lib), so lease->ends - cur_time should be negative, if lease->ends 
is less that cur_time. Which will expectedly  fail the condition in
 if (lease -> ends - cur_time > min_lease_time)
                               min_lease_time = lease -> ends - cur_time;

>
> It should probably also be bounded by the lease time that had been
> determined upon entering this conditional - the default or the
> client supplied.  Although the lease may be extended beyond
> these points, the default might have changed, or the client might
> know better about how long it plans to be up (unlikely as that is).
>
> So, the result of this statement shouldn't increase the lease time.
I do not see how this would be possible - the

              if (lease_time > min_lease_time) {
                       lease_time = min_lease_time; 
	      }

part can only decrease the lease time - down to min_lease_time.

> If the result is lowered underneath min lease time, don't sweat it...
> the very next conditional after your new code will test and fix this.
It wouldn't, because i changed the value of min_lease_time already. 
It boils down to this: As long as (lease -> ends - cur_time > min_lease_time) 
does not overflow/wrap around (which it shouldn't), then  
			   if (lease -> ends - cur_time > min_lease_time) 
				min_lease_time = lease -> ends - cur_time;
only increases min_lease_time - up to the remaining of the lease.

> I'd prefer to see the configuration option be a percentage, or a
> fixed limit (like "10 leases").  A lot of pools normally run at
> 80-90% utilized.
I'd prefer a percentage too, but looking at the 0.8125 lease-time calculation, 
the current codebase avoids arbitrary divisions.
Do you think both a percentage and a fixed limit would be useful?

-- 
Christof Chen


More information about the dhcp-hackers mailing list