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:10:31 -0500
commitcb94fe0a9e985647d0feb3637dabdeab56a650a1 (patch)
tree62e55ee0b7791922f7fdcd420ef5ff8673e403a1
parent6d81fd475ee7c4176f7c429fde8df4b56f174392 (diff)
downloadNetworkManager-cb94fe0a9e985647d0feb3637dabdeab56a650a1.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 (cherry picked from commit 8283672451d0b07655a8423af0e17fd26c07a0d1)
-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 2c565e94c3..2a5a9c26f7 100644
--- a/src/devices/nm-device.c
+++ b/src/devices/nm-device.c
@@ -2635,9 +2635,13 @@ ip4_config_merge_and_apply (NMDevice *self,
if (priv->ext_ip4_config)
nm_ip4_config_merge (composite, priv->ext_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 (NM_SETTINGS_CONNECTION (connection))) {
nm_ip4_config_merge_setting (composite,
nm_connection_get_setting_ip4_config (connection),
nm_device_get_priority (self));
@@ -3083,9 +3087,13 @@ ip6_config_merge_and_apply (NMDevice *self,
if (priv->ext_ip6_config)
nm_ip6_config_merge (composite, priv->ext_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 (NM_SETTINGS_CONNECTION (connection))) {
nm_ip6_config_merge_setting (composite,
nm_connection_get_setting_ip6_config (connection),
nm_device_get_priority (self));