summaryrefslogtreecommitdiff
path: root/libnm-core/nm-setting-vpn.c
diff options
context:
space:
mode:
authorThomas Haller <thaller@redhat.com>2018-04-10 11:45:35 +0200
committerBeniamino Galvani <bgalvani@redhat.com>2018-08-08 11:24:29 +0200
commit55ae69233dc1192738ebc4d27b5ff61876353eb6 (patch)
treeec3551a96db4b3846e4edde53ab3d0b8e6d05324 /libnm-core/nm-setting-vpn.c
parent2ead94d5f9f57542dd1612cdd36c38b46b39c5bf (diff)
downloadNetworkManager-55ae69233dc1192738ebc4d27b5ff61876353eb6.tar.gz
all: add connection.multi-connect property for wildcard profiles
Add a new option that allows to activate a profile multiple times (at the same time). Previoulsy, all profiles were implicitly NM_SETTING_CONNECTION_MULTI_CONNECT_SINGLE, meaning, that activating a profile that is already active will deactivate it first. This will make more sense, as we also add more match-options how profiles can be restricted to particular devices. We already have connection.type, connection.interface-name, and (ethernet|wifi).mac-address to restrict a profile to particular devices. For example, it is however not possible to specify a wildcard like "eth*" to match a profile to a set of devices by interface-name. That is another missing feature, and once we extend the matching capabilities, it makes more sense to activate a profile multiple times. See also https://bugzilla.redhat.com/show_bug.cgi?id=997998, which previously changed that a connection is restricted to a single activation at a time. This work relaxes that again. This only adds the new property, it is not used nor implemented yet. https://bugzilla.redhat.com/show_bug.cgi?id=1555012
Diffstat (limited to 'libnm-core/nm-setting-vpn.c')
-rw-r--r--libnm-core/nm-setting-vpn.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/libnm-core/nm-setting-vpn.c b/libnm-core/nm-setting-vpn.c
index 66c902045d..d36ce93485 100644
--- a/libnm-core/nm-setting-vpn.c
+++ b/libnm-core/nm-setting-vpn.c
@@ -480,6 +480,7 @@ static gboolean
verify (NMSetting *setting, NMConnection *connection, GError **error)
{
NMSettingVpnPrivate *priv = NM_SETTING_VPN_GET_PRIVATE (setting);
+ NMSettingConnection *s_con;
if (!priv->service_type) {
g_set_error_literal (error,
@@ -509,6 +510,16 @@ verify (NMSetting *setting, NMConnection *connection, GError **error)
return FALSE;
}
+ if ( connection
+ && (s_con = nm_connection_get_setting_connection (connection))
+ && nm_setting_connection_get_multi_connect (s_con) != NM_CONNECTION_MULTI_CONNECT_DEFAULT) {
+ g_set_error_literal (error,
+ NM_CONNECTION_ERROR,
+ NM_CONNECTION_ERROR_INVALID_PROPERTY,
+ _("cannot set connection.multi-connect for VPN setting"));
+ return FALSE;
+ }
+
return TRUE;
}