[Dnsmasq-discuss] Requested address bypasses netids

Simon Kelley simon at thekelleys.org.uk
Tue Nov 13 17:07:09 GMT 2007


Cédric Duval wrote:
> Hi,
> 
> whenever a client sends a DISCOVER and uses the option 50 to
> request an IP address (and provided a dhcp-host clause or an
> existing lease did not match before), he is granted this
> address if it is valid for a context, regardless of the
> netids.
> 
>>From rfc2131.c:714,
>  else if (opt && address_available(context, addr)
>    && !lease_find_by_addr(addr)
>    && !config_find_by_address(daemon->dhcp_conf, addr))
>    mess->yiaddr = addr;
> 
> I have a 'default' range and a range matching a netid, let's say:
>   dhcp-range=192.168.1.11,192.168.1.200,1h
>   dhcp-range=net:net1,192.168.1.201,192.168.1.210,1h
> 
> Now, if I have a client matching 'net1' (through setting one vendor
> option), two cases:
>  - the client does not use the option 50, then everything is
>    fine: an address is given from the net1 context.
>  - the client uses the option 50 to request an address within
>    the 'default' range, and... he gets what he asks for.
>    Which is not fine IMHO, since the context which matches the
>    netid should have the priority over the one without a netid.
> 

Note that a dhcp-range without a netid is still valid, even when the
netid of another range is matched. dnsmasq favours matching ranges, but
it will still use the 11--200 range for hosts which match the netid, if
the 201--210 range is full, for instance.

You probably want this config

dhcp-range=net:#net1,192.168.1.11,192.168.1.200,1h
dhcp-range=net:net1,192.168.1.201,192.168.1.210,1h

Which means that the 201-210 range is never used when netid net1 is set.

BUT, looking at the code, the bug does exist, even with that
configuration. I'll create a fix ASAP.

Cheers,

Simon.



More information about the Dnsmasq-discuss mailing list