GNOME Bugzilla – Bug 761268
default route not added from dhcp option 121 (classless-static-routes)
Last modified: 2016-02-15 23:16:51 UTC
I run an OpenBSD 5.8 DHCP server that hands out 3 routes via dhcp option 121 (classless-static-routes). The default gateway is one of these routes and is handed out as 0.0.0.0/0. It works fine on CentOS 6 and 7 with NetworkManager 1.0.6. NM 1.0.10 (Arch) configures everything correctly except for the default gateway. The log message is the following: nm_ip4_config_add_route: assertion 'new->plen > 0' failed The DHCP offer looks fine in a packet tracer. I wasn't able to reproduce the issue with 2 VMs and the same software versions. The dhcpd.conf line looks like this (obfuscated the public IPs): option classless-static-routes 172.16.0.0/16 x.x.x.253, 10.0.0.0/8 x.x.x.253, 0.0.0.0/0 x.x.x.254;
(In reply to Uwe Helm from comment #0) > I run an OpenBSD 5.8 DHCP server that hands out 3 routes via dhcp option 121 > (classless-static-routes). The default gateway is one of these routes and is > handed out as 0.0.0.0/0. It works fine on CentOS 6 and 7 with NetworkManager > 1.0.6. > > NM 1.0.10 (Arch) configures everything correctly except for the default > gateway. > > The log message is the following: > > > nm_ip4_config_add_route: assertion 'new->plen > 0' failed that the assertion is hit is a bug. Nonetheless, NM doesn't accept a default route (i.e. one with prefix length zero) via a option 33 nor 121. Instead it only allows specifying it as router (dhcp option 3). Strange if it worked in 1.0.6. Your DHCP server configuration didn't change? > The DHCP offer looks fine in a packet tracer. I wasn't able to reproduce the > issue with 2 VMs and the same software versions. > > > The dhcpd.conf line looks like this (obfuscated the public IPs): > option classless-static-routes 172.16.0.0/16 x.x.x.253, 10.0.0.0/8 > x.x.x.253, 0.0.0.0/0 x.x.x.254; You did configure "ipv4.never-default" as "no", right? Check with `nmcli connection show $ID`. What DHCP plugin are you using? (configured in /etc/NetworkManager/NetworkManager.conf or conf.d).
(In reply to Thomas Haller from comment #1) > (In reply to Uwe Helm from comment #0) > > I run an OpenBSD 5.8 DHCP server that hands out 3 routes via dhcp option 121 > > (classless-static-routes). The default gateway is one of these routes and is > > handed out as 0.0.0.0/0. It works fine on CentOS 6 and 7 with NetworkManager > > 1.0.6. > > > > NM 1.0.10 (Arch) configures everything correctly except for the default > > gateway. > > > > The log message is the following: > > > > > > nm_ip4_config_add_route: assertion 'new->plen > 0' failed > > that the assertion is hit is a bug. > > Nonetheless, NM doesn't accept a default route (i.e. one with prefix length > zero) via a option 33 nor 121. > > Instead it only allows specifying it as router (dhcp option 3). > > > Strange if it worked in 1.0.6. Your DHCP server configuration didn't change? I have 25 CentOS 7 (NM 1.0.6) clients connected and the default route works fine for them. Only my NM 1.0.10 has this issue. > > > > The DHCP offer looks fine in a packet tracer. I wasn't able to reproduce the > > issue with 2 VMs and the same software versions. > > > > > > The dhcpd.conf line looks like this (obfuscated the public IPs): > > option classless-static-routes 172.16.0.0/16 x.x.x.253, 10.0.0.0/8 > > x.x.x.253, 0.0.0.0/0 x.x.x.254; > > You did configure "ipv4.never-default" as "no", right? Check with `nmcli > connection show $ID`. I didn't configure it but it shows as "no". > > What DHCP plugin are you using? (configured in > /etc/NetworkManager/NetworkManager.conf or conf.d). It's "dhcp=internal" on my machine. For the CentOS 7 machines there is no "dhcp=" option, but "plugins=ifcfg-rh" and it uses dhclient. That probably explains why it's working on those machines.
Was able to test it today and "dhcp=dhclient" works for the default route. NetworkManager[15479]: <info> gateway x.x.x.254 NetworkManager[15479]: <info> classless static route 10.0.0.0/8 gw x.x.x.253 NetworkManager[15479]: <info> classless static route 172.16.0.0/16 gw x.x.x.253
I think this is a bug in the internal DHCP client implementation, which should handle a default (0/0) route in the "classless static routes" option as a gateway. In fact, this is the only way possible to provide a default gateway when option 121 is used, since RFC 3442 states: If the DHCP server returns both a Classless Static Routes option and a Router option, the DHCP client MUST ignore the Router option. We should fix this.
Created attachment 321235 [details] [review] dhcp/systemd: accept default gateway in classless static routes option
nm_log_info (LOGD_DHCP4, "ignoring duplicate default classless static route"); I'm not sure we should log something like that because it can be triggered externally and flood the log. I would just silently ignore it. static_default_gateway = TRUE; nm_ip4_config_set_gateway (ip4_config, route.gateway); if route.gateway is 0.0.0.0, we add an on-link route. Is that a valid setting? Maybe zero default-gateways should be rejected? Otherwise lgtm
(In reply to Thomas Haller from comment #6) > I'm not sure we should log something like that because it can be triggered > externally and flood the log. I would just silently ignore it. Ok, dropped the message. > if route.gateway is 0.0.0.0, we add an on-link route. Is that a valid > setting? Maybe zero default-gateways should be rejected? This is explicitly allowed by RFC 3442, to provide a way for the server to deliver link routes when the client belongs to multiple subnets. Merged to master: https://cgit.freedesktop.org/NetworkManager/NetworkManager/commit/?id=0f5c5ad44692d029eec60cdc7d8783b51ede59bb