summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDan Williams <dcbw@redhat.com>2013-11-20 13:40:07 -0600
committerDan Williams <dcbw@redhat.com>2013-11-20 14:24:38 -0600
commit799477872394a5e473cb868e8c3ae2ba5fff7f50 (patch)
treee818da8314cd796c3967e1d16abe05fd67e49d08
parent46a7760ead2841d0a8ad5468bae8042b44af7aa2 (diff)
downloadNetworkManager-799477872394a5e473cb868e8c3ae2ba5fff7f50.tar.gz
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
-rw-r--r--src/devices/nm-device.c16
1 files changed, 11 insertions, 5 deletions
diff --git a/src/devices/nm-device.c b/src/devices/nm-device.c
index cc678ce44a..832a959304 100644
--- a/src/devices/nm-device.c
+++ b/src/devices/nm-device.c
@@ -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);
+ }
}
}