[Dnsmasq-discuss] preventing address allocation

Benjamin Collar benjamin.collar@siemens.com
Thu, 09 Jun 2005 12:37:14 +0200


Greetings folks

I've got a situation that I haven't found a great answer to so far, and
I was hoping you all could help.

We've got a set up like this:

host1: 
  eth0, eth1 are on the same physical lan-segment
  eth0 handles range 10.0.150.10-10.0.150.255
  eth1 handles range 10.128.150.10-10.128.150.255
  dnsmasq is configured like this (partially):

interface=eth0
interface=eth1
dhcp-range=10.0.150.10,10.0.150.255,12h
dhcp-range=10.128.150.10,10.128.150.255,12h
dhcp-host=id:CLIENT1,10.0.150.10,CLIENT1,45m
dhcp-host=id:CLIENT2,10.128.150.32,CLIENT2,45m

CLIENT1:
  MAC address is not sent as identifier, instead client-id is CLIENT1
 
CLIENT2:
  like CLIENT1

So the point is, client1 gets assigned a known address and so does
client2. All configuration is in one place. excellent.

So now let's say client1's dhcpcd starts and sends a UDP packet, asking
for a dhcp server and an address. The packet arrives at at eth0 and
dnsmasq says "yep, you're CLIENT1, here's your address." However, the
packet also arrives at eth1 and dnsmasq says, "that doesn't match any
context. Hmm. Here, CLIENT1, try this address" and allocates an unused
address from its allowed range for eth1.

And it's the second part that I want to disable. If a request comes to
an interface and the request is not recognized from the dhcp-host list,
dnsmasq should not allocate an unused address.

Can someone tell me how to stop it? I stopped it manually by changing
line ~ 411 from rfc2131.c:

else if (!address_allocate(context, daemon, &mess->yiaddr, mess->chaddr,
netid))
        message = "no address available";

to
 
else 
  message = "not allocating address"

But this is pretty hacky! Does anyone have a better suggestion?

Thank you very much
Ben



-- 
Benjamin Collar
Siemens AG
CT SE 2
Embedded Linux
089-636-53711