dhcpcd icon indicating copy to clipboard operation
dhcpcd copied to clipboard

dhcpcd not ignoring source-based routes on linux

Open sshambar opened this issue 4 months ago • 3 comments

I'm using ipv6 source-based routing on a machine with multiple WANs. I'm adding routes for each delegated subnet to their respective WAN interface, eg:

# ip -6 route show
default from <DELEGATED-SUBNET> via <GATEWAY> dev <WAN-DEV> ...

However, dhcpcd on the WAN doesn't parse the RTA_SRC route attribute, so it adds the route to it's internal kernel route list as the "default route" - the net effect being that if the upstream router removes and adds back the real default route (eg. ISP goes down momentarily), dhcpcd will think these source-routes are existing kernel default routes, and won't add the new default route back.

This simple pull request patches if-linux.c to parse the RTA_SRC attribute for a "specified" route and ignores the route, after which dhcpcd behaves correctly.

I haven't modified the code for other platforms as I'm not sure how/if they support source-based routing :)

Please feel free to use a totally different method to exclude source routes if you feel this is "kludgy"...

sshambar avatar Sep 26 '24 22:09 sshambar