summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDan Williams <dcbw@redhat.com>2014-10-13 16:27:20 -0500
committerDan Williams <dcbw@redhat.com>2014-10-17 15:00:31 -0500
commit8283672451d0b07655a8423af0e17fd26c07a0d1 (patch)
treed12086d97552adf92588f6a6f08375f0208d5419
parent261a3924d3d375f3cf2cda056bdef224e80db68b (diff)
downloadNetworkManager-8283672451d0b07655a8423af0e17fd26c07a0d1.tar.gz
core: don't override external route metrics (bgo #738268)
A generated connection contains a copy of the device's existing configuration, so it's entirely redundant to merge the connection back into the device's IP config. But even though that should result in no changes to the IP config, NMSettingIPxConfig treats a route metric of '0' as the device priority, while NMIPxConfig allows 0 as a valid route metric. Since the setting values are preferred (they are supposed to be user-supplied and thus override anythign else, but in this case they are generated and thus not user-supplied) external routes with a metric of 0 are overwritten with the device priority metric. https://bugzilla.gnome.org/show_bug.cgi?id=738268
-rw-r--r--src/devices/nm-device.c16
1 files changed, 12 insertions, 4 deletions
diff --git a/src/devices/nm-device.c b/src/devices/nm-device.c
index d2edef95f8..754ae0d3f9 100644
--- a/src/devices/nm-device.c
+++ b/src/devices/nm-device.c
@@ -2626,9 +2626,13 @@ 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 */
+ /* Merge user overrides into the composite config. Generated+assumed
+ * connections come from the system not the user and merging them would
+ * be redundant, so don't bother.
+ */
connection = nm_device_get_connection (self);
- if (connection) {
+ if ( connection
+ && !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_priority (self));
@@ -3051,9 +3055,13 @@ ip6_config_merge_and_apply (NMDevice *self,
if (priv->wwan_ip6_config)
nm_ip6_config_merge (composite, priv->wwan_ip6_config);
- /* Merge user overrides into the composite config */
+ /* Merge user overrides into the composite config. Generated+assumed
+ * connections come from the system not the user and merging them would
+ * be redundant, so don't bother.
+ */
connection = nm_device_get_connection (self);
- if (connection) {
+ if ( connection
+ && !nm_settings_connection_get_nm_generated_assumed (NM_SETTINGS_CONNECTION (connection))) {
nm_ip6_config_merge_setting (composite,
nm_connection_get_setting_ip6_config (connection),
nm_device_get_priority (self));