The attached patch adds support for RFC 3442 (the Classless Static Route Option for DHCP) to udhcpc. The majority of it was taken from the default.script file for OpenWRT [1]. This patch has been tested and confirmed to work on my setup (DHCP server sending option 121 to set a static route for a gateway outside the subnet). It's worth noting that per the RFC, we must also request this parameter from the DHCP server. This patch does not add support for that, so update_classless_routes() would only run if a DHCP server forced the parameter. DHCP clients that support this option and that send a DHCP Parameter Request List option MUST request both this option and the Router option in the DHCP Parameter Request List. It looks like a possible place to request the option would be in /lib/netifrc/net/udhcpc.sh, although I feel there is likely a better place for it. [1] https://github.com/openwrt-mirror/openwrt/blob/master/package/network/config/netifd/files/usr/share/udhcpc/default.script Reproducible: Always Steps to Reproduce: 1. Configure DHCP server to send option 121 (Classless Static Route) 2. Boot Gentoo and have udhcpc request an IP address 3. Observe that option 121 is ignored, even when the DHCP server forces the option to be sent. Actual Results: Static route was ignored. Expected Results: Static route was processed and added to routing table.
Created attachment 385842 [details, diff] Patch for RFC 3442 support in udhcpc script
[master 8a92e2a] sh/udhcpc-hook.sh: classless static routes 1 file changed, 25 insertions(+), 1 deletion(-)