summaryrefslogtreecommitdiff
path: root/vpn/plugins/vpn.c
diff options
context:
space:
mode:
authorJiung Yu <jiung.yu@samsung.com>2017-06-02 10:11:14 +0900
committerJiung Yu <jiung.yu@samsung.com>2017-06-02 06:24:53 +0000
commit3cd173b5ecdf1c61f1f8cbdeac35f62f79c0deb9 (patch)
treec5754ea0645a8d3d88f9b48d114822e574a2a5e9 /vpn/plugins/vpn.c
parent6d0c59f3bfb3b4ef7881f925097dae1f75ea9990 (diff)
downloadconnman-3cd173b5ecdf1c61f1f8cbdeac35f62f79c0deb9.tar.gz
connman-3cd173b5ecdf1c61f1f8cbdeac35f62f79c0deb9.tar.bz2
connman-3cd173b5ecdf1c61f1f8cbdeac35f62f79c0deb9.zip
Add child SA up/down event and terminate command
Change-Id: I4616b3148782cfc3b0ebf0a2f2826d84c67c2bf3 Signed-off-by: Yu jiung <jiung.yu@samsung.com>
Diffstat (limited to 'vpn/plugins/vpn.c')
-rwxr-xr-xvpn/plugins/vpn.c55
1 files changed, 5 insertions, 50 deletions
diff --git a/vpn/plugins/vpn.c b/vpn/plugins/vpn.c
index b48b6bca..e65dacac 100755
--- a/vpn/plugins/vpn.c
+++ b/vpn/plugins/vpn.c
@@ -310,15 +310,10 @@ static DBusMessage *vpn_notify(struct connman_task *task,
#if defined TIZEN_EXT
static void vpn_event(struct vpn_provider *provider, int state)
{
- struct vpn_data *data;
struct vpn_driver_data *vpn_driver_data;
const char *name;
- int index, err;
-
- data = vpn_provider_get_data(provider);
name = vpn_provider_get_driver_name(provider);
-
if (!name) {
DBG("Cannot find VPN driver for provider %p", provider);
vpn_provider_set_state(provider, VPN_PROVIDER_STATE_FAILURE);
@@ -336,52 +331,12 @@ static void vpn_event(struct vpn_provider *provider, int state)
switch (state) {
case VPN_STATE_CONNECT:
+ vpn_provider_set_state(provider,
+ VPN_PROVIDER_STATE_CONNECT);
+ break;
case VPN_STATE_READY:
- if (data->state == VPN_STATE_READY) {
- /*
- * This is the restart case, in which case we must
- * just set the IP address.
- *
- * We need to remove first the old address, just
- * replacing the old address will not work as expected
- * because the old address will linger in the interface
- * and not disapper so the clearing is needed here.
- *
- * Also the state must change, otherwise the routes
- * will not be set properly.
- */
- vpn_provider_set_state(provider,
- VPN_PROVIDER_STATE_CONNECT);
-
- vpn_provider_clear_address(provider, AF_INET);
- vpn_provider_clear_address(provider, AF_INET6);
-
- vpn_provider_change_address(provider);
- vpn_provider_set_state(provider,
- VPN_PROVIDER_STATE_READY);
- break;
- }
-
- index = vpn_provider_get_index(provider);
- vpn_provider_ref(provider);
- data->watch = vpn_rtnl_add_newlink_watch(index,
- vpn_newlink, provider);
- err = connman_inet_ifup(index);
- if (err < 0) {
- if (err == -EALREADY)
- /*
- * So the interface is up already, that is just
- * great. Unfortunately in this case the
- * newlink watch might not have been called at
- * all. We must manually call it here so that
- * the provider can go to ready state and the
- * routes are setup properly.
- */
- vpn_newlink(IFF_UP, 0, provider);
- else
- DBG("Cannot take interface %d up err %d/%s",
- index, -err, strerror(-err));
- }
+ vpn_provider_set_state(provider,
+ VPN_PROVIDER_STATE_READY);
break;
case VPN_STATE_UNKNOWN: