[Dnsmasq-discuss] Re: negated network-ids (Re: dhcp: mac address as "range selector"?)

Lutz Pressler Lutz at Pressler.DE
Sat Feb 18 13:22:58 GMT 2006


Hello again,

I wrote:
> I read that, tested - and then interpreted "#" as being only relevant
> in dhcp-option (btw, there is a typo --dhcp=option=#purple...).
> I have not tried dhcp-boot and dhcp-ignore, but
> > 
> > dhcp-range=net:#tel,192.168.169.80,192.168.169.99,255.255.255.0,12h
> has the consequence that tel devices don't get those addresses -
> but non-tel (no network-id) ones don't either (like # is interpreted
> literally). 
> > 
The problem only occurs when the requesting device has no network-id
at all associated. Debugging shows that then match_netid is not
called at all.
dhcp.c:address_allocate is incorrect, I think.

  for (c = context; c; c = c->current)
    if (c->flags & CONTEXT_STATIC)
      continue;
    else if (netids && !(c->flags & CONTEXT_FILTER))
      continue;
    else if (!netids && (c->flags & CONTEXT_FILTER))
      continue;
    else if (netids && (c->flags & CONTEXT_FILTER) && !match_netid(&c->netid, netids))
      continue;
    else
...

Why is !netids and netids differentiated in the case of CONTEXT_FILTER set?
Maybe this can simply be changed to

  for (c = context; c; c = c->current)
    if (c->flags & CONTEXT_STATIC)
      continue;
    else if (netids && !(c->flags & CONTEXT_FILTER))
      continue;
    else if ((c->flags & CONTEXT_FILTER) && !match_netid(&c->netid, netids))
      continue;
    else
...

? The logic within match_netid seems to be correct - and a first test
worked out fine for me.


Lutz

-- 
Lutz Preßler, Göttingen, Germany



More information about the Dnsmasq-discuss mailing list