[PATCH 1/3 v3] Add vpnc support.

David Woodhouse dwmw2 at infradead.org
Tue Jan 18 05:28:03 PST 2011


On Tue, 2011-01-18 at 03:28 -0800, Mohamed Abbas wrote:

> +static struct vc_route *vc_route_lookup(const char *key, const char *prefix_key,
> +					int *field_type, GHashTable *routes)
> +{
...
> +}
> +
> +static void vc_append_route(const char *key,
> +				const char *value, GHashTable *routes)
> +{
...
> +}

This bit needs to support IPv6, and needs to go somewhere that
OpenConnect can use it too.

> +	if (write_option(fd, "Cisco UDP Encapsulation Port", "0") < 0)
> +		return -EIO;
> +
> +	opt_s = connman_provider_get_string(provider, "VPNC.NATTMode");
> +	if (opt_s == NULL || strlen(opt_s) == 0)
> +		if (write_option(fd, "NAT Traversal Mode", "cisco-udp") < 0)
> +			return -EIO;
> +
> +	opt_s = connman_provider_get_string(provider, "VPNC.LocalPort");
> +	if (opt_s == NULL)
> +		if (write_option(fd, "Local Port", "0") < 0)
> +			return -EIO;

Hm, these are because you want your default values to be different to
the vpnc defaults? Perhaps we can put those defaults into the option
array too? At the top of the loop, do something like:

@@ -x,4 +y,6
 		opt_s = connman_provider_get_string(provider,
 					vpnc_options[i].cm_opt);
+		if (!opt_s)
+			opt_s = vpnc_options[i].default;
 		if (!opt_s)
 			continue;


 
> +	connman_task_add_argument(task, "--script",
> +				SCRIPTDIR "/openconnect-script");
> +
> +	option = connman_provider_get_string(provider, "VPNC.Debug");
> +	if (option != NULL)
> +		connman_task_add_argument(task, "--debug", option);

Is there any particular reason for putting this on the command line
instead of handling it with the other options?

> +	connman_task_add_argument(task, "-", NULL);
> +
> +	err = connman_task_run(task, vpn_died, provider,
> +				&fd, NULL, NULL);

Still no stderr, and vpn_died() doesn't even look at the return code
from vpnc that will differentiate between an authentication failure and
other types of failure, will it?

-- 
David Woodhouse                            Open Source Technology Centre
David.Woodhouse at intel.com                              Intel Corporation




More information about the connman mailing list