From: Jukka Rissanen Date: Wed, 8 Aug 2012 10:22:47 +0000 (+0300) Subject: provider: Allow VPN connection if not in connected state X-Git-Tag: 1.5~31 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=2c5ca690ed80403f54229b005bc11cf87ba3e65b;p=platform%2Fupstream%2Fconnman.git provider: Allow VPN connection if not in connected state Allow user to connect to VPN via dbus and supplying all VPN parameters if the provider already exists but the VPN is not in connected state. This means that the user can call the Manager.ConnectProvider interface multiple times to connect to VPN service. This patch is needed so that OpenConnect can work correctly. Without this patch the OpenConnect cookie cannot be passed to openconnect client program. --- diff --git a/src/provider.c b/src/provider.c index 3f4bb1cc..ebc70557 100644 --- a/src/provider.c +++ b/src/provider.c @@ -700,8 +700,21 @@ static struct connman_provider *provider_create_from_keyfile(GKeyFile *keyfile, static int provider_create_service(struct connman_provider *provider) { - if (provider->vpn_service != NULL) - return -EALREADY; + if (provider->vpn_service != NULL) { + connman_bool_t connected; + + connected = __connman_service_is_connected_state( + provider->vpn_service, CONNMAN_IPCONFIG_TYPE_IPV4); + if (connected == TRUE) + return -EALREADY; + + connected = __connman_service_is_connected_state( + provider->vpn_service, CONNMAN_IPCONFIG_TYPE_IPV6); + if (connected == TRUE) + return -EALREADY; + + return 0; + } provider->vpn_service = __connman_service_create_from_provider(provider);