Linux interface discovery (patch)

Glenn Maynard glenn at
Wed Jun 15 05:12:41 UTC 2011

I'm hitting a failure in a seemingly basic case.  I have a dynamic address
(assigned by another DHCP server) on eth0 and a static address on eth0:0
(, and I want dhcpd to answer requests on the network eth0:0's IP
is on.  (There's no conflict with the DHCP server assigning eth0's address
on the same physical network; it only responds to that MAC address.)

This leads to:

Jun 14 17:36:30 zewt dhcpd: No subnet declaration for eth0 (
Jun 14 17:36:30 zewt dhcpd: ** Ignoring requests on eth0.  If this is not
Jun 14 17:36:30 zewt dhcpd:    you want, please write a subnet declaration
Jun 14 17:36:30 zewt dhcpd:    in your dhcpd.conf file for the network
Jun 14 17:36:30 zewt dhcpd:    to which interface eth0 is attached. **

I can't configure a subnet for that address; it would break if the external
IP changed.  It doesn't make sense, anyway: this address is unrelated to
dhcpd, so it shouldn't need to know about it.

Looking through the source, the problem is simple: the discovery code in
Linux only finds the first address for each interface.  I've rewritten the
discovery code to use netlink, so all addresses are properly discovered.
Each discovered address is returned individually by next_iface.  It needs
more testing than I can give it, but it works well for me.

Note that some configurations will need adjustment.  Without this patch,
shared-network can often be omitted without causing an error, because dhcpd
doesn't know that networks are on the same interface.  After this patch it
notices it, so people will start getting "Interface eth0 matches multiple
shared networks".  It looks like not showing this error was a bug; they just
need to add the necessary shared-network block.  (I assume that omitting
shared-network will cause other problems anyway, even if it's not printing
an error, or else it wouldn't be required.)

This should fix and

Patch is against 4.2.1-P1; I couldn't seem to find any version control.

Glenn Maynard
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: dhcp-linux-netlink.diff
Type: application/octet-stream
Size: 16585 bytes
Desc: not available
URL: <>

More information about the dhcp-hackers mailing list