diff options
Diffstat (limited to 'src/devices/nm-device.c')
-rw-r--r-- | src/devices/nm-device.c | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/src/devices/nm-device.c b/src/devices/nm-device.c index 19c43f2588..cfb47e6bf8 100644 --- a/src/devices/nm-device.c +++ b/src/devices/nm-device.c @@ -314,6 +314,7 @@ typedef struct { static gboolean nm_device_set_ip4_config (NMDevice *self, NMIP4Config *config, + guint32 default_route_metric, gboolean commit, NMDeviceStateReason *reason); static gboolean ip4_config_merge_and_apply (NMDevice *self, @@ -2763,6 +2764,7 @@ ip4_config_merge_and_apply (NMDevice *self, NMConnection *connection; gboolean success; NMIP4Config *composite; + guint32 default_route_metric = nm_device_get_ip4_route_metric (self); /* Merge all the configs into the composite config */ if (config) { @@ -2797,7 +2799,7 @@ ip4_config_merge_and_apply (NMDevice *self, if (!nm_settings_connection_get_nm_generated_assumed (NM_SETTINGS_CONNECTION (connection))) { nm_ip4_config_merge_setting (composite, nm_connection_get_setting_ip4_config (connection), - nm_device_get_ip4_route_metric (self)); + default_route_metric); } /* Add the default route. @@ -2827,7 +2829,7 @@ ip4_config_merge_and_apply (NMDevice *self, memset (route, 0, sizeof (*route)); route->source = NM_IP_CONFIG_SOURCE_USER; route->gateway = gateway; - route->metric = nm_device_get_ip4_route_metric (self); + route->metric = default_route_metric; route->mss = nm_ip4_config_get_mss (composite); priv->default_route.v4_has = TRUE; priv->default_route.v4_is_assumed = FALSE; @@ -2859,7 +2861,7 @@ ip4_config_merge_and_apply (NMDevice *self, NM_DEVICE_GET_CLASS (self)->ip4_config_pre_commit (self, composite); } - success = nm_device_set_ip4_config (self, composite, commit, out_reason); + success = nm_device_set_ip4_config (self, composite, default_route_metric, commit, out_reason); g_object_unref (composite); return success; } @@ -5572,6 +5574,7 @@ nm_device_get_ip4_config (NMDevice *self) static gboolean nm_device_set_ip4_config (NMDevice *self, NMIP4Config *new_config, + guint32 default_route_metric, gboolean commit, NMDeviceStateReason *reason) { @@ -5592,8 +5595,9 @@ nm_device_set_ip4_config (NMDevice *self, old_config = priv->ip4_config; /* Always commit to nm-platform to update lifetimes */ - if (commit && new_config) { - success = nm_ip4_config_commit (new_config, ip_ifindex); + if ( commit && new_config + && !nm_device_uses_assumed_connection (self)) { + success = nm_ip4_config_commit (new_config, ip_ifindex, default_route_metric); if (!success) reason_local = NM_DEVICE_STATE_REASON_CONFIG_FAILED; } @@ -6960,7 +6964,7 @@ _cleanup_generic_post (NMDevice *self, gboolean deconfigure) /* Clean up IP configs; this does not actually deconfigure the * interface; the caller must flush routes and addresses explicitly. */ - nm_device_set_ip4_config (self, NULL, TRUE, &ignored); + nm_device_set_ip4_config (self, NULL, 0, TRUE, &ignored); nm_device_set_ip6_config (self, NULL, TRUE, &ignored); g_clear_object (&priv->dev_ip4_config); g_clear_object (&priv->ext_ip4_config); |