summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBeniamino Galvani <bgalvani@redhat.com>2017-06-08 00:26:00 +0200
committerBeniamino Galvani <bgalvani@redhat.com>2017-06-08 00:28:31 +0200
commit46ad38293e7c7a96296c9fd352de788ee0e10e0f (patch)
treec863ccc6af666ef8da94c3d7c28fec89a4475e4c
parent90256b41aedc453f9699e570fc5fc0480269b423 (diff)
downloadNetworkManager-bg/connectivity-rh1459604.tar.gz
device: apply route metric penality only when the default route existsbg/connectivity-rh1459604
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.
-rw-r--r--src/devices/nm-device.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/devices/nm-device.c b/src/devices/nm-device.c
index f26c85764a..88c747743d 100644
--- a/src/devices/nm-device.c
+++ b/src/devices/nm-device.c
@@ -1776,9 +1776,11 @@ update_connectivity_state (NMDevice *self, NMConnectivityState 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->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");
}
}