diff options
author | Beniamino Galvani <bgalvani@redhat.com> | 2017-06-08 00:26:00 +0200 |
---|---|---|
committer | Beniamino Galvani <bgalvani@redhat.com> | 2017-06-09 13:54:04 +0200 |
commit | 6a4774b1a8fdc346e0a2d2a3d2ec43054190fdc5 (patch) | |
tree | 832e4d7300ac29588b7353c0ed90ed233fa1b2a8 | |
parent | da94f8a93959094c5ee86fca7edd5ce70e13a6a3 (diff) | |
download | NetworkManager-6a4774b1a8fdc346e0a2d2a3d2ec43054190fdc5.tar.gz |
device: apply route metric penality only when the default route exists
It's useless (and in some cases also harmful) to commit the
configuration to update the default route metric when the device has
no default route. Also, don't commit configuration for externally
activated devices.
https://bugzilla.redhat.com/show_bug.cgi?id=1459604
(cherry picked from commit aa099906f93264bda3ae34fca4dfbdde5455b2bb)
-rw-r--r-- | src/devices/nm-device.c | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/src/devices/nm-device.c b/src/devices/nm-device.c index f473684c35..381cd15a5b 100644 --- a/src/devices/nm-device.c +++ b/src/devices/nm-device.c @@ -1827,10 +1827,13 @@ update_connectivity_state (NMDevice *self, NMConnectivityState state) priv->connectivity_state = state; _notify (self, PROP_CONNECTIVITY); - if (nm_device_get_state (self) == NM_DEVICE_STATE_ACTIVATED) { - if (!ip4_config_merge_and_apply (self, NULL, TRUE)) + if ( priv->state == NM_DEVICE_STATE_ACTIVATED + && !nm_device_sys_iface_state_is_external (self)) { + if ( priv->default_route.v4_has + && !ip4_config_merge_and_apply (self, NULL, TRUE)) _LOGW (LOGD_IP4, "Failed to update IPv4 default route metric"); - if (!ip6_config_merge_and_apply (self, TRUE)) + if ( priv->default_route.v6_has + && !ip6_config_merge_and_apply (self, TRUE)) _LOGW (LOGD_IP6, "Failed to update IPv6 default route metric"); } } |