diff options
author | Thomas Haller <thaller@redhat.com> | 2015-05-27 11:52:39 +0200 |
---|---|---|
committer | Thomas Haller <thaller@redhat.com> | 2015-05-27 12:19:12 +0200 |
commit | 767eefb7eb9214ac4dad490f34e7de3e2845848a (patch) | |
tree | d2c363a5411ab0576488838e7b2ebd746332795c | |
parent | 2fde3b958b36e9bb82862adbcd2e69f99f6221e4 (diff) | |
download | NetworkManager-767eefb7eb9214ac4dad490f34e7de3e2845848a.tar.gz |
default-route: also configure default-routes for assumed connectionsth/default-route-fixes-rh1205405
Previously for assumed connections we would never configure a default route.
That has serious problems in the following to scenarios:
- the default-route might have a limited lifetime from a previous
SLAAC/accept_ra setting. In this case, once we assume the connection
we must also ensure that we extend the lifetime of the default
route.
- the gateway could be received via DHCP/RA and it might change.
If we ignore default-routes for assumed connection we miss that
change.
The problem is that the notion of "assumed connection" wongly combines
two conflicting goals (related bug bgo#746440):
a) have an external device that is entirely unmanged by NM.
b) do a seamless takeover of a previously managed connection at start,
but still fully manage.
This patch changes the handling of default-routes towards meaning b).
https://bugzilla.redhat.com/show_bug.cgi?id=1224291
-rw-r--r-- | src/devices/nm-device.c | 20 |
1 files changed, 13 insertions, 7 deletions
diff --git a/src/devices/nm-device.c b/src/devices/nm-device.c index 826427b346..8041631acd 100644 --- a/src/devices/nm-device.c +++ b/src/devices/nm-device.c @@ -3094,7 +3094,7 @@ ip4_config_merge_and_apply (NMDevice *self, if (priv->wwan_ip4_config) nm_ip4_config_merge (composite, priv->wwan_ip4_config); - /* Merge user overrides into the composite config. For assumed connection, + /* Merge user overrides into the composite config. For assumed connections, * con_ip4_config is empty. */ if (priv->con_ip4_config) nm_ip4_config_merge (composite, priv->con_ip4_config); @@ -3123,14 +3123,12 @@ ip4_config_merge_and_apply (NMDevice *self, goto END_ADD_DEFAULT_ROUTE; } - if (nm_device_uses_assumed_connection (self)) - goto END_ADD_DEFAULT_ROUTE; - connection_has_default_route = nm_default_route_manager_ip4_connection_has_default_route (nm_default_route_manager_get (), connection, &connection_is_never_default); if ( !priv->default_route.v4_configure_first_time + && !nm_device_uses_assumed_connection (self) && connection_is_never_default) { /* If the connection is explicitly configured as never-default, we enforce the (absense of the) * default-route only once. That allows the user to configure a connection as never-default, @@ -3138,6 +3136,11 @@ ip4_config_merge_and_apply (NMDevice *self, goto END_ADD_DEFAULT_ROUTE; } + /* At this point, we treat assumed and non-assumed connections alike. + * For assumed connections we do that because we still manage RA and DHCP + * leases for them, so we must extend/update the default route on commits. + */ + /* we are about to commit (for a non-assumed connection). Enforce whatever we have * configured. */ priv->default_route.v4_configure_first_time = FALSE; @@ -3717,14 +3720,12 @@ ip6_config_merge_and_apply (NMDevice *self, goto END_ADD_DEFAULT_ROUTE; } - if (nm_device_uses_assumed_connection (self)) - goto END_ADD_DEFAULT_ROUTE; - connection_has_default_route = nm_default_route_manager_ip6_connection_has_default_route (nm_default_route_manager_get (), connection, &connection_is_never_default); if ( !priv->default_route.v6_configure_first_time + && !nm_device_uses_assumed_connection (self) && connection_is_never_default) { /* If the connection is explicitly configured as never-default, we enforce the (absense of the) * default-route only once. That allows the user to configure a connection as never-default, @@ -3732,6 +3733,11 @@ ip6_config_merge_and_apply (NMDevice *self, goto END_ADD_DEFAULT_ROUTE; } + /* At this point, we treat assumed and non-assumed connections alike. + * For assumed connections we do that because we still manage RA and DHCP + * leases for them, so we must extend/update the default route on commits. + */ + /* we are about to commit (for a non-assumed connection). Enforce whatever we have * configured. */ priv->default_route.v6_configure_first_time = FALSE; |