diff --git a/src/devices/nm-device.c b/src/devices/nm-device.c index 46378b63f6..194f634ce6 100644 --- a/src/devices/nm-device.c +++ b/src/devices/nm-device.c @@ -3321,16 +3321,8 @@ ip4_config_merge_and_apply (NMDevice *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->v4_commit_first_time - && !nm_device_uses_assumed_connection (self) - && connection_is_never_default) { - /* If the connection is explicitly configured as never-default, we enforce the (absence of the) - * default-route only once. That allows the user to configure a connection as never-default, - * but he can add default routes externally (via a dispatcher script) and NM will not interfere. */ + if (nm_device_uses_generated_assumed_connection (self)) { + /* a generate-assumed-connection always detects the default route from platform */ goto END_ADD_DEFAULT_ROUTE; } @@ -3339,6 +3331,18 @@ ip4_config_merge_and_apply (NMDevice *self, * leases for them, so we must extend/update the default route on commits. */ + 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->v4_commit_first_time + && connection_is_never_default) { + /* If the connection is explicitly configured as never-default, we enforce the (absence of the) + * default-route only once. That allows the user to configure a connection as never-default, + * but he can add default routes externally (via a dispatcher script) and NM will not interfere. */ + goto END_ADD_DEFAULT_ROUTE; + } + /* we are about to commit (for a non-assumed connection). Enforce whatever we have * configured. */ priv->default_route.v4_is_assumed = FALSE; @@ -3942,16 +3946,8 @@ ip6_config_merge_and_apply (NMDevice *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->v6_commit_first_time - && !nm_device_uses_assumed_connection (self) - && connection_is_never_default) { - /* If the connection is explicitly configured as never-default, we enforce the (absence of the) - * default-route only once. That allows the user to configure a connection as never-default, - * but he can add default routes externally (via a dispatcher script) and NM will not interfere. */ + if (nm_device_uses_generated_assumed_connection (self)) { + /* a generate-assumed-connection always detects the default route from platform */ goto END_ADD_DEFAULT_ROUTE; } @@ -3960,6 +3956,18 @@ ip6_config_merge_and_apply (NMDevice *self, * leases for them, so we must extend/update the default route on commits. */ + 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->v6_commit_first_time + && connection_is_never_default) { + /* If the connection is explicitly configured as never-default, we enforce the (absence of the) + * default-route only once. That allows the user to configure a connection as never-default, + * but he can add default routes externally (via a dispatcher script) and NM will not interfere. */ + goto END_ADD_DEFAULT_ROUTE; + } + /* we are about to commit (for a non-assumed connection). Enforce whatever we have * configured. */ priv->default_route.v6_is_assumed = FALSE;