diff options
author | Niraj Kumar Goit <niraj.g@samsung.com> | 2022-02-17 21:43:13 +0530 |
---|---|---|
committer | Niraj Kumar Goit <niraj.g@samsung.com> | 2022-02-23 21:00:32 +0530 |
commit | bf0e619ef451bde3568c1af509ccb12cbda2ff93 (patch) | |
tree | edc77ad122572a91f8ec267629fb1c4ffffabb4b /vpn/plugins/openvpn.c | |
parent | 2985b9822ac3f5acfef2933cbda98c1285e11af4 (diff) | |
parent | f89b473dfd8e916314b534b3397442f8c869c783 (diff) | |
download | connman-bf0e619ef451bde3568c1af509ccb12cbda2ff93.tar.gz connman-bf0e619ef451bde3568c1af509ccb12cbda2ff93.tar.bz2 connman-bf0e619ef451bde3568c1af509ccb12cbda2ff93.zip |
Merge tag 'upstream/1.40' into tizen.submit/tizen/20220224.061208
Change-Id: I4ed89827d776db6eeec11878bc1cd0cd6c5e1e80
Signed-off-by: Niraj Kumar Goit <niraj.g@samsung.com>
Signed-off-by: Anjali Nijhara <a.nijhara@samsung.com>
Diffstat (limited to 'vpn/plugins/openvpn.c')
-rwxr-xr-x | vpn/plugins/openvpn.c | 32 |
1 files changed, 24 insertions, 8 deletions
diff --git a/vpn/plugins/openvpn.c b/vpn/plugins/openvpn.c index ef0bf782..8c8d3162 100755 --- a/vpn/plugins/openvpn.c +++ b/vpn/plugins/openvpn.c @@ -51,7 +51,6 @@ #include "../vpn-agent.h" #include "vpn.h" -#include "../vpn.h" #define ARRAY_SIZE(a) (sizeof(a)/sizeof(a[0])) @@ -84,6 +83,9 @@ struct { { "OpenVPN.ConfigFile", "--config", 1 }, { "OpenVPN.DeviceType", NULL, 1 }, { "OpenVPN.Verb", "--verb", 1 }, + { "OpenVPN.Ping", "--ping", 1}, + { "OpenVPN.PingExit", "--ping-exit", 1}, + { "OpenVPN.RemapUsr1", "--remap-usr1", 1}, }; struct ov_private_data { @@ -297,6 +299,7 @@ static int ov_notify(DBusMessage *msg, struct vpn_provider *provider) connman_ipaddress_set_ipv4(ipaddress, address, netmask, gateway); connman_ipaddress_set_peer(ipaddress, peer); + connman_ipaddress_set_p2p(ipaddress, true); vpn_provider_set_ipaddress(provider, ipaddress); if (nameserver_list) { @@ -506,16 +509,13 @@ static int run_connect(struct ov_private_data *data, #endif /* - * Disable client restarts because we can't handle this at the - * moment. The problem is that when OpenVPN decides to switch + * Disable client restarts with TCP because we can't handle this at + * the moment. The problem is that when OpenVPN decides to switch * from CONNECTED state to RECONNECTING and then to RESOLVE, * it is not possible to do a DNS lookup. The DNS server is * not accessible through the tunnel anymore and so we end up * trying to resolve the OpenVPN servers address. - */ - connman_task_add_argument(task, "--ping-restart", "0"); - - /* + * * Disable connetion retrying when OpenVPN is connected over TCP. * With TCP OpenVPN attempts to handle reconnection silently without * reporting the error back when establishing a connection or @@ -525,8 +525,24 @@ static int run_connect(struct ov_private_data *data, * including DNS. */ option = vpn_provider_get_string(provider, "OpenVPN.Proto"); - if (option && g_str_has_prefix(option, "tcp")) + if (option && g_str_has_prefix(option, "tcp")) { + option = vpn_provider_get_string(provider, "OpenVPN.PingExit"); + if (!option) + connman_task_add_argument(task, "--ping-restart", "0"); + connman_task_add_argument(task, "--connect-retry-max", "1"); + /* Apply defaults for --ping and --ping-exit only with UDP protocol. */ + } else { + /* Apply default of 10 second interval for ping if omitted. */ + option = vpn_provider_get_string(provider, "OpenVPN.Ping"); + if (!option) + connman_task_add_argument(task, "--ping", "10"); + + /* Apply default of 60 seconds for ping exit if omitted. */ + option = vpn_provider_get_string(provider, "OpenVPN.PingExit"); + if (!option) + connman_task_add_argument(task, "--ping-exit", "60"); + } err = connman_task_run(task, ov_died, data, NULL, NULL, NULL); if (err < 0) { |