summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBeniamino Galvani <bgalvani@redhat.com>2016-03-22 22:18:51 +0100
committerBeniamino Galvani <bgalvani@redhat.com>2016-03-22 22:18:51 +0100
commit476b8b043ff3dc2dc1db0ca10bce6a5f5f5d5427 (patch)
treee192874af12bf6d8937e8500f1c9ebdf3a953d22
parent7cab83049ecebbcdc6d6d148bb569eb1f0da7722 (diff)
downloadNetworkManager-bg/gateway-never-default-rh1313091.tar.gz
libnm-core: don't allow a gateway to be set with never-defaultbg/gateway-never-default-rh1313091
The combination doesn't make sense, forbid it as we do with other properties to prevent wrong configurations.
-rw-r--r--libnm-core/nm-setting-ip-config.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/libnm-core/nm-setting-ip-config.c b/libnm-core/nm-setting-ip-config.c
index d76179c8e3..8cc2b29015 100644
--- a/libnm-core/nm-setting-ip-config.c
+++ b/libnm-core/nm-setting-ip-config.c
@@ -2242,6 +2242,16 @@ verify (NMSetting *setting, NMConnection *connection, GError **error)
g_prefix_error (error, "%s.%s: ", nm_setting_get_name (setting), NM_SETTING_IP_CONFIG_GATEWAY);
return FALSE;
}
+
+ if (priv->never_default) {
+ g_set_error (error,
+ NM_CONNECTION_ERROR,
+ NM_CONNECTION_ERROR_INVALID_PROPERTY,
+ _("a gateway is incompatible with '%s'"),
+ NM_SETTING_IP_CONFIG_NEVER_DEFAULT);
+ g_prefix_error (error, "%s.%s: ", nm_setting_get_name (setting), NM_SETTING_IP_CONFIG_GATEWAY);
+ return FALSE;
+ }
}
/* Validate routes */