Patch: Fix renewals, releases sent from wrong source address on multihomed/VPN hosts

Thor Simon Thor.Simon at twosigma.com
Tue Apr 28 00:19:36 UTC 2020


I have a population of systems which use dhclient on their physical interfaces for DHCP, but otherwise perform essentially no local network traffic.  The interface coming up triggers (via NetworkManager, not the dhclient scripts) creation of an IPsec tunnel, which uses a 'vti' interface which itself receives a separate address via IKE.  The machines run Debian Stretch.

This effectively creates a multihomed host configuration where dhclient is operating on a different interface than the one used by the default route.  If you search the lists you'll find a scattering of reports going back over a decade that dhclient intermittently sends messages from the wrong interface's source address on such hosts.  This got to be enough of a nuisance (I ran into a non-ISC DHCP server which not only NAKed such requests, it blacklisted the client!) that I finally root-caused the issue.

The problem is caused by inappropriate use of the "fallback" send mechanism when the message in question need not be routed.  According to the block comment in osdep.h which appears to be the only documentation:

/* Porting::

   If you add support for sending packets directly out an interface,
   and your support does not do ARP or routing, you must use a fallback
   mechanism to deal with packets that need to be sent to routers.
   Currently, all low-level packet interfaces use BSD sockets as a
   fallback. */

However, what dhclient.c actually does is this, in both the REQUEST and RELEASE cases:

        if (destination.sin_addr.s_addr != INADDR_BROADCAST &&
            fallback_interface) {
                result = send_packet(fallback_interface, [...]

In other words, don't bother actually checking if the destination is on a local network, send all unicast traffic via the fallback interface.  The fallback interface doesn't have a bound address so we are effectively sending from 0.0.0.0 and the system routing machinery may do with us what it will.  Such as select an inappropriate source address which does not match the client-ip in the lease and freak out the DHCP server.

The attached diff, which is against Debian's patched 4.3.5, seems to fix the issue.

Thor

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.isc.org/pipermail/dhcp-users/attachments/20200428/719823ac/attachment.htm>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: sane-fallback.patch
Type: application/octet-stream
Size: 4511 bytes
Desc: sane-fallback.patch
URL: <https://lists.isc.org/pipermail/dhcp-users/attachments/20200428/719823ac/attachment.obj>


More information about the dhcp-users mailing list