Linux interface discovery (patch)
Jiri Popelka
jpopelka at redhat.com
Wed May 16 13:20:48 UTC 2012
On 06/15/2011 07:12 AM, Glenn Maynard wrote:
> 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 (10.0.0.1), 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 (24.62.196.44).
> Jun 14 17:36:30 zewt dhcpd: ** Ignoring requests on eth0. If this is
> not what
> 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
> segment
> 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.
That's what the getifaddrs() function is good for. It works the same
as on *BSD and OS X so the Linux interface discovery code can be removed
at all, see the attached patch.
This patch has been part of Fedora (Linux distro) for some time and
I haven't seen any problems so far.
I also sent it to dhcp-bugs and it has ID [ISC-Bugs #28761].
--
Jiri
> 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 http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=590641
> and http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=605657.
>
> Patch is against 4.2.1-P1; I couldn't seem to find any version control.
>
> --
> Glenn Maynard
-------------- next part --------------
A non-text attachment was scrubbed...
Name: dhcp-4.2.3-P2-getifaddrs.patch
Type: text/x-patch
Size: 10529 bytes
Desc: not available
URL: <https://lists.isc.org/pipermail/dhcp-hackers/attachments/20120516/00c86e12/attachment.bin>
More information about the dhcp-hackers
mailing list