summaryrefslogtreecommitdiff
path: root/src/provider.c
diff options
context:
space:
mode:
authorJukka Rissanen <jukka.rissanen@linux.intel.com>2012-08-08 13:22:47 +0300
committerPatrik Flykt <patrik.flykt@linux.intel.com>2012-08-09 12:16:51 +0300
commit2c5ca690ed80403f54229b005bc11cf87ba3e65b (patch)
treef8459f0c10544abf40932e08e65bb3d81afa3a4d /src/provider.c
parentce2b475e05c1165767a251059b32d9bb22f6f864 (diff)
downloadconnman-2c5ca690ed80403f54229b005bc11cf87ba3e65b.tar.gz
connman-2c5ca690ed80403f54229b005bc11cf87ba3e65b.tar.bz2
connman-2c5ca690ed80403f54229b005bc11cf87ba3e65b.zip
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.
Diffstat (limited to 'src/provider.c')
-rw-r--r--src/provider.c17
1 files changed, 15 insertions, 2 deletions
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);