dhcpcd-discuss

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

Shahid Mahmood

Fri Jun 17 17:12:15 2016

On Fri, Jun 17, 2016 at 12:51 PM, Roy Marples <roy@xxxxxxxxxxxx> wrote:

> 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.
>
>
Correct, because dhcpcd does not know how to decide with lease to select.


> 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.
>
> We need only one offer per protocol. Just need to prefer the one with
site_specif option.


> Another interesting question is this: do we want to only have one
> primary lease or take the IPv6 autoconf approach and merge active offers?
>
> Just one lease for now. Merged offer option will also do the job, if/when
it is available :)

> Roy
>
>

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