summaryrefslogtreecommitdiff
path: root/vpn/plugins/openvpn.c
diff options
context:
space:
mode:
authorJukka Rissanen <jukka.rissanen@linux.intel.com>2012-11-22 12:05:19 (GMT)
committerDaniel Wagner <daniel.wagner@bmw-carit.de>2012-11-23 12:25:37 (GMT)
commitf4659640ba729bc9b12c2be26e242b84dd0ee387 (patch)
treef6dea6171e38dba67fe8d88cb5182f0625ca971b /vpn/plugins/openvpn.c
parent4e6eab6d89d4c6409ffe62903981314dc092412e (diff)
downloadconnman-f4659640ba729bc9b12c2be26e242b84dd0ee387.zip
connman-f4659640ba729bc9b12c2be26e242b84dd0ee387.tar.gz
connman-f4659640ba729bc9b12c2be26e242b84dd0ee387.tar.bz2
openvpn: Set default options if user has not supplied a config file
If the user is using config file option, then do not set the optional default options. All the mandatory options needed for connman and openvpn interaction are still set in command line.
Diffstat (limited to 'vpn/plugins/openvpn.c')
-rw-r--r--vpn/plugins/openvpn.c28
1 files changed, 17 insertions, 11 deletions
diff --git a/vpn/plugins/openvpn.c b/vpn/plugins/openvpn.c
index 07c794b..84583cd 100644
--- a/vpn/plugins/openvpn.c
+++ b/vpn/plugins/openvpn.c
@@ -242,13 +242,23 @@ static int ov_connect(struct vpn_provider *provider,
task_append_config_data(provider, task);
- option = vpn_provider_get_string(provider, "OpenVPN.TLSAuth");
- if (option != NULL) {
- connman_task_add_argument(task, "--tls-auth", option);
- option = vpn_provider_get_string(provider,
- "OpenVPN.TLSAuthDir");
- if (option != NULL)
- connman_task_add_argument(task, option, NULL);
+ option = vpn_provider_get_string(provider, "OpenVPN.ConfigFile");
+ if (option == NULL) {
+ /*
+ * Set some default options if user has no config file.
+ */
+ option = vpn_provider_get_string(provider, "OpenVPN.TLSAuth");
+ if (option != NULL) {
+ connman_task_add_argument(task, "--tls-auth", option);
+ option = vpn_provider_get_string(provider,
+ "OpenVPN.TLSAuthDir");
+ if (option != NULL)
+ connman_task_add_argument(task, option, NULL);
+ }
+
+ connman_task_add_argument(task, "--nobind", NULL);
+ connman_task_add_argument(task, "--persist-key", NULL);
+ connman_task_add_argument(task, "--client", NULL);
}
connman_task_add_argument(task, "--syslog", NULL);
@@ -274,8 +284,6 @@ static int ov_connect(struct vpn_provider *provider,
connman_task_add_argument(task, "--dev", if_name);
connman_task_add_argument(task, "--dev-type", "tun");
- connman_task_add_argument(task, "--nobind", NULL);
- connman_task_add_argument(task, "--persist-key", NULL);
connman_task_add_argument(task, "--persist-tun", NULL);
connman_task_add_argument(task, "--route-noexec", NULL);
@@ -291,8 +299,6 @@ static int ov_connect(struct vpn_provider *provider,
*/
connman_task_add_argument(task, "--ping-restart", "0");
- connman_task_add_argument(task, "--client", NULL);
-
fd = fileno(stderr);
err = connman_task_run(task, vpn_died, provider,
NULL, &fd, &fd);