Dan Williams <dcbw redhat com> on Fri, 2014/09/26 16:14:
On Tue, 2014-09-23 at 16:51 +0200, Christian Hesse wrote:By default interface name is 'tun' with an incrementing number (tun0, tun1, ...). By specifying 'Interface name' in vpnc config you can change the name to something more descriptice.Mostly looks good. Perhaps one more round, see below...@@ -1343,6 +1366,21 @@ import (NMVpnPluginUiInterface *iface, const char *path, GError **error) s_ip4 = NM_SETTING_IP4_CONFIG (nm_setting_ip4_config_new ()); nm_connection_add_setting (connection, NM_SETTING (s_ip4)); + /* Interface Name */ + buf = key_file_get_string_helper (keyfile, "main", "InterfaceName", NULL); + if (buf) { + g_object_set (G_OBJECT (s_con), + NM_SETTING_CONNECTION_INTERFACE_NAME, buf, NULL); + g_free (buf); + } else { + g_set_error (error, + NM_VPNC_IMPORT_EXPORT_ERROR, + NM_VPNC_IMPORT_EXPORT_ERROR_NOT_VPNC, + "does not look like a %s VPN connection (no interface name)", + VPNC_PLUGIN_NAME); + goto error;This part will cause most imports to fail, because most connections don't specify an interface name. I think we should just kill the entire 'else' block here since it's not really a hard error if the name is missing.
Agreed. In addition to this I made writing the configuration option to vpnc configuration optional.
+ } + value = nm_setting_vpn_get_data_item (s_vpn, NM_VPNC_KEY_GATEWAY); if (value && strlen (value)) gateway = value; @@ -1729,6 +1779,7 @@ export (NMVpnPluginUiInterface *iface, fprintf (f, "[main]\n" "Description=%s\n" + "InterfaceName=%s\n"We won't always have the interface name though, so I think we have to conditionally export it like some of the other variables are.
Sure. I will reply with a patch. -- Schoene Gruesse Chris O< ascii ribbon campaign stop html mail - www.asciiribbon.org
Attachment:
signature.asc
Description: PGP signature