summaryrefslogtreecommitdiff
path: root/vpn
diff options
context:
space:
mode:
authorJussi Laakkonen <jussi.laakkonen@jolla.com>2020-01-23 16:29:58 +0200
committerDaniel Wagner <wagi@monom.org>2020-01-23 18:08:02 +0100
commit056e1c0928c69a374edb5a76c7975d4540fe4750 (patch)
treee19de62d8522d9e98717bd8ca15e457a6897a011 /vpn
parent07285158b29cf49f19b6f61b5396ccae1de7403b (diff)
downloadconnman-056e1c0928c69a374edb5a76c7975d4540fe4750.tar.gz
openvpn: Ensure complete VPN provider state transition when disconnecting
Explicitly set VPN provider disconnect state to ensure full state transition from ready -> disconnect -> idle. The OpenVPN process may refuse to shut down completely because of VPN interface being busy (openvpn request >FATAL:ERROR: Cannot ioctl TUNSETIFF vpn0: Device or resource busy (errno=16)) and a process is left behind. The cause for such behavior is from OpenVPN TCP "Connection reset" leading to "Restart pause" of increasing amount of seconds. This happens when the server has some limits for re-connections, or the server is simply slow in accepting TCP clients, or the transport abruptly goes away. As a result the state transition to ready -> disconnect -> idle is not complete. By updating the state in ov_disconnect() vpn_provider.c:__vpn_provider_connect() is prevented from connecting until the state transition is complete. Commit be1b90c6db3d0c71a25369ac1fb8c5628ea28acc introduced this problem by implementing the ov_disconnect() so vpn.c:vpn_disconnect() did not do the state transition for OpenVPN.
Diffstat (limited to 'vpn')
-rw-r--r--vpn/plugins/openvpn.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/vpn/plugins/openvpn.c b/vpn/plugins/openvpn.c
index e5d9d943..75f5cb86 100644
--- a/vpn/plugins/openvpn.c
+++ b/vpn/plugins/openvpn.c
@@ -1114,6 +1114,8 @@ static void ov_disconnect(struct vpn_provider *provider)
return;
connman_agent_cancel(provider);
+
+ vpn_provider_set_state(provider, VPN_PROVIDER_STATE_DISCONNECT);
}
static int ov_device_flags(struct vpn_provider *provider)