dhcpcd-discuss

Re: Re: Selecting a "better" offer from two DHCP servers

Roy Marples

Fri Jun 17 16:51:33 2016

Hi

On 16/06/2016 21:27, Shahid Mahmood wrote:
> Back to this question again ...
> 
> Recap: Two dhcp servers, one sending offer with preferred option, other
> without.
> 
> If within 1 second of sending discover, two leases were received, then
> pick the one with preferred option.
> If 1 second has elapsed and no lease with preferred option seen, then
> just pick the other one without the preferred option.
> 
> (1 sec can be changed to upto 5)
> 
> Here is my idea how to implement this:
> 
> 1. Start dhcpcd with -Q vendor_option -t10
> (Hook scripts dump option and variables in a file, say
> /tmp/dhcp/dhcpcd_data)
> 2. Monitor /tmp/dhcp/ for activity (using inotify)
> 3. *Somehow detect* 2 lease situation, e.g a lease was offered but
> rejected, or timeout has occurred, and if so, restart dhcpcd without -Q
> and -t (settle on non-preferred lease)
> 4. Of course, if a lease with vendor_option was received, accept it and
> continue normal life.
> 
> Q:
> Is this good approach?
> If so, how can I do step 3? ie detect events such as timeout, reject or
> offer received?
> If not, is there a better way to do this? e.g is -T worth considering?

I don't think that's a good approach because you're signallng dhcpcd
from outside about what is good and what is bad.

Right now, dhcpcd internally has a state machine per protocol that is
desinged to handle only one offer. These should be refactored to handle
N offers, with a mechanisn to handle preference.

Another interesting question is this: do we want to only have one
primary lease or take the IPv6 autoconf approach and merge active offers?

Roy

Follow-Ups:
Re: Re: Selecting a "better" offer from two DHCP serversJuliusz Chroboczek
Re: Re: Selecting a "better" offer from two DHCP serversShahid Mahmood
References:
Re: Selecting a "better" offer from two DHCP serversShahid Mahmood
Archive administrator: postmaster@marples.name