From 18cd265b2d681fc75c696a8df2dd850735ef9d63 Mon Sep 17 00:00:00 2001 From: Francesco Giudici Date: Fri, 24 Jun 2016 15:44:58 +0200 Subject: [PATCH] nmcli: when adding a vpn store the full service name in vpn-type When NM looks for vpn plugins, it would expect the full service name otherwise it will not be able to retrieve the correct plugin. Fixes VPN configurations generated with "nmcli connection add". --- clients/cli/settings.c | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/clients/cli/settings.c b/clients/cli/settings.c index c8b72ef196..08a5d087e1 100644 --- a/clients/cli/settings.c +++ b/clients/cli/settings.c @@ -26,6 +26,7 @@ #include "utils.h" #include "common.h" +#include "nm-vpn-helpers.h" /* Forward declarations */ static char *wep_key_type_to_string (NMWepKeyType type); @@ -2958,6 +2959,16 @@ nmc_property_set_secret_flags (NMSetting *setting, const char *prop, const char return TRUE; } +static gboolean +nmc_property_set_vpn_service (NMSetting *setting, const char *prop, const char *val, GError **error) +{ + gs_free char *service_name = NULL; + + service_name = nm_vpn_plugin_info_list_find_service_type (nm_vpn_get_plugin_infos (), val); + g_object_set (setting, prop, service_name ? : val, NULL); + return TRUE; +} + static gboolean nmc_util_is_domain (const char *domain) { @@ -7081,7 +7092,7 @@ nmc_properties_init (void) /* Add editable properties for NM_SETTING_VPN_SETTING_NAME */ nmc_add_prop_funcs (GLUE (VPN, SERVICE_TYPE), nmc_property_vpn_get_service_type, - nmc_property_set_string, + nmc_property_set_vpn_service, NULL, NULL, NULL,