Re: [Dnsmasq-discuss] dnsmasq dhcp range

2018-05-18 Thread Yuki Nisiwaki
Hi

I was the one who was trying to do but actually there is no magic code to
specify full range but you can use multiple /1 dhcp-range 128.0.0.0/1 and
0.0.0.0/1 to achieve same thing.

Regards

Yuki Nishiwaki

On Fri, May 18, 2018 at 21:41 Lindgren Fredrik 
wrote:

> Hi,
>
>
> Is there any way to configure dhcp of dnsmasq to use full ipv4 range
> (ip+netmask) of interface given in config file as it dhcp-range?
>
>
> Br,
>
> Fredrik
> ___
> 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] Allow specifying a 0.0.0.0 netmask in dhcp-range for relays.

2018-03-12 Thread Yuki Nisiwaki
Hello Nicolas

I missed this point.Thanks.
> dhcp-option=option:netmask,255.255.0.0 anyway.

But as you already mentioned, still I have to specify at least 2 dhcp-range
with /1 to cover all subnets since dnsmasq doesn't consider netmask 0 we
intentionally specified.
your patch seems good to me. I hope your patch will be in upstream before
long.

Yuki Nishiwaki


On 12 March 2018 at 18:26, Nicolas Cavallari <
nicolas.cavall...@green-communications.fr> wrote:

> When using a DHCP relay, the netmask in dhcp-range is matched against
> giaddr (or the link selection suboption) to determine on which range the
> address should be allocated.
>
> However, in some cases, you want to ignore this mechanism, because your
> relay, clients and your DHCP server are not in the same subnet, the
> relay do not have addresses on their client interfaces and/or you have
> more complicated matching in place (e.g.  other relay agent information
> suboptions).
>
> The link selection suboption would be a good candidate but this requires
> a duplicate policy/configuration in every relay that matches what the
> DHCP server would select.
>
> Specifying 0.0.0.0 as a netmask is accepted by the parser but is
> rejected by a condition in rfc2131.c, that only checks if
> netmask.s_addr = 0, which can happen if the guessing failed, but can
> also happen if 0.0.0.0 was explicitly specified.
>
> This fixes the condition so that netmask.s_addr = 0 is acceptable
> if it was specified in the configuration.  i.e.  if the
> dhcp context (the considered dhcp range) has the CONTEXT_NETMASK
> flag.
>
> The netmask to be sent to the client can be set with
> dhcp-option=option:netmask,255.255.0.0 anyway.
> ---
> Yuki Nisiwaki's message reminded me of this patch that I use but forgot
> about.
>
>  src/rfc2131.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/src/rfc2131.c b/src/rfc2131.c
> index c08a8ab..6b2df35 100644
> --- a/src/rfc2131.c
> +++ b/src/rfc2131.c
> @@ -319,7 +319,7 @@ size_t dhcp_reply(struct dhcp_context *context, char
> *iface_name, int int_index,
>
> /* This section fills in context mainly when a client which is
> on a remote (relayed)
>network renews a lease without using the relay, after
> dnsmasq has restarted. */
> -   if (netmask.s_addr != 0  &&
> +   if ((netmask.s_addr != 0 || context_tmp->flags &
> CONTEXT_NETMASK) &&
> is_same_net(addr, context_tmp->start, netmask) &&
> is_same_net(addr, context_tmp->end, netmask))
>   {
> --
> 2.16.2
>
>
> ___
> 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


[Dnsmasq-discuss] Is there any use case for "--dhcp-range=0.0.0.0, static, 0.0.0.0" to support all subnet

2018-03-12 Thread Yuki Nisiwaki
Hi dnsmasq guys.

I'm Yuki Nishiwaki.
Recently I started to work on dnsmasq stuff. I could ask stupid thing
though I want to ask if anyone think the same thing as me.

I'm using dnsmasq under cloud controller and dnsmasq have responsibility to
lease IP for
our all virtual machines connected to Host via tap on the same host running
dnsmasq.

In order to do that, I had to specify same number of --dhcp-range as the
number of subnet VM belong to but
we can not add dynamically "--dhcp-range" and I don't wanna restart
everytime new subnet added.

So I was going to specify "--dhcp-range=0.0.0.0,static,0.0.0.0"  or
"--dhcp-range=0.0.0.0,static,128.0.0.0,
--dhcp-range=128.0.0.0,static,128.0.0.0" to
support all subnets possibly will be added in the future and lease IP for
only known client.
It kind of worked but the netmask of leased IP was the same as dhcp-range
specified(/1).
I expected the netmask will be got from the NIC receiving DHCP request and
dhcp-range's netmask is only used for judging if dnsmasq should reply or
not.

After read the code around
https://github.com/imp/dnsmasq/blob/master/src/dhcp.c#L501-L561, I
understood why I can not.
But If there is any chance I can add new option or other behaviour to cover
my usecase
so that dnsmasq can use the netmask of NIC's IP receiving DHCP request for
the IP to be leased while the netmask dhcp-range specified is used to judge
whether
dnsmasq should reply or not, I'm willing to write the patch but
beforehand I want to ask what do you think about such additional change. Is
this good approach, feature or bad approach, feature nobody want but me?


Regards

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