Re: [Dnsmasq-discuss] [PATCH] DHCPv6: Honor assigning IPv6 address based on MAC address

2020-04-21 Thread Geert Stappers
On Tue, Apr 21, 2020 at 04:16:43PM +0200, Pali Rohár wrote:
> On Friday 07 February 2020 23:08:32 Pali Rohár wrote:
> > On Monday 17 December 2018 18:41:09 Pali Rohár wrote:

   

> Hello!
> 
> I have not got any reply about this patch for years.
> 
> So I would like to know, is some spam filter eating my emails and
> therefore patch was not delivered?
> 
> Can somebody confirm if Simon got my patch or should I probably resent
> it from different email address, to prevent spam filter problems?


Here NOT the project lead.


In the 17 months since the original post on assigning IPv6 address based
on MAC address has dnsmasq seen many code changes.  Including IPv6
address assignment, even through patches.

I do have seen the reminders on "please review my patch".

Please accept this posting as "your patch from 2018-12-17 is rejected".
In case of a "Why?", be prepared for being ignored. Try to understand
that explaining why patch is not good enough does cost human energy.


Now we can go on.


Make a new start.  Install the latest version of dnsmasq.
Use it in your scenario. Find out if you can use it in your scenario.
Report your use case. Make some effort to explain that more
people can benefit from your use case, create awareness.

Let's assume dnsmasq doesn't fit YOUR use case. And you modify
it so it does fit your case. Then you have a fresh patch.
Sending that patch to this mailinglist is no garantee for acceptance.

I agree that being ignored does cost human energy. Sad, but true.

What I'm now trying is to break the loop of repeated "review my patch".

Send UPDATED versions for patches (stop retransmitting patches that
are most likely outdated.)


Regards
Geert Stappers


P.S.

Simon, I think it is a good thing to have a canned reply like:

  Patch as been recieved, reviewed and rejected.
  Please understand that explaining "why the reject"
  will drain resources from the project we both care about.
  No hardfeelings, feel free to retry.

___
Dnsmasq-discuss mailing list
Dnsmasq-discuss@lists.thekelleys.org.uk
http://lists.thekelleys.org.uk/mailman/listinfo/dnsmasq-discuss


Re: [Dnsmasq-discuss] [PATCH] DHCPv6: Honor assigning IPv6 address based on MAC address

2020-04-21 Thread Pali Rohár
Hello!

I have not got any reply about this patch for years.

So I would like to know, is some spam filter eating my emails and
therefore patch was not delivered?

Can somebody confirm if Simon got my patch or should I probably resent
it from different email address, to prevent spam filter problems?

On Friday 07 February 2020 23:08:32 Pali Rohár wrote:
> Hello Simon!
> 
> Could you please review / comment this patch?
> 
> I would like to know what is needed to be fixed or changed, so patch
> could be finally merged.
> 
> On Monday 17 December 2018 18:41:09 Pali Rohár wrote:
> > Currently IPv6 addresses are assigned to tuple (IAID, DUID). When system
> > changes IAID/DUID then old assigned IPv6 address cannot be reused, even
> > when in config file was DHCPv6 assignment based on MAC address (and not on
> > DUID).
> > 
> > IAID/DUID is changed when rebooting from one operating system to another;
> > or after reinstalling system. In reality it is normal that DUID of some
> > machine is changed, so people rather assign also IPv6 addresses based on
> > MAC address.
> > 
> > So assigning IPv6 based on MAC address in dnsmasq is currently semi-broken.
> > 
> > This patch tries to fix it and honors IPv6 config rules with MAC address,
> > to always assign particular IPv6 address to specific MAC address (when
> > configured). And ignores the fact if IAID/DUID was changed.
> > 
> > Normally IPv6 address should be assigned by IAID/DUID (which also state
> > DHCPv6 RFCs), but dnsmasq has already some support for assigning IPv6
> > address based on MAC address, when users configured in config file.
> > 
> > So this patch just tries to fix above problem for user configuration with
> > MAC addresses. It does not change assignment based on DUID.
> > 
> > Also this patch adds support for allowing IPv6 address to be associated
> > with multiple hardware addresses, and gives dnsmasq permission to abandon a
> > lease. This is similar functionality as already supported for IPv4 address.
> > ---
> >  man/dnsmasq.8 |  9 ++---
> >  src/rfc3315.c | 62 
> > ++-
> >  2 files changed, 59 insertions(+), 12 deletions(-)
> > 
> > diff --git a/man/dnsmasq.8 b/man/dnsmasq.8
> > index f01a5ba..8614f08 100644
> > --- a/man/dnsmasq.8
> > +++ b/man/dnsmasq.8
> > @@ -1068,10 +1068,13 @@ will only match a
> >  Token-Ring hardware address, since the ARP-address type for token ring
> >  is 6. 
> >  
> > -As a special case, in DHCPv4, it is possible to include more than one
> > -hardware address. eg:
> > +It is possible to include more than one hardware address. eg for IPv4:
> >  .B --dhcp-host=11:22:33:44:55:66,12:34:56:78:90:12,192.168.0.2
> > -This allows an IP address to be associated with
> > +or for IPv6:
> > +.B --dhcp-host=11:22:33:44:55:66,12:34:56:78:90:12,[::2]
> > +or for both:
> > +.B --dhcp-host=11:22:33:44:55:66,12:34:56:78:90:12,192.168.0.2,[::2]
> > +This allows an IPv4 and/or IPv6 address to be associated with
> >  multiple hardware addresses, and gives dnsmasq permission to abandon a
> >  DHCP lease to one of the hardware addresses when another one asks for
> >  a lease. Beware that this is a dangerous thing to do, it will only
> > diff --git a/src/rfc3315.c b/src/rfc3315.c
> > index a20776d..c83cf2d 100644
> > --- a/src/rfc3315.c
> > +++ b/src/rfc3315.c
> > @@ -54,7 +54,7 @@ static struct prefix_class 
> > *prefix_class_from_context(struct dhcp_context *conte
> >  #endif
> >  static void mark_context_used(struct state *state, struct in6_addr *addr);
> >  static void mark_config_used(struct dhcp_context *context, struct in6_addr 
> > *addr);
> > -static int check_address(struct state *state, struct in6_addr *addr);
> > +static int check_address(struct state *state, struct dhcp_config *config, 
> > struct in6_addr *addr);
> >  static void add_address(struct state *state, struct dhcp_context *context, 
> > unsigned int lease_time, void *ia_option, 
> > unsigned int *min_time, struct in6_addr *addr, time_t 
> > now);
> >  static void update_leases(struct state *state, struct dhcp_context 
> > *context, struct in6_addr *addr, unsigned int lease_time, time_t now);
> > @@ -746,7 +746,7 @@ static int dhcp6_no_relay(struct state *state, int 
> > msg_type, void *inbuff, size_
> > /* If the client asks for an address on the same network as 
> > a configured address, 
> >offer the configured address instead, to make moving to 
> > newly-configured
> >addresses automatic. */
> > -   if (!(c->flags & CONTEXT_CONF_USED) && config_valid(config, 
> > c, ) && check_address(state, ))
> > +   if (!(c->flags & CONTEXT_CONF_USED) && config_valid(config, 
> > c, ) && check_address(state, config, ))
> >   {
> > req_addr = addr;
> > mark_config_used(c, );
> > @@ -755,8 +755,14 @@ static int dhcp6_no_relay(struct state *state, int 
> > 

Re: [Dnsmasq-discuss] [PATCH] DHCPv6: Honor assigning IPv6 address based on MAC address

2020-02-07 Thread Pali Rohár
Hello Simon!

Could you please review / comment this patch?

I would like to know what is needed to be fixed or changed, so patch
could be finally merged.

On Monday 17 December 2018 18:41:09 Pali Rohár wrote:
> Currently IPv6 addresses are assigned to tuple (IAID, DUID). When system
> changes IAID/DUID then old assigned IPv6 address cannot be reused, even
> when in config file was DHCPv6 assignment based on MAC address (and not on
> DUID).
> 
> IAID/DUID is changed when rebooting from one operating system to another;
> or after reinstalling system. In reality it is normal that DUID of some
> machine is changed, so people rather assign also IPv6 addresses based on
> MAC address.
> 
> So assigning IPv6 based on MAC address in dnsmasq is currently semi-broken.
> 
> This patch tries to fix it and honors IPv6 config rules with MAC address,
> to always assign particular IPv6 address to specific MAC address (when
> configured). And ignores the fact if IAID/DUID was changed.
> 
> Normally IPv6 address should be assigned by IAID/DUID (which also state
> DHCPv6 RFCs), but dnsmasq has already some support for assigning IPv6
> address based on MAC address, when users configured in config file.
> 
> So this patch just tries to fix above problem for user configuration with
> MAC addresses. It does not change assignment based on DUID.
> 
> Also this patch adds support for allowing IPv6 address to be associated
> with multiple hardware addresses, and gives dnsmasq permission to abandon a
> lease. This is similar functionality as already supported for IPv4 address.
> ---
>  man/dnsmasq.8 |  9 ++---
>  src/rfc3315.c | 62 
> ++-
>  2 files changed, 59 insertions(+), 12 deletions(-)
> 
> diff --git a/man/dnsmasq.8 b/man/dnsmasq.8
> index f01a5ba..8614f08 100644
> --- a/man/dnsmasq.8
> +++ b/man/dnsmasq.8
> @@ -1068,10 +1068,13 @@ will only match a
>  Token-Ring hardware address, since the ARP-address type for token ring
>  is 6. 
>  
> -As a special case, in DHCPv4, it is possible to include more than one
> -hardware address. eg:
> +It is possible to include more than one hardware address. eg for IPv4:
>  .B --dhcp-host=11:22:33:44:55:66,12:34:56:78:90:12,192.168.0.2
> -This allows an IP address to be associated with
> +or for IPv6:
> +.B --dhcp-host=11:22:33:44:55:66,12:34:56:78:90:12,[::2]
> +or for both:
> +.B --dhcp-host=11:22:33:44:55:66,12:34:56:78:90:12,192.168.0.2,[::2]
> +This allows an IPv4 and/or IPv6 address to be associated with
>  multiple hardware addresses, and gives dnsmasq permission to abandon a
>  DHCP lease to one of the hardware addresses when another one asks for
>  a lease. Beware that this is a dangerous thing to do, it will only
> diff --git a/src/rfc3315.c b/src/rfc3315.c
> index a20776d..c83cf2d 100644
> --- a/src/rfc3315.c
> +++ b/src/rfc3315.c
> @@ -54,7 +54,7 @@ static struct prefix_class 
> *prefix_class_from_context(struct dhcp_context *conte
>  #endif
>  static void mark_context_used(struct state *state, struct in6_addr *addr);
>  static void mark_config_used(struct dhcp_context *context, struct in6_addr 
> *addr);
> -static int check_address(struct state *state, struct in6_addr *addr);
> +static int check_address(struct state *state, struct dhcp_config *config, 
> struct in6_addr *addr);
>  static void add_address(struct state *state, struct dhcp_context *context, 
> unsigned int lease_time, void *ia_option, 
>   unsigned int *min_time, struct in6_addr *addr, time_t 
> now);
>  static void update_leases(struct state *state, struct dhcp_context *context, 
> struct in6_addr *addr, unsigned int lease_time, time_t now);
> @@ -746,7 +746,7 @@ static int dhcp6_no_relay(struct state *state, int 
> msg_type, void *inbuff, size_
>   /* If the client asks for an address on the same network as 
> a configured address, 
>  offer the configured address instead, to make moving to 
> newly-configured
>  addresses automatic. */
> - if (!(c->flags & CONTEXT_CONF_USED) && config_valid(config, 
> c, ) && check_address(state, ))
> + if (!(c->flags & CONTEXT_CONF_USED) && config_valid(config, 
> c, ) && check_address(state, config, ))
> {
>   req_addr = addr;
>   mark_config_used(c, );
> @@ -755,8 +755,14 @@ static int dhcp6_no_relay(struct state *state, int 
> msg_type, void *inbuff, size_
> }
>   else if (!(c = address6_available(state->context, 
> _addr, solicit_tags, plain_range)))
> continue; /* not an address we're allowed */
> - else if (!check_address(state, _addr))
> + else if (!check_address(state, config, _addr))
> continue; /* address leased elsewhere */
> + else if (state->mac_len && config &&
> +  config_has_mac(config, 

Re: [Dnsmasq-discuss] [PATCH] DHCPv6: Honor assigning IPv6 address based on MAC address

2019-12-17 Thread Pali Rohár
Hello!

Today this patch celebrates one year anniversary.

Based on the fact that there was no reported problem for this patch for
one year and also more people tested it and use it in production systems,
could be this patch included it into dnsmasq project?

Or is something else needed?

On Monday 17 December 2018 18:41:09 Pali Rohár wrote:
> Currently IPv6 addresses are assigned to tuple (IAID, DUID). When system
> changes IAID/DUID then old assigned IPv6 address cannot be reused, even
> when in config file was DHCPv6 assignment based on MAC address (and not on
> DUID).
> 
> IAID/DUID is changed when rebooting from one operating system to another;
> or after reinstalling system. In reality it is normal that DUID of some
> machine is changed, so people rather assign also IPv6 addresses based on
> MAC address.
> 
> So assigning IPv6 based on MAC address in dnsmasq is currently semi-broken.
> 
> This patch tries to fix it and honors IPv6 config rules with MAC address,
> to always assign particular IPv6 address to specific MAC address (when
> configured). And ignores the fact if IAID/DUID was changed.
> 
> Normally IPv6 address should be assigned by IAID/DUID (which also state
> DHCPv6 RFCs), but dnsmasq has already some support for assigning IPv6
> address based on MAC address, when users configured in config file.
> 
> So this patch just tries to fix above problem for user configuration with
> MAC addresses. It does not change assignment based on DUID.
> 
> Also this patch adds support for allowing IPv6 address to be associated
> with multiple hardware addresses, and gives dnsmasq permission to abandon a
> lease. This is similar functionality as already supported for IPv4 address.
> ---
>  man/dnsmasq.8 |  9 ++---
>  src/rfc3315.c | 62 
> ++-
>  2 files changed, 59 insertions(+), 12 deletions(-)
> 
> diff --git a/man/dnsmasq.8 b/man/dnsmasq.8
> index f01a5ba..8614f08 100644
> --- a/man/dnsmasq.8
> +++ b/man/dnsmasq.8
> @@ -1068,10 +1068,13 @@ will only match a
>  Token-Ring hardware address, since the ARP-address type for token ring
>  is 6. 
>  
> -As a special case, in DHCPv4, it is possible to include more than one
> -hardware address. eg:
> +It is possible to include more than one hardware address. eg for IPv4:
>  .B --dhcp-host=11:22:33:44:55:66,12:34:56:78:90:12,192.168.0.2
> -This allows an IP address to be associated with
> +or for IPv6:
> +.B --dhcp-host=11:22:33:44:55:66,12:34:56:78:90:12,[::2]
> +or for both:
> +.B --dhcp-host=11:22:33:44:55:66,12:34:56:78:90:12,192.168.0.2,[::2]
> +This allows an IPv4 and/or IPv6 address to be associated with
>  multiple hardware addresses, and gives dnsmasq permission to abandon a
>  DHCP lease to one of the hardware addresses when another one asks for
>  a lease. Beware that this is a dangerous thing to do, it will only
> diff --git a/src/rfc3315.c b/src/rfc3315.c
> index a20776d..c83cf2d 100644
> --- a/src/rfc3315.c
> +++ b/src/rfc3315.c
> @@ -54,7 +54,7 @@ static struct prefix_class 
> *prefix_class_from_context(struct dhcp_context *conte
>  #endif
>  static void mark_context_used(struct state *state, struct in6_addr *addr);
>  static void mark_config_used(struct dhcp_context *context, struct in6_addr 
> *addr);
> -static int check_address(struct state *state, struct in6_addr *addr);
> +static int check_address(struct state *state, struct dhcp_config *config, 
> struct in6_addr *addr);
>  static void add_address(struct state *state, struct dhcp_context *context, 
> unsigned int lease_time, void *ia_option, 
>   unsigned int *min_time, struct in6_addr *addr, time_t 
> now);
>  static void update_leases(struct state *state, struct dhcp_context *context, 
> struct in6_addr *addr, unsigned int lease_time, time_t now);
> @@ -746,7 +746,7 @@ static int dhcp6_no_relay(struct state *state, int 
> msg_type, void *inbuff, size_
>   /* If the client asks for an address on the same network as 
> a configured address, 
>  offer the configured address instead, to make moving to 
> newly-configured
>  addresses automatic. */
> - if (!(c->flags & CONTEXT_CONF_USED) && config_valid(config, 
> c, ) && check_address(state, ))
> + if (!(c->flags & CONTEXT_CONF_USED) && config_valid(config, 
> c, ) && check_address(state, config, ))
> {
>   req_addr = addr;
>   mark_config_used(c, );
> @@ -755,8 +755,14 @@ static int dhcp6_no_relay(struct state *state, int 
> msg_type, void *inbuff, size_
> }
>   else if (!(c = address6_available(state->context, 
> _addr, solicit_tags, plain_range)))
> continue; /* not an address we're allowed */
> - else if (!check_address(state, _addr))
> + else if (!check_address(state, config, _addr))
> continue; /* address 

Re: [Dnsmasq-discuss] [PATCH] DHCPv6: Honor assigning IPv6 address based on MAC address

2019-11-28 Thread Harald Jensås
On Sun, 2019-11-24 at 10:35 +0100, Geert Stappers wrote:
> On Thu, Nov 21, 2019 at 03:12:00PM +0100, Harald Jensås wrote:
> > Bumping this patch again: 
> > http://lists.thekelleys.org.uk/pipermail/dnsmasq-discuss/2018q4/012707.html
> > 
> > I see there have been several request to include this on the list:
> > http://lists.thekelleys.org.uk/pipermail/dnsmasq-discuss/2019q1/012895.html 
> > (and others
> > ...)
> > afaict there has not been any objections to the patch.
> > 
> > 
> > We are trying to make Openstack Ironic deploy baremetal servers in
> > a
> > setup where Openstack Neutron is used. Neutron uses dnsmasq and the
> > MAC
> > address as identifier to assign IPv6 addresses in a static only
> > setup,
> > config details at bottom of this mail.
> > 
> > The problem with DUID/IAID changes as the baremetal node is moving
> > trough the deployment phases UEFI->iPXE->Deploy Ramdisk resulting
> > in
> > "no address available" has always been a blocker for this to work.
> > (The
> > issue was discussed on this list a some time ago, 
> > http://lists.thekelleys.org.uk/pipermail/dnsmasq-discuss/2017q1/thread.html#11267
> > )
> > 
> > This patch solves this problem of changing DUID/IAID's.
> > 
> >  Is there a reason not to merge the patch?
> 
> A better question would be:
> 
>   What is needed to get this, reported as working, patch merged?
> 

Thanks Geert, this is indeed the better question.

I can provide dnsmasq log's and traffic captures along with
configuration details from a setup I have where I verified this is
working if that helps.

On other words, let us know what is needed and we shall try to provide
it.


> 
> > 
> > 
> > /usr/sbin/dnsmasq \
> >  -k \
> >  --no-hosts \
> >  --no-resolv \
> >  --pid-file=/var/lib/neutron/dhcp/6c9c3845-a101-47fa-a491-
> > 52e1ecb11e65/pid \
> >  --dhcp-hostsfile=/var/lib/neutron/dhcp/6c9c3845-a101-47fa-a491-
> > 52e1ecb11e65/host \
> >  --addn-hosts=/var/lib/neutron/dhcp/6c9c3845-a101-47fa-a491-
> > 52e1ecb11e65/addn_hosts \
> >  --dhcp-optsfile=/var/lib/neutron/dhcp/6c9c3845-a101-47fa-a491-
> > 52e1ecb11e65/opts \
> >  --dhcp-leasefile=/var/lib/neutron/dhcp/6c9c3845-a101-47fa-a491-
> > 52e1ecb11e65/leases \
> >  --dhcp-match=set:ipxe,175 \
> >  --dhcp-userclass=set:ipxe6,iPXE \
> >  --local-service \
> >  --bind-dynamic \
> >  --dhcp-range=set:subnet-2b009f45-e0e2-4888-bb19-
> > 8d46e51717b8,fd12:3456:789a:1::,static,64,86400s \
> >  --dhcp-option-force=option:mtu,1450 \
> >  --dhcp-lease-max=16777216 \
> >  --conf-file= \
> >  --domain=localdomain
> > 
> > $ cat /var/lib/neutron/dhcp/6c9c3845-a101-47fa-a491-
> > 52e1ecb11e65/host
> > fa:16:3e:8b:07:9f,host-fd12-3456-789a-1
> > --4.localdomain,[fd12:3456:789a:1::4]
> > fa:16:3e:9f:b7:e3,host-fd12-3456-789a-1
> > --ed.localdomain,[fd12:3456:789a:1::ed]
> > 
> > 
> 
> Groeten
> Geert Stappers


___
Dnsmasq-discuss mailing list
Dnsmasq-discuss@lists.thekelleys.org.uk
http://lists.thekelleys.org.uk/mailman/listinfo/dnsmasq-discuss


Re: [Dnsmasq-discuss] [PATCH] DHCPv6: Honor assigning IPv6 address based on MAC address

2019-11-24 Thread Geert Stappers
On Thu, Nov 21, 2019 at 03:12:00PM +0100, Harald Jensås wrote:
> Bumping this patch again: 
> http://lists.thekelleys.org.uk/pipermail/dnsmasq-discuss/2018q4/012707.html
> 
> I see there have been several request to include this on the list:
> http://lists.thekelleys.org.uk/pipermail/dnsmasq-discuss/2019q1/012895.html 
> (and others ...)
> afaict there has not been any objections to the patch.
> 
> 
> We are trying to make Openstack Ironic deploy baremetal servers in a
> setup where Openstack Neutron is used. Neutron uses dnsmasq and the MAC
> address as identifier to assign IPv6 addresses in a static only setup,
> config details at bottom of this mail.
> 
> The problem with DUID/IAID changes as the baremetal node is moving
> trough the deployment phases UEFI->iPXE->Deploy Ramdisk resulting in
> "no address available" has always been a blocker for this to work. (The
> issue was discussed on this list a some time ago, 
> http://lists.thekelleys.org.uk/pipermail/dnsmasq-discuss/2017q1/thread.html#11267
> )
> 
> This patch solves this problem of changing DUID/IAID's.
> 
>  Is there a reason not to merge the patch?

A better question would be:

  What is needed to get this, reported as working, patch merged?


> 
> 
> 
> /usr/sbin/dnsmasq \
>  -k \
>  --no-hosts \
>  --no-resolv \
>  --pid-file=/var/lib/neutron/dhcp/6c9c3845-a101-47fa-a491-52e1ecb11e65/pid \
>  
> --dhcp-hostsfile=/var/lib/neutron/dhcp/6c9c3845-a101-47fa-a491-52e1ecb11e65/host
>  \
>  
> --addn-hosts=/var/lib/neutron/dhcp/6c9c3845-a101-47fa-a491-52e1ecb11e65/addn_hosts
>  \
>  
> --dhcp-optsfile=/var/lib/neutron/dhcp/6c9c3845-a101-47fa-a491-52e1ecb11e65/opts
>  \
>  
> --dhcp-leasefile=/var/lib/neutron/dhcp/6c9c3845-a101-47fa-a491-52e1ecb11e65/leases
>  \
>  --dhcp-match=set:ipxe,175 \
>  --dhcp-userclass=set:ipxe6,iPXE \
>  --local-service \
>  --bind-dynamic \
>  
> --dhcp-range=set:subnet-2b009f45-e0e2-4888-bb19-8d46e51717b8,fd12:3456:789a:1::,static,64,86400s
>  \
>  --dhcp-option-force=option:mtu,1450 \
>  --dhcp-lease-max=16777216 \
>  --conf-file= \
>  --domain=localdomain
> 
> $ cat /var/lib/neutron/dhcp/6c9c3845-a101-47fa-a491-52e1ecb11e65/host
> fa:16:3e:8b:07:9f,host-fd12-3456-789a-1--4.localdomain,[fd12:3456:789a:1::4]
> fa:16:3e:9f:b7:e3,host-fd12-3456-789a-1--ed.localdomain,[fd12:3456:789a:1::ed]
> 
> 

Groeten
Geert Stappers
-- 
Leven en laten leven

___
Dnsmasq-discuss mailing list
Dnsmasq-discuss@lists.thekelleys.org.uk
http://lists.thekelleys.org.uk/mailman/listinfo/dnsmasq-discuss


Re: [Dnsmasq-discuss] [PATCH] DHCPv6: Honor assigning IPv6 address based on MAC address

2019-11-21 Thread Harald Jensås
Bumping this patch again: 
http://lists.thekelleys.org.uk/pipermail/dnsmasq-discuss/2018q4/012707.html

I see there have been several request to include this on the list:
http://lists.thekelleys.org.uk/pipermail/dnsmasq-discuss/2019q1/012895.html 
(and others ...) afaict there has not been any objections to the
patch.


We are trying to make Openstack Ironic deploy baremetal servers in a
setup where Openstack Neutron is used. Neutron uses dnsmasq and the MAC
address as identifier to assign IPv6 addresses in a static only setup,
config details at bottom of this mail.

The problem with DUID/IAID changes as the baremetal node is moving
trough the deployment phases UEFI->iPXE->Deploy Ramdisk resulting in
"no address available" has always been a blocker for this to work. (The
issue was discussed on this list a some time ago, 
http://lists.thekelleys.org.uk/pipermail/dnsmasq-discuss/2017q1/thread.html#11267
)

This patch solves this problem of changing DUID/IAID's.

 Is there a reason not to merge the patch?



/usr/sbin/dnsmasq \
 -k \
 --no-hosts \
 --no-resolv \
 --pid-file=/var/lib/neutron/dhcp/6c9c3845-a101-47fa-a491-
52e1ecb11e65/pid \
 --dhcp-hostsfile=/var/lib/neutron/dhcp/6c9c3845-a101-47fa-a491-
52e1ecb11e65/host \
 --addn-hosts=/var/lib/neutron/dhcp/6c9c3845-a101-47fa-a491-
52e1ecb11e65/addn_hosts \
 --dhcp-optsfile=/var/lib/neutron/dhcp/6c9c3845-a101-47fa-a491-
52e1ecb11e65/opts \
 --dhcp-leasefile=/var/lib/neutron/dhcp/6c9c3845-a101-47fa-a491-
52e1ecb11e65/leases \
 --dhcp-match=set:ipxe,175 \
 --dhcp-userclass=set:ipxe6,iPXE \
 --local-service \
 --bind-dynamic \
 --dhcp-range=set:subnet-2b009f45-e0e2-4888-bb19-
8d46e51717b8,fd12:3456:789a:1::,static,64,86400s \
 --dhcp-option-force=option:mtu,1450 \
 --dhcp-lease-max=16777216 \
 --conf-file= \
 --domain=localdomain

$ cat /var/lib/neutron/dhcp/6c9c3845-a101-47fa-a491-52e1ecb11e65/host
fa:16:3e:8b:07:9f,host-fd12-3456-789a-1
--4.localdomain,[fd12:3456:789a:1::4]
fa:16:3e:9f:b7:e3,host-fd12-3456-789a-1
--ed.localdomain,[fd12:3456:789a:1::ed]



___
Dnsmasq-discuss mailing list
Dnsmasq-discuss@lists.thekelleys.org.uk
http://lists.thekelleys.org.uk/mailman/listinfo/dnsmasq-discuss


Re: [Dnsmasq-discuss] [PATCH] DHCPv6: Honor assigning IPv6 address based on MAC address

2019-06-26 Thread Roy Marples

On 26/06/2019 21:16, Oliver Freyermuth wrote:

Am 26.06.19 um 21:49 schrieb Pali Rohár:

So, could somebody review and comment my patch?


Just to add on this:
I'm also using this patch in production since over a month now and it works 
very well for me (with dnsmasq 2.80).
Would really love to see this upstream.


Based on mailing list activity, Simon isn't involved much for reasons 
unknown. I suggest we pester him when he returns :)


Just to chime in, I'm using this in production as well with good success 
as well, even though it does go against some DHCP6 designs.


Roy

___
Dnsmasq-discuss mailing list
Dnsmasq-discuss@lists.thekelleys.org.uk
http://lists.thekelleys.org.uk/mailman/listinfo/dnsmasq-discuss


Re: [Dnsmasq-discuss] [PATCH] DHCPv6: Honor assigning IPv6 address based on MAC address

2019-06-26 Thread Oliver Freyermuth
Am 26.06.19 um 21:49 schrieb Pali Rohár:
> On Saturday 11 May 2019 17:42:54 Kevin Darbyshire-Bryant wrote:
>>> On 6 Apr 2019, at 12:01, Geert Stappers  wrote:
>>>
>>> On Mon, Apr 01, 2019 at 01:02:20AM +0200, Pali Rohár wrote:
 On Tuesday 12 February 2019 13:41:43 Geert Stappers wrote:
> On 06-02-2019 21:29, Pali Rohár wrote:
>> On Friday 11 January 2019 17:52:43 Pali Rohár wrote:
>>> On Monday 17 December 2018 18:41:09 Pali Rohár wrote:
 Currently IPv6 addresses are assigned to tuple (IAID, DUID). When 
 system
 changes IAID/DUID then old assigned IPv6 address cannot be reused, even
 when in config file was DHCPv6 assignment based on MAC address (and 
 not on
 DUID).
>>>
>>>   ...
>>>
>>> Hello, can somebody look at this patch?
>>>
>>> I remember that more people asked for ability to assign IPv6 address
>>> based on MAC address specified in config file, rather then IAID/DUID.
>>>
>> PING
>>
> Another request for
>
> Hey, could this patch get reviewed?
>
>
 Hello, can somebody review this patch?

>>>
>>> FWIW
>>>
>>> * The (four months old) patch does get applied cleanly.
>>> * My compiler is happy with it
>>> * Executable remains running upon start ( no early crash )
>>> * I'm unable to test the (new) IPv6 functionality
>>>
>>>
>>> Where in the "patch pipeline" is Pali's patch?
>>>
>>>
>>> Regards
>>> Geert Stappers
>>
>> I’ve been using this patch to tame qnap’s frustrating dhcpv6 assignment 
>> limitations for many months.  It’s immensely useful.
>>
>>
>> Cheers,
>>
>> Kevin D-B
> 
> So, could somebody review and comment my patch?

Just to add on this: 
I'm also using this patch in production since over a month now and it works 
very well for me (with dnsmasq 2.80). 
Would really love to see this upstream. 

Cheers,
Oliver

> 
> 
> ___
> Dnsmasq-discuss mailing list
> Dnsmasq-discuss@lists.thekelleys.org.uk
> http://lists.thekelleys.org.uk/mailman/listinfo/dnsmasq-discuss
> 



signature.asc
Description: OpenPGP digital signature
___
Dnsmasq-discuss mailing list
Dnsmasq-discuss@lists.thekelleys.org.uk
http://lists.thekelleys.org.uk/mailman/listinfo/dnsmasq-discuss


Re: [Dnsmasq-discuss] [PATCH] DHCPv6: Honor assigning IPv6 address based on MAC address

2019-06-26 Thread Pali Rohár
On Saturday 11 May 2019 17:42:54 Kevin Darbyshire-Bryant wrote:
> > On 6 Apr 2019, at 12:01, Geert Stappers  wrote:
> > 
> > On Mon, Apr 01, 2019 at 01:02:20AM +0200, Pali Rohár wrote:
> >> On Tuesday 12 February 2019 13:41:43 Geert Stappers wrote:
> >>> On 06-02-2019 21:29, Pali Rohár wrote:
>  On Friday 11 January 2019 17:52:43 Pali Rohár wrote:
> > On Monday 17 December 2018 18:41:09 Pali Rohár wrote:
> >> Currently IPv6 addresses are assigned to tuple (IAID, DUID). When 
> >> system
> >> changes IAID/DUID then old assigned IPv6 address cannot be reused, even
> >> when in config file was DHCPv6 assignment based on MAC address (and 
> >> not on
> >> DUID).
> > 
> >   ...
> > 
> > Hello, can somebody look at this patch?
> > 
> > I remember that more people asked for ability to assign IPv6 address
> > based on MAC address specified in config file, rather then IAID/DUID.
> > 
>  PING
>  
> >>> Another request for
> >>> 
> >>> Hey, could this patch get reviewed?
> >>> 
> >>> 
> >> Hello, can somebody review this patch?
> >> 
> > 
> > FWIW
> > 
> > * The (four months old) patch does get applied cleanly.
> > * My compiler is happy with it
> > * Executable remains running upon start ( no early crash )
> > * I'm unable to test the (new) IPv6 functionality
> > 
> > 
> > Where in the "patch pipeline" is Pali's patch?
> > 
> > 
> > Regards
> > Geert Stappers
> 
> I’ve been using this patch to tame qnap’s frustrating dhcpv6 assignment 
> limitations for many months.  It’s immensely useful.
> 
> 
> Cheers,
> 
> Kevin D-B

So, could somebody review and comment my patch?

-- 
Pali Rohár
pali.ro...@gmail.com


signature.asc
Description: PGP signature
___
Dnsmasq-discuss mailing list
Dnsmasq-discuss@lists.thekelleys.org.uk
http://lists.thekelleys.org.uk/mailman/listinfo/dnsmasq-discuss


Re: [Dnsmasq-discuss] [PATCH] DHCPv6: Honor assigning IPv6 address based on MAC address

2019-05-14 Thread Oliver Freyermuth
Am 14.05.19 um 17:52 schrieb Roy Marples:
> On 14/05/2019 14:29, Oliver Freyermuth wrote:
>> Same here. In an automated deployment situation, client changes DUID in each 
>> phase:
>> - PXE (if done via IPv6)
>> - Installation time (from ramdisk)
>> - Final OS after installation
>> This may improve if newer versions of dhcpcd get packaged in installer 
>> ramdisks and OS, and also for systemd-dhcp,
>> but I am still unaware of any implementation of machine-id as base for the 
>> client DUID in dhclient and of course the implementations are all not 
>> exactly the same.
>> And then there is still the UEFI doing the PXE part, systems with broken 
>> machine-id etc And of course, dual booting if not set up with identical 
>> cliend-DUID.
>>
>> In general, my belief is that the RFC was made without real life use cases 
>> in mind and hence did not think of these.
>> The patch is very helpful to overcome these issues and matches user 
>> expectation (when specifying a MAC address in the config file, I want it to 
>> be used).
> 
> Speaking for dhcpcd (as yay, I am the author) - if the OS presents a stable 
> UUID dhcpcd will use that for the DUID:
> 
> https://tools.ietf.org/html/rfc6355
> https://roy.marples.name/cgit/dhcpcd.git/tree/src/duid.c#n63
> 
> So a fully automated deployment using dhcpcd AND a kernel which reports a 
> stable UUID then all is good.

There's also still another step that may cause an issue: If the UEFI also PXE 
boots via IPv6, it may present even another client DUID. 
It should certainly use the same UUID dhcpcd is using, but if it does not, you 
might be screwed (at least if your environment is IPv6 only). 

> 
> But not everyone uses dhcpcd>=7.0.6 with the UUID code in, nor a kernel which 
> reports a stable UUID.
> 
> There is literally no reason to use dhclient anymore - and hasn't been for a 
> number of years.

I fully agree (as a Gentoo user who has the freedom of choice). 
Somebody should teach those guys still shipping dhclient by default in their 
distro (e.g. Ubuntus network-manager package pulls in dhclient :-( ) or in 
their installer. 
And in our case, we are sadly not fully free in terms of choice of distro to 
use :-(. 

Cheers (and thanks again for the implementation in dhcpcd, and of course for 
dhcpcd itself!),
Oliver

> 
> Roy


___
Dnsmasq-discuss mailing list
Dnsmasq-discuss@lists.thekelleys.org.uk
http://lists.thekelleys.org.uk/mailman/listinfo/dnsmasq-discuss


Re: [Dnsmasq-discuss] [PATCH] DHCPv6: Honor assigning IPv6 address based on MAC address

2019-05-14 Thread Roy Marples

On 14/05/2019 14:29, Oliver Freyermuth wrote:

Same here. In an automated deployment situation, client changes DUID in each 
phase:
- PXE (if done via IPv6)
- Installation time (from ramdisk)
- Final OS after installation
This may improve if newer versions of dhcpcd get packaged in installer ramdisks 
and OS, and also for systemd-dhcp,
but I am still unaware of any implementation of machine-id as base for the 
client DUID in dhclient and of course the implementations are all not exactly 
the same.
And then there is still the UEFI doing the PXE part, systems with broken 
machine-id etc And of course, dual booting if not set up with identical 
cliend-DUID.

In general, my belief is that the RFC was made without real life use cases in 
mind and hence did not think of these.
The patch is very helpful to overcome these issues and matches user expectation 
(when specifying a MAC address in the config file, I want it to be used).


Speaking for dhcpcd (as yay, I am the author) - if the OS presents a 
stable UUID dhcpcd will use that for the DUID:


https://tools.ietf.org/html/rfc6355
https://roy.marples.name/cgit/dhcpcd.git/tree/src/duid.c#n63

So a fully automated deployment using dhcpcd AND a kernel which reports 
a stable UUID then all is good.


But not everyone uses dhcpcd>=7.0.6 with the UUID code in, nor a kernel 
which reports a stable UUID.


There is literally no reason to use dhclient anymore - and hasn't been 
for a number of years.


Roy

___
Dnsmasq-discuss mailing list
Dnsmasq-discuss@lists.thekelleys.org.uk
http://lists.thekelleys.org.uk/mailman/listinfo/dnsmasq-discuss


Re: [Dnsmasq-discuss] [PATCH] DHCPv6: Honor assigning IPv6 address based on MAC address

2019-05-14 Thread Oliver Freyermuth
Am 11.05.19 um 19:42 schrieb Kevin Darbyshire-Bryant:
> 
> 
>> On 6 Apr 2019, at 12:01, Geert Stappers  wrote:
>>
>> On Mon, Apr 01, 2019 at 01:02:20AM +0200, Pali Rohár wrote:
>>> On Tuesday 12 February 2019 13:41:43 Geert Stappers wrote:
 On 06-02-2019 21:29, Pali Rohár wrote:
> On Friday 11 January 2019 17:52:43 Pali Rohár wrote:
>> On Monday 17 December 2018 18:41:09 Pali Rohár wrote:
>>> Currently IPv6 addresses are assigned to tuple (IAID, DUID). When system
>>> changes IAID/DUID then old assigned IPv6 address cannot be reused, even
>>> when in config file was DHCPv6 assignment based on MAC address (and not 
>>> on
>>> DUID).
>>
>>   ...
>>
>> Hello, can somebody look at this patch?
>>
>> I remember that more people asked for ability to assign IPv6 address
>> based on MAC address specified in config file, rather then IAID/DUID.
>>
> PING
>
 Another request for

 Hey, could this patch get reviewed?


>>> Hello, can somebody review this patch?
>>>
>>
>> FWIW
>>
>> * The (four months old) patch does get applied cleanly.
>> * My compiler is happy with it
>> * Executable remains running upon start ( no early crash )
>> * I'm unable to test the (new) IPv6 functionality
>>
>>
>> Where in the "patch pipeline" is Pali's patch?
>>
>>
>> Regards
>> Geert Stappers
> 
> I’ve been using this patch to tame qnap’s frustrating dhcpv6 assignment 
> limitations for many months.  It’s immensely useful.

Same here. In an automated deployment situation, client changes DUID in each 
phase: 
- PXE (if done via IPv6)
- Installation time (from ramdisk)
- Final OS after installation
This may improve if newer versions of dhcpcd get packaged in installer ramdisks 
and OS, and also for systemd-dhcp,
but I am still unaware of any implementation of machine-id as base for the 
client DUID in dhclient and of course the implementations are all not exactly 
the same. 
And then there is still the UEFI doing the PXE part, systems with broken 
machine-id etc And of course, dual booting if not set up with identical 
cliend-DUID. 

In general, my belief is that the RFC was made without real life use cases in 
mind and hence did not think of these. 
The patch is very helpful to overcome these issues and matches user expectation 
(when specifying a MAC address in the config file, I want it to be used). 

Cheers,
Oliver

> 
> 
> Cheers,
> 
> Kevin D-B
> 
> gpg: 012C ACB2 28C6 C53E 9775  9123 B3A2 389B 9DE2 334A
> 
> ___
> Dnsmasq-discuss mailing list
> Dnsmasq-discuss@lists.thekelleys.org.uk
> http://lists.thekelleys.org.uk/mailman/listinfo/dnsmasq-discuss
> 

___
Dnsmasq-discuss mailing list
Dnsmasq-discuss@lists.thekelleys.org.uk
http://lists.thekelleys.org.uk/mailman/listinfo/dnsmasq-discuss


Re: [Dnsmasq-discuss] [PATCH] DHCPv6: Honor assigning IPv6 address based on MAC address

2019-05-11 Thread Kevin Darbyshire-Bryant


> On 6 Apr 2019, at 12:01, Geert Stappers  wrote:
> 
> On Mon, Apr 01, 2019 at 01:02:20AM +0200, Pali Rohár wrote:
>> On Tuesday 12 February 2019 13:41:43 Geert Stappers wrote:
>>> On 06-02-2019 21:29, Pali Rohár wrote:
 On Friday 11 January 2019 17:52:43 Pali Rohár wrote:
> On Monday 17 December 2018 18:41:09 Pali Rohár wrote:
>> Currently IPv6 addresses are assigned to tuple (IAID, DUID). When system
>> changes IAID/DUID then old assigned IPv6 address cannot be reused, even
>> when in config file was DHCPv6 assignment based on MAC address (and not 
>> on
>> DUID).
> 
>   ...
> 
> Hello, can somebody look at this patch?
> 
> I remember that more people asked for ability to assign IPv6 address
> based on MAC address specified in config file, rather then IAID/DUID.
> 
 PING
 
>>> Another request for
>>> 
>>> Hey, could this patch get reviewed?
>>> 
>>> 
>> Hello, can somebody review this patch?
>> 
> 
> FWIW
> 
> * The (four months old) patch does get applied cleanly.
> * My compiler is happy with it
> * Executable remains running upon start ( no early crash )
> * I'm unable to test the (new) IPv6 functionality
> 
> 
> Where in the "patch pipeline" is Pali's patch?
> 
> 
> Regards
> Geert Stappers

I’ve been using this patch to tame qnap’s frustrating dhcpv6 assignment 
limitations for many months.  It’s immensely useful.


Cheers,

Kevin D-B

gpg: 012C ACB2 28C6 C53E 9775  9123 B3A2 389B 9DE2 334A

___
Dnsmasq-discuss mailing list
Dnsmasq-discuss@lists.thekelleys.org.uk
http://lists.thekelleys.org.uk/mailman/listinfo/dnsmasq-discuss


Re: [Dnsmasq-discuss] [PATCH] DHCPv6: Honor assigning IPv6 address based on MAC address

2019-04-06 Thread Geert Stappers
On Mon, Apr 01, 2019 at 01:02:20AM +0200, Pali Rohár wrote:
> On Tuesday 12 February 2019 13:41:43 Geert Stappers wrote:
> > On 06-02-2019 21:29, Pali Rohár wrote:
> > > On Friday 11 January 2019 17:52:43 Pali Rohár wrote:
> > >> On Monday 17 December 2018 18:41:09 Pali Rohár wrote:
> > >>> Currently IPv6 addresses are assigned to tuple (IAID, DUID). When system
> > >>> changes IAID/DUID then old assigned IPv6 address cannot be reused, even
> > >>> when in config file was DHCPv6 assignment based on MAC address (and not 
> > >>> on
> > >>> DUID).

   ...

> > >> Hello, can somebody look at this patch?
> > >>
> > >> I remember that more people asked for ability to assign IPv6 address
> > >> based on MAC address specified in config file, rather then IAID/DUID.
> > >>
> > > PING
> > >
> > Another request for
> > 
> > Hey, could this patch get reviewed?
> > 
> > 
> Hello, can somebody review this patch?
> 

FWIW

* The (four months old) patch does get applied cleanly.
* My compiler is happy with it
* Executable remains running upon start ( no early crash )
* I'm unable to test the (new) IPv6 functionality


Where in the "patch pipeline" is Pali's patch?


Regards
Geert Stappers
-- 
Avoid unreviewed patches

___
Dnsmasq-discuss mailing list
Dnsmasq-discuss@lists.thekelleys.org.uk
http://lists.thekelleys.org.uk/mailman/listinfo/dnsmasq-discuss


Re: [Dnsmasq-discuss] [PATCH] DHCPv6: Honor assigning IPv6 address based on MAC address

2019-03-31 Thread Pali Rohár
Hello, can somebody review this patch?

On Tuesday 12 February 2019 13:41:43 Geert Stappers wrote:
> Another request for
> 
> Hey, could this patch get reviewed?
> 
> 
> On 06-02-2019 21:29, Pali Rohár wrote:
> > PING
> >
> > On Friday 11 January 2019 17:52:43 Pali Rohár wrote:
> >> Hello, can somebody look at this patch?
> >>
> >> I remember that more people asked for ability to assign IPv6 address
> >> based on MAC address specified in config file, rather then IAID/DUID.
> >>
> >> On Monday 17 December 2018 18:41:09 Pali Rohár wrote:
> >>> Currently IPv6 addresses are assigned to tuple (IAID, DUID). When system
> >>> changes IAID/DUID then old assigned IPv6 address cannot be reused, even
> >>> when in config file was DHCPv6 assignment based on MAC address (and not on
> >>> DUID).
> >>>
> >>> IAID/DUID is changed when rebooting from one operating system to another;
> >>> or after reinstalling system. In reality it is normal that DUID of some
> >>> machine is changed, so people rather assign also IPv6 addresses based on
> >>> MAC address.
> >>>
> >>> So assigning IPv6 based on MAC address in dnsmasq is currently 
> >>> semi-broken.
> >>>
> >>> This patch tries to fix it and honors IPv6 config rules with MAC address,
> >>> to always assign particular IPv6 address to specific MAC address (when
> >>> configured). And ignores the fact if IAID/DUID was changed.
> >>>
> >>> Normally IPv6 address should be assigned by IAID/DUID (which also state
> >>> DHCPv6 RFCs), but dnsmasq has already some support for assigning IPv6
> >>> address based on MAC address, when users configured in config file.
> >>>
> >>> So this patch just tries to fix above problem for user configuration with
> >>> MAC addresses. It does not change assignment based on DUID.
> >>>
> >>> Also this patch adds support for allowing IPv6 address to be associated
> >>> with multiple hardware addresses, and gives dnsmasq permission to abandon 
> >>> a
> >>> lease. This is similar functionality as already supported for IPv4 
> >>> address.
> >>> ---
> >>>  man/dnsmasq.8 |  9 ++---
> >>>  src/rfc3315.c | 62 
> >>> ++-
> >>>  2 files changed, 59 insertions(+), 12 deletions(-)
> >>>
> >>> diff --git a/man/dnsmasq.8 b/man/dnsmasq.8
> >>> index f01a5ba..8614f08 100644
> >>> --- a/man/dnsmasq.8
> >>> +++ b/man/dnsmasq.8
> >>> @@ -1068,10 +1068,13 @@ will only match a
> >>>  Token-Ring hardware address, since the ARP-address type for token ring
> >>>  is 6. 
> >>>  
> >>> -As a special case, in DHCPv4, it is possible to include more than one
> >>> -hardware address. eg:
> >>> +It is possible to include more than one hardware address. eg for IPv4:
> >>>  .B --dhcp-host=11:22:33:44:55:66,12:34:56:78:90:12,192.168.0.2
> >>> -This allows an IP address to be associated with
> >>> +or for IPv6:
> >>> +.B --dhcp-host=11:22:33:44:55:66,12:34:56:78:90:12,[::2]
> >>> +or for both:
> >>> +.B --dhcp-host=11:22:33:44:55:66,12:34:56:78:90:12,192.168.0.2,[::2]
> >>> +This allows an IPv4 and/or IPv6 address to be associated with
> >>>  multiple hardware addresses, and gives dnsmasq permission to abandon a
> >>>  DHCP lease to one of the hardware addresses when another one asks for
> >>>  a lease. Beware that this is a dangerous thing to do, it will only
> >>> diff --git a/src/rfc3315.c b/src/rfc3315.c
> >>> index a20776d..c83cf2d 100644
> >>> --- a/src/rfc3315.c
> >>> +++ b/src/rfc3315.c
> >>> @@ -54,7 +54,7 @@ static struct prefix_class 
> >>> *prefix_class_from_context(struct dhcp_context *conte
> >>>  #endif
> >>>  static void mark_context_used(struct state *state, struct in6_addr 
> >>> *addr);
> >>>  static void mark_config_used(struct dhcp_context *context, struct 
> >>> in6_addr *addr);
> >>> -static int check_address(struct state *state, struct in6_addr *addr);
> >>> +static int check_address(struct state *state, struct dhcp_config 
> >>> *config, struct in6_addr *addr);
> >>>  static void add_address(struct state *state, struct dhcp_context 
> >>> *context, unsigned int lease_time, void *ia_option, 
> >>>   unsigned int *min_time, struct in6_addr *addr, time_t 
> >>> now);
> >>>  static void update_leases(struct state *state, struct dhcp_context 
> >>> *context, struct in6_addr *addr, unsigned int lease_time, time_t now);
> >>> @@ -746,7 +746,7 @@ static int dhcp6_no_relay(struct state *state, int 
> >>> msg_type, void *inbuff, size_
> >>>   /* If the client asks for an address on the same network as 
> >>> a configured address, 
> >>>  offer the configured address instead, to make moving to 
> >>> newly-configured
> >>>  addresses automatic. */
> >>> - if (!(c->flags & CONTEXT_CONF_USED) && config_valid(config, 
> >>> c, ) && check_address(state, ))
> >>> + if (!(c->flags & CONTEXT_CONF_USED) && config_valid(config, 
> >>> c, ) && check_address(state, config, ))
> >>> {
> >>>   req_addr = 

Re: [Dnsmasq-discuss] [PATCH] DHCPv6: Honor assigning IPv6 address based on MAC address

2019-02-12 Thread Geert Stappers
Another request for

Hey, could this patch get reviewed?


On 06-02-2019 21:29, Pali Rohár wrote:
> PING
>
> On Friday 11 January 2019 17:52:43 Pali Rohár wrote:
>> Hello, can somebody look at this patch?
>>
>> I remember that more people asked for ability to assign IPv6 address
>> based on MAC address specified in config file, rather then IAID/DUID.
>>
>> On Monday 17 December 2018 18:41:09 Pali Rohár wrote:
>>> Currently IPv6 addresses are assigned to tuple (IAID, DUID). When system
>>> changes IAID/DUID then old assigned IPv6 address cannot be reused, even
>>> when in config file was DHCPv6 assignment based on MAC address (and not on
>>> DUID).
>>>
>>> IAID/DUID is changed when rebooting from one operating system to another;
>>> or after reinstalling system. In reality it is normal that DUID of some
>>> machine is changed, so people rather assign also IPv6 addresses based on
>>> MAC address.
>>>
>>> So assigning IPv6 based on MAC address in dnsmasq is currently semi-broken.
>>>
>>> This patch tries to fix it and honors IPv6 config rules with MAC address,
>>> to always assign particular IPv6 address to specific MAC address (when
>>> configured). And ignores the fact if IAID/DUID was changed.
>>>
>>> Normally IPv6 address should be assigned by IAID/DUID (which also state
>>> DHCPv6 RFCs), but dnsmasq has already some support for assigning IPv6
>>> address based on MAC address, when users configured in config file.
>>>
>>> So this patch just tries to fix above problem for user configuration with
>>> MAC addresses. It does not change assignment based on DUID.
>>>
>>> Also this patch adds support for allowing IPv6 address to be associated
>>> with multiple hardware addresses, and gives dnsmasq permission to abandon a
>>> lease. This is similar functionality as already supported for IPv4 address.
>>> ---
>>>  man/dnsmasq.8 |  9 ++---
>>>  src/rfc3315.c | 62 
>>> ++-
>>>  2 files changed, 59 insertions(+), 12 deletions(-)
>>>
>>> diff --git a/man/dnsmasq.8 b/man/dnsmasq.8
>>> index f01a5ba..8614f08 100644
>>> --- a/man/dnsmasq.8
>>> +++ b/man/dnsmasq.8
>>> @@ -1068,10 +1068,13 @@ will only match a
>>>  Token-Ring hardware address, since the ARP-address type for token ring
>>>  is 6. 
>>>  
>>> -As a special case, in DHCPv4, it is possible to include more than one
>>> -hardware address. eg:
>>> +It is possible to include more than one hardware address. eg for IPv4:
>>>  .B --dhcp-host=11:22:33:44:55:66,12:34:56:78:90:12,192.168.0.2
>>> -This allows an IP address to be associated with
>>> +or for IPv6:
>>> +.B --dhcp-host=11:22:33:44:55:66,12:34:56:78:90:12,[::2]
>>> +or for both:
>>> +.B --dhcp-host=11:22:33:44:55:66,12:34:56:78:90:12,192.168.0.2,[::2]
>>> +This allows an IPv4 and/or IPv6 address to be associated with
>>>  multiple hardware addresses, and gives dnsmasq permission to abandon a
>>>  DHCP lease to one of the hardware addresses when another one asks for
>>>  a lease. Beware that this is a dangerous thing to do, it will only
>>> diff --git a/src/rfc3315.c b/src/rfc3315.c
>>> index a20776d..c83cf2d 100644
>>> --- a/src/rfc3315.c
>>> +++ b/src/rfc3315.c
>>> @@ -54,7 +54,7 @@ static struct prefix_class 
>>> *prefix_class_from_context(struct dhcp_context *conte
>>>  #endif
>>>  static void mark_context_used(struct state *state, struct in6_addr *addr);
>>>  static void mark_config_used(struct dhcp_context *context, struct in6_addr 
>>> *addr);
>>> -static int check_address(struct state *state, struct in6_addr *addr);
>>> +static int check_address(struct state *state, struct dhcp_config *config, 
>>> struct in6_addr *addr);
>>>  static void add_address(struct state *state, struct dhcp_context *context, 
>>> unsigned int lease_time, void *ia_option, 
>>> unsigned int *min_time, struct in6_addr *addr, time_t 
>>> now);
>>>  static void update_leases(struct state *state, struct dhcp_context 
>>> *context, struct in6_addr *addr, unsigned int lease_time, time_t now);
>>> @@ -746,7 +746,7 @@ static int dhcp6_no_relay(struct state *state, int 
>>> msg_type, void *inbuff, size_
>>> /* If the client asks for an address on the same network as 
>>> a configured address, 
>>>offer the configured address instead, to make moving to 
>>> newly-configured
>>>addresses automatic. */
>>> -   if (!(c->flags & CONTEXT_CONF_USED) && config_valid(config, 
>>> c, ) && check_address(state, ))
>>> +   if (!(c->flags & CONTEXT_CONF_USED) && config_valid(config, 
>>> c, ) && check_address(state, config, ))
>>>   {
>>> req_addr = addr;
>>> mark_config_used(c, );
>>> @@ -755,8 +755,14 @@ static int dhcp6_no_relay(struct state *state, int 
>>> msg_type, void *inbuff, size_
>>>   }
>>> else if (!(c = address6_available(state->context, 
>>> _addr, solicit_tags, plain_range)))
>>>  

Re: [Dnsmasq-discuss] [PATCH] DHCPv6: Honor assigning IPv6 address based on MAC address

2019-02-06 Thread Pali Rohár
PING

On Friday 11 January 2019 17:52:43 Pali Rohár wrote:
> Hello, can somebody look at this patch?
> 
> I remember that more people asked for ability to assign IPv6 address
> based on MAC address specified in config file, rather then IAID/DUID.
> 
> On Monday 17 December 2018 18:41:09 Pali Rohár wrote:
> > Currently IPv6 addresses are assigned to tuple (IAID, DUID). When system
> > changes IAID/DUID then old assigned IPv6 address cannot be reused, even
> > when in config file was DHCPv6 assignment based on MAC address (and not on
> > DUID).
> > 
> > IAID/DUID is changed when rebooting from one operating system to another;
> > or after reinstalling system. In reality it is normal that DUID of some
> > machine is changed, so people rather assign also IPv6 addresses based on
> > MAC address.
> > 
> > So assigning IPv6 based on MAC address in dnsmasq is currently semi-broken.
> > 
> > This patch tries to fix it and honors IPv6 config rules with MAC address,
> > to always assign particular IPv6 address to specific MAC address (when
> > configured). And ignores the fact if IAID/DUID was changed.
> > 
> > Normally IPv6 address should be assigned by IAID/DUID (which also state
> > DHCPv6 RFCs), but dnsmasq has already some support for assigning IPv6
> > address based on MAC address, when users configured in config file.
> > 
> > So this patch just tries to fix above problem for user configuration with
> > MAC addresses. It does not change assignment based on DUID.
> > 
> > Also this patch adds support for allowing IPv6 address to be associated
> > with multiple hardware addresses, and gives dnsmasq permission to abandon a
> > lease. This is similar functionality as already supported for IPv4 address.
> > ---
> >  man/dnsmasq.8 |  9 ++---
> >  src/rfc3315.c | 62 
> > ++-
> >  2 files changed, 59 insertions(+), 12 deletions(-)
> > 
> > diff --git a/man/dnsmasq.8 b/man/dnsmasq.8
> > index f01a5ba..8614f08 100644
> > --- a/man/dnsmasq.8
> > +++ b/man/dnsmasq.8
> > @@ -1068,10 +1068,13 @@ will only match a
> >  Token-Ring hardware address, since the ARP-address type for token ring
> >  is 6. 
> >  
> > -As a special case, in DHCPv4, it is possible to include more than one
> > -hardware address. eg:
> > +It is possible to include more than one hardware address. eg for IPv4:
> >  .B --dhcp-host=11:22:33:44:55:66,12:34:56:78:90:12,192.168.0.2
> > -This allows an IP address to be associated with
> > +or for IPv6:
> > +.B --dhcp-host=11:22:33:44:55:66,12:34:56:78:90:12,[::2]
> > +or for both:
> > +.B --dhcp-host=11:22:33:44:55:66,12:34:56:78:90:12,192.168.0.2,[::2]
> > +This allows an IPv4 and/or IPv6 address to be associated with
> >  multiple hardware addresses, and gives dnsmasq permission to abandon a
> >  DHCP lease to one of the hardware addresses when another one asks for
> >  a lease. Beware that this is a dangerous thing to do, it will only
> > diff --git a/src/rfc3315.c b/src/rfc3315.c
> > index a20776d..c83cf2d 100644
> > --- a/src/rfc3315.c
> > +++ b/src/rfc3315.c
> > @@ -54,7 +54,7 @@ static struct prefix_class 
> > *prefix_class_from_context(struct dhcp_context *conte
> >  #endif
> >  static void mark_context_used(struct state *state, struct in6_addr *addr);
> >  static void mark_config_used(struct dhcp_context *context, struct in6_addr 
> > *addr);
> > -static int check_address(struct state *state, struct in6_addr *addr);
> > +static int check_address(struct state *state, struct dhcp_config *config, 
> > struct in6_addr *addr);
> >  static void add_address(struct state *state, struct dhcp_context *context, 
> > unsigned int lease_time, void *ia_option, 
> > unsigned int *min_time, struct in6_addr *addr, time_t 
> > now);
> >  static void update_leases(struct state *state, struct dhcp_context 
> > *context, struct in6_addr *addr, unsigned int lease_time, time_t now);
> > @@ -746,7 +746,7 @@ static int dhcp6_no_relay(struct state *state, int 
> > msg_type, void *inbuff, size_
> > /* If the client asks for an address on the same network as 
> > a configured address, 
> >offer the configured address instead, to make moving to 
> > newly-configured
> >addresses automatic. */
> > -   if (!(c->flags & CONTEXT_CONF_USED) && config_valid(config, 
> > c, ) && check_address(state, ))
> > +   if (!(c->flags & CONTEXT_CONF_USED) && config_valid(config, 
> > c, ) && check_address(state, config, ))
> >   {
> > req_addr = addr;
> > mark_config_used(c, );
> > @@ -755,8 +755,14 @@ static int dhcp6_no_relay(struct state *state, int 
> > msg_type, void *inbuff, size_
> >   }
> > else if (!(c = address6_available(state->context, 
> > _addr, solicit_tags, plain_range)))
> >   continue; /* not an address we're allowed */
> > -   else if 

Re: [Dnsmasq-discuss] [PATCH] DHCPv6: Honor assigning IPv6 address based on MAC address

2019-01-16 Thread Pali Rohár
On Sunday 13 January 2019 09:11:27 Roy Marples wrote:
> On 11/01/2019 16:52, Pali Rohár wrote:
> > Hello, can somebody look at this patch?
> > 
> > I remember that more people asked for ability to assign IPv6 address
> > based on MAC address specified in config file, rather then IAID/DUID.
> 
> ...
> 
> > > Also this patch adds support for allowing IPv6 address to be associated
> > > with multiple hardware addresses, and gives dnsmasq permission to abandon 
> > > a
> > > lease. This is similar functionality as already supported for IPv4 
> > > address.
> 
> Can we get this by itself first?

Hehe, no :-)

Support for above feature is just side effect of assigning IPv6 address
for MAC address if MAC address was specified in config file.

Basically after this patch, assigning based on MAC address started
working and therefore code which already handles assigning IP(v4)
address for MAC address handles it for IPv6 too.

-- 
Pali Rohár
pali.ro...@gmail.com


signature.asc
Description: PGP signature
___
Dnsmasq-discuss mailing list
Dnsmasq-discuss@lists.thekelleys.org.uk
http://lists.thekelleys.org.uk/mailman/listinfo/dnsmasq-discuss


Re: [Dnsmasq-discuss] [PATCH] DHCPv6: Honor assigning IPv6 address based on MAC address

2019-01-16 Thread Geert Stappers
On Sun, Jan 13, 2019 at 09:11:27AM +, Roy Marples wrote:
> On 11/01/2019 16:52, Pali Rohár wrote:
> > Hello, can somebody look at this patch?
> > 
> > I remember that more people asked for ability to assign IPv6 address
> > based on MAC address specified in config file, rather then IAID/DUID.
> 
> ...
> 
> > > Also this patch adds support for allowing IPv6 address to be associated
> > > with multiple hardware addresses, and gives dnsmasq permission to abandon 
> > > a
> > > lease. This is similar functionality as already supported for IPv4 
> > > address.
> 
> Can we get this by itself first? We should have this ability with DUID at
> least to match ISC dhcpd behaviour - and to be pinickity, IAID + type as
> well (IAID of 1 for example is different for IA_NA and IA_PD).
> 
> Then we can look at MAC address assignment as a smaller and later patch.
> 

Spilting a problem in smaller ones is a good thing.
Sending in small patches also.


Cheers
Geert Stappers
-- 
Rejecting patches is much better for a project than ignoring patches.

___
Dnsmasq-discuss mailing list
Dnsmasq-discuss@lists.thekelleys.org.uk
http://lists.thekelleys.org.uk/mailman/listinfo/dnsmasq-discuss


Re: [Dnsmasq-discuss] [PATCH] DHCPv6: Honor assigning IPv6 address based on MAC address

2019-01-13 Thread Roy Marples

On 11/01/2019 16:52, Pali Rohár wrote:

Hello, can somebody look at this patch?

I remember that more people asked for ability to assign IPv6 address
based on MAC address specified in config file, rather then IAID/DUID.


...


Also this patch adds support for allowing IPv6 address to be associated
with multiple hardware addresses, and gives dnsmasq permission to abandon a
lease. This is similar functionality as already supported for IPv4 address.


Can we get this by itself first? We should have this ability with DUID 
at least to match ISC dhcpd behaviour - and to be pinickity, IAID + type 
as well (IAID of 1 for example is different for IA_NA and IA_PD).


Then we can look at MAC address assignment as a smaller and later patch.

Roy

___
Dnsmasq-discuss mailing list
Dnsmasq-discuss@lists.thekelleys.org.uk
http://lists.thekelleys.org.uk/mailman/listinfo/dnsmasq-discuss


Re: [Dnsmasq-discuss] [PATCH] DHCPv6: Honor assigning IPv6 address based on MAC address

2019-01-11 Thread Pali Rohár
Hello, can somebody look at this patch?

I remember that more people asked for ability to assign IPv6 address
based on MAC address specified in config file, rather then IAID/DUID.

On Monday 17 December 2018 18:41:09 Pali Rohár wrote:
> Currently IPv6 addresses are assigned to tuple (IAID, DUID). When system
> changes IAID/DUID then old assigned IPv6 address cannot be reused, even
> when in config file was DHCPv6 assignment based on MAC address (and not on
> DUID).
> 
> IAID/DUID is changed when rebooting from one operating system to another;
> or after reinstalling system. In reality it is normal that DUID of some
> machine is changed, so people rather assign also IPv6 addresses based on
> MAC address.
> 
> So assigning IPv6 based on MAC address in dnsmasq is currently semi-broken.
> 
> This patch tries to fix it and honors IPv6 config rules with MAC address,
> to always assign particular IPv6 address to specific MAC address (when
> configured). And ignores the fact if IAID/DUID was changed.
> 
> Normally IPv6 address should be assigned by IAID/DUID (which also state
> DHCPv6 RFCs), but dnsmasq has already some support for assigning IPv6
> address based on MAC address, when users configured in config file.
> 
> So this patch just tries to fix above problem for user configuration with
> MAC addresses. It does not change assignment based on DUID.
> 
> Also this patch adds support for allowing IPv6 address to be associated
> with multiple hardware addresses, and gives dnsmasq permission to abandon a
> lease. This is similar functionality as already supported for IPv4 address.
> ---
>  man/dnsmasq.8 |  9 ++---
>  src/rfc3315.c | 62 
> ++-
>  2 files changed, 59 insertions(+), 12 deletions(-)
> 
> diff --git a/man/dnsmasq.8 b/man/dnsmasq.8
> index f01a5ba..8614f08 100644
> --- a/man/dnsmasq.8
> +++ b/man/dnsmasq.8
> @@ -1068,10 +1068,13 @@ will only match a
>  Token-Ring hardware address, since the ARP-address type for token ring
>  is 6. 
>  
> -As a special case, in DHCPv4, it is possible to include more than one
> -hardware address. eg:
> +It is possible to include more than one hardware address. eg for IPv4:
>  .B --dhcp-host=11:22:33:44:55:66,12:34:56:78:90:12,192.168.0.2
> -This allows an IP address to be associated with
> +or for IPv6:
> +.B --dhcp-host=11:22:33:44:55:66,12:34:56:78:90:12,[::2]
> +or for both:
> +.B --dhcp-host=11:22:33:44:55:66,12:34:56:78:90:12,192.168.0.2,[::2]
> +This allows an IPv4 and/or IPv6 address to be associated with
>  multiple hardware addresses, and gives dnsmasq permission to abandon a
>  DHCP lease to one of the hardware addresses when another one asks for
>  a lease. Beware that this is a dangerous thing to do, it will only
> diff --git a/src/rfc3315.c b/src/rfc3315.c
> index a20776d..c83cf2d 100644
> --- a/src/rfc3315.c
> +++ b/src/rfc3315.c
> @@ -54,7 +54,7 @@ static struct prefix_class 
> *prefix_class_from_context(struct dhcp_context *conte
>  #endif
>  static void mark_context_used(struct state *state, struct in6_addr *addr);
>  static void mark_config_used(struct dhcp_context *context, struct in6_addr 
> *addr);
> -static int check_address(struct state *state, struct in6_addr *addr);
> +static int check_address(struct state *state, struct dhcp_config *config, 
> struct in6_addr *addr);
>  static void add_address(struct state *state, struct dhcp_context *context, 
> unsigned int lease_time, void *ia_option, 
>   unsigned int *min_time, struct in6_addr *addr, time_t 
> now);
>  static void update_leases(struct state *state, struct dhcp_context *context, 
> struct in6_addr *addr, unsigned int lease_time, time_t now);
> @@ -746,7 +746,7 @@ static int dhcp6_no_relay(struct state *state, int 
> msg_type, void *inbuff, size_
>   /* If the client asks for an address on the same network as 
> a configured address, 
>  offer the configured address instead, to make moving to 
> newly-configured
>  addresses automatic. */
> - if (!(c->flags & CONTEXT_CONF_USED) && config_valid(config, 
> c, ) && check_address(state, ))
> + if (!(c->flags & CONTEXT_CONF_USED) && config_valid(config, 
> c, ) && check_address(state, config, ))
> {
>   req_addr = addr;
>   mark_config_used(c, );
> @@ -755,8 +755,14 @@ static int dhcp6_no_relay(struct state *state, int 
> msg_type, void *inbuff, size_
> }
>   else if (!(c = address6_available(state->context, 
> _addr, solicit_tags, plain_range)))
> continue; /* not an address we're allowed */
> - else if (!check_address(state, _addr))
> + else if (!check_address(state, config, _addr))
> continue; /* address leased elsewhere */
> + else if (state->mac_len && config &&
> +  

[Dnsmasq-discuss] [PATCH] DHCPv6: Honor assigning IPv6 address based on MAC address

2018-12-17 Thread Pali Rohár
Currently IPv6 addresses are assigned to tuple (IAID, DUID). When system
changes IAID/DUID then old assigned IPv6 address cannot be reused, even
when in config file was DHCPv6 assignment based on MAC address (and not on
DUID).

IAID/DUID is changed when rebooting from one operating system to another;
or after reinstalling system. In reality it is normal that DUID of some
machine is changed, so people rather assign also IPv6 addresses based on
MAC address.

So assigning IPv6 based on MAC address in dnsmasq is currently semi-broken.

This patch tries to fix it and honors IPv6 config rules with MAC address,
to always assign particular IPv6 address to specific MAC address (when
configured). And ignores the fact if IAID/DUID was changed.

Normally IPv6 address should be assigned by IAID/DUID (which also state
DHCPv6 RFCs), but dnsmasq has already some support for assigning IPv6
address based on MAC address, when users configured in config file.

So this patch just tries to fix above problem for user configuration with
MAC addresses. It does not change assignment based on DUID.

Also this patch adds support for allowing IPv6 address to be associated
with multiple hardware addresses, and gives dnsmasq permission to abandon a
lease. This is similar functionality as already supported for IPv4 address.
---
 man/dnsmasq.8 |  9 ++---
 src/rfc3315.c | 62 ++-
 2 files changed, 59 insertions(+), 12 deletions(-)

diff --git a/man/dnsmasq.8 b/man/dnsmasq.8
index f01a5ba..8614f08 100644
--- a/man/dnsmasq.8
+++ b/man/dnsmasq.8
@@ -1068,10 +1068,13 @@ will only match a
 Token-Ring hardware address, since the ARP-address type for token ring
 is 6. 
 
-As a special case, in DHCPv4, it is possible to include more than one
-hardware address. eg:
+It is possible to include more than one hardware address. eg for IPv4:
 .B --dhcp-host=11:22:33:44:55:66,12:34:56:78:90:12,192.168.0.2
-This allows an IP address to be associated with
+or for IPv6:
+.B --dhcp-host=11:22:33:44:55:66,12:34:56:78:90:12,[::2]
+or for both:
+.B --dhcp-host=11:22:33:44:55:66,12:34:56:78:90:12,192.168.0.2,[::2]
+This allows an IPv4 and/or IPv6 address to be associated with
 multiple hardware addresses, and gives dnsmasq permission to abandon a
 DHCP lease to one of the hardware addresses when another one asks for
 a lease. Beware that this is a dangerous thing to do, it will only
diff --git a/src/rfc3315.c b/src/rfc3315.c
index a20776d..c83cf2d 100644
--- a/src/rfc3315.c
+++ b/src/rfc3315.c
@@ -54,7 +54,7 @@ static struct prefix_class *prefix_class_from_context(struct 
dhcp_context *conte
 #endif
 static void mark_context_used(struct state *state, struct in6_addr *addr);
 static void mark_config_used(struct dhcp_context *context, struct in6_addr 
*addr);
-static int check_address(struct state *state, struct in6_addr *addr);
+static int check_address(struct state *state, struct dhcp_config *config, 
struct in6_addr *addr);
 static void add_address(struct state *state, struct dhcp_context *context, 
unsigned int lease_time, void *ia_option, 
unsigned int *min_time, struct in6_addr *addr, time_t 
now);
 static void update_leases(struct state *state, struct dhcp_context *context, 
struct in6_addr *addr, unsigned int lease_time, time_t now);
@@ -746,7 +746,7 @@ static int dhcp6_no_relay(struct state *state, int 
msg_type, void *inbuff, size_
/* If the client asks for an address on the same network as 
a configured address, 
   offer the configured address instead, to make moving to 
newly-configured
   addresses automatic. */
-   if (!(c->flags & CONTEXT_CONF_USED) && config_valid(config, 
c, ) && check_address(state, ))
+   if (!(c->flags & CONTEXT_CONF_USED) && config_valid(config, 
c, ) && check_address(state, config, ))
  {
req_addr = addr;
mark_config_used(c, );
@@ -755,8 +755,14 @@ static int dhcp6_no_relay(struct state *state, int 
msg_type, void *inbuff, size_
  }
else if (!(c = address6_available(state->context, 
_addr, solicit_tags, plain_range)))
  continue; /* not an address we're allowed */
-   else if (!check_address(state, _addr))
+   else if (!check_address(state, config, _addr))
  continue; /* address leased elsewhere */
+   else if (state->mac_len && config &&
+config_has_mac(config, state->mac, state->mac_len, 
state->mac_type) &&
+match_netid(c->filter, solicit_tags, plain_range) 
&&
+config_valid(config, c, ) &&
+!IN6_ARE_ADDR_EQUAL(_addr, ))
+ continue; /* another static address is configured */

/* add