[Dnsmasq-discuss] [PATCH] Set reply interface in unicast DHCP reply under Linux

Lung-Pin Chang changlp at cs.nctu.edu.tw
Wed Mar 18 16:09:46 GMT 2015


Hi folks,

Recently we are investigating an issue reported by one of our customer.

The problematic unit is a Linux-based box with dual ethernet ports,
and both of them are connected into

the same network with IPs manually configured within the same subnet
(say, 10.56.78.2/24 & 10.56.78.1/24).

Routing table on the box now looks like the following:
DiskStation> ip route
10.56.78.0/24 dev eth1  proto kernel  scope link  src 10.56.78.2
10.56.78.0/24 dev eth0  proto kernel  scope link  src 10.56.78.1

When we're trying to offer DHCP leases over eth0 (with
--bind-interfaces), the kernel picks the route via eth1,

causing mismatch in the IP header and DHCP server entries within the
DHCPACK packet.

The clients (we've tested dhclient 4.3.2) tossed this DHCPACK, hence
it would be unable to get any lease within the network.

As the kernel always prefer the first route in this multipath case
(see fib_get_table in include/net/ip_fib.h of kernel source),

it seems the proper way to mitigate this is to set the outbound
interface via cmsg,

as done in the broadcast in dhcp_packet() of dhcp.c.

I've consolidated the cmsg creation in bcast & ucast case into one, as
shown in [1],

and some quick tests with the patch proved it works with the case
mentioned above.

Would like to hear your comments of this patch via list, direct mail
or GitHub, thanks!

[1]: https://github.com/iamben/dnsmasq/commit/fbd4ff8ebc62bb9ddb9f186a7473087972439a7e

-- 
Lung-Pin Chang

Synology Inc.
www.synology.com



More information about the Dnsmasq-discuss mailing list