summaryrefslogtreecommitdiff
path: root/libnm-core/nm-connection.c
diff options
context:
space:
mode:
authorBeniamino Galvani <bgalvani@redhat.com>2016-07-01 17:05:42 +0200
committerBeniamino Galvani <bgalvani@redhat.com>2016-07-06 10:12:27 +0200
commitb5b7260873563d5f1a5bced3f2c98d7d1df7f8b4 (patch)
tree0fa3b9bf885d17c5366244e0baf2e4084d3db147 /libnm-core/nm-connection.c
parent82a1c0d6088d886b3b6db7322ddfc2d7525a5c1b (diff)
libnm-core: ip-config: normalize may-fail for disabled IP methods
Since commit 7d1709d7f649 ("device: check may_fail when progressing to IP_CHECK") NM correctly checks the may-fail properties to decide whether a connection must fail after the completion of IP configuration. But for ipv4.method=disabled and ipv6.method=ignore the IP configuration is always considered failed and thus setting may-fail=no results in a connection that can never succeed. To prevent such wrong configuration, force may-fail to TRUE for those methods during connection normalization. https://bugzilla.redhat.com/show_bug.cgi?id=1334884 (cherry picked from commit ac73758305faf938318e6c888faf8bc954b8289d)
Diffstat (limited to 'libnm-core/nm-connection.c')
-rw-r--r--libnm-core/nm-connection.c22
1 files changed, 18 insertions, 4 deletions
diff --git a/libnm-core/nm-connection.c b/libnm-core/nm-connection.c
index b2c4d4eea0..04385aae99 100644
--- a/libnm-core/nm-connection.c
+++ b/libnm-core/nm-connection.c
@@ -724,7 +724,7 @@ _normalize_ip_config (NMConnection *self, GHashTable *parameters)
const char *default_ip6_method = NULL;
NMSettingIPConfig *s_ip4, *s_ip6;
NMSetting *setting;
- gboolean gateway_removed = FALSE;
+ gboolean changed = FALSE;
if (parameters)
default_ip6_method = g_hash_table_lookup (parameters, NM_CONNECTION_NORMALIZE_PARAM_IP6_CONFIG_METHOD);
@@ -761,7 +761,14 @@ _normalize_ip_config (NMConnection *self, GHashTable *parameters)
if ( nm_setting_ip_config_get_gateway (s_ip4)
&& nm_setting_ip_config_get_never_default (s_ip4)) {
g_object_set (s_ip4, NM_SETTING_IP_CONFIG_GATEWAY, NULL, NULL);
- gateway_removed = TRUE;
+ changed = TRUE;
+ }
+
+ if ( nm_streq0 (nm_setting_ip_config_get_method (s_ip4),
+ NM_SETTING_IP4_CONFIG_METHOD_DISABLED)
+ && !nm_setting_ip_config_get_may_fail (s_ip4)) {
+ g_object_set (s_ip4, NM_SETTING_IP_CONFIG_MAY_FAIL, TRUE, NULL);
+ changed = TRUE;
}
}
if (!s_ip6) {
@@ -776,10 +783,17 @@ _normalize_ip_config (NMConnection *self, GHashTable *parameters)
if ( nm_setting_ip_config_get_gateway (s_ip6)
&& nm_setting_ip_config_get_never_default (s_ip6)) {
g_object_set (s_ip6, NM_SETTING_IP_CONFIG_GATEWAY, NULL, NULL);
- gateway_removed = TRUE;
+ changed = TRUE;
+ }
+
+ if ( nm_streq0 (nm_setting_ip_config_get_method (s_ip6),
+ NM_SETTING_IP6_CONFIG_METHOD_IGNORE)
+ && !nm_setting_ip_config_get_may_fail (s_ip6)) {
+ g_object_set (s_ip6, NM_SETTING_IP_CONFIG_MAY_FAIL, TRUE, NULL);
+ changed = TRUE;
}
}
- return !s_ip4 || !s_ip6 || gateway_removed;
+ return !s_ip4 || !s_ip6 || changed;
}
}