[Dnsmasq-discuss] [PATCH] DHCPv6 - List or Range reservation for single host

Simon Kelley simon at thekelleys.org.uk
Wed Feb 5 12:10:50 GMT 2020

On 04/02/2020 14:24, Harald Jensås wrote:
> On Tue, 2020-02-04 at 00:06 +0000, Simon Kelley wrote:
>> I went though this carefully, and decided that replacing the address
>> in
>> the dhcp-host with the next free one, but otherwise treating things
>> the
>> same might not work well. For instance, there are places where the
>> question is asked "is this address reserved in any dhcp-host?" and
>> clearly that needs to be modified to answer "yes" to any of the
>> addresses when there is more than one.
> I thought this was only the case for IPv4? I.e I did'nt see that check
> for IPv6 and tought it deliberately allowed having the same IP address
> in different host-entries? (Fir laptop with wired/wireless interface
> get's the same ip and such use cases?) Since it's checking for an
> existing lease, it does'nt lease the same address to both hosts
> simultaneously.

> I can with this patch put the following configuration, and dnsmasq
> starts and serves addresses to the two different hosts from the same
> address set.
> dhcp-host=52:54:00:bc:c3:fd,[fd12:3456:789a:1::aa04/126],host2
> dhcp-host=52:54:00:3f:5c:c0,[fd12:3456:789a:1::aa04/126],host1
> With the git master; as well as older version 2.76 (the one in CentOS);
> I also tested this configuration where two hosts share the same IP:
> dhcp-host=52:54:00:bc:c3:fd,[fd12:3456:789a:1::aa04],host2
> dhcp-host=52:54:00:3f:5c:c0,[fd12:3456:789a:1::aa04],host1
> The configuration loads without error, and the first host to capture
> the reservation gets the lease. The second one get "no addresses
> available".
> Because of the above existing behaviour, I came to the conclusion that
> implementing any check to verify each address in the arbitrary address
> list wasn't necessary. I may have missed something?

There are a couple of cases, which are covered by calls to
config_implies() in the patch.

1) A host asks for an address which is static-only, either because the
network is declared for static addresses, or the address is outside the
range declared for dynamicic allocation. The semantics change to
allowing the address in --dhcp-host to any of the addresses in --dhcp-host.

2) Something like


is valid, and has to override the default lease length for the whole set
of addresses now.

>> I ended with a different implementation of the same thing, with the
>> exception that I only supported a prefix range of addresses, and not
>> an
>> arbitrary list. That makes the internal representation much simpler.
>> A quick test passes fine, but Harald you clearly have a better test
>> harness. Please could you put this through its paces, and see if it
>> does
>> what you need.
> I ran some tests with your patch, and I did not run into any issues
> with the prefix support.
> Unfortunately, for my use-case in openstack the arbitrary list is the
> useful option between the two. There is currently no way in openstack
> networking api to ask the ip-address management to allocate a set of
> consecutive addresses. Adding support for the prefix approach is a
> major change to api, object model's, database schema etc.
> Any chance we can add the arbitrary list back in? 

Yes, no problem doing that. I didn't appreciate it was necessary. New
commit soon, and I'll also look at the tagging one.



Or revert to my
> initial approach allowing multiple host-entries with different
> addresses? With the tag filtering support added for dhcp-hosts the
> issue of ordering of entries in configuration file is somewhat relaxed,
> as in; it's possible to control via tag's and filters.
> Cheers
> Harald

More information about the Dnsmasq-discuss mailing list