core: ignore RA-provided default routes (rh #1029213)

The router has no idea what the local configuration or user preferences are,
so sending routes with a prefix length of 0 is at best misinformed and at
worst breaks things.  The kernel also ignores plen=0 routes in its in-kernel
RA processing code in net/ipv6/ndisc.c.

https://bugzilla.redhat.com/show_bug.cgi?id=1029213
This commit is contained in:
Dan Williams 2013-11-20 13:40:07 -06:00
parent 46a7760ead
commit 7994778723

View file

@ -3287,12 +3287,18 @@ rdisc_config_changed (NMRDisc *rdisc, NMRDiscConfigMap changed, NMDevice *device
NMRDiscRoute *discovered_route = &g_array_index (rdisc->routes, NMRDiscRoute, i);
NMPlatformIP6Route route;
memset (&route, 0, sizeof (route));
route.network = discovered_route->network;
route.plen = discovered_route->plen;
route.gateway = discovered_route->gateway;
/* Only accept non-default routes. The router has no idea what the
* local configuration or user preferences are, so sending routes
* with a prefix length of 0 is quite rude and thus ignored.
*/
if (discovered_route->plen > 0) {
memset (&route, 0, sizeof (route));
route.network = discovered_route->network;
route.plen = discovered_route->plen;
route.gateway = discovered_route->gateway;
nm_ip6_config_add_route (priv->ac_ip6_config, &route);
nm_ip6_config_add_route (priv->ac_ip6_config, &route);
}
}
}