struct {
const char *cm_opt;
const char *ov_opt;
+ char has_value;
} ov_options[] = {
- { "Host", "--remote" },
- { "OpenVPN.CACert", "--ca" },
- { "OpenVPN.Cert", "--cert" },
- { "OpenVPN.Key", "--key" },
- { "OpenVPN.MTU", "--mtu" },
- { "OpenVPN.Proto", "--proto" },
- { "OpenVPN.Port", "--port" },
- { "OpenVPN.AuthUserPass", "--auth-user-pass" },
- { "OpenVPN.TLSRemote", "--tls-remote" },
- { "OpenVPN.Cipher", "--cipher" },
- { "OpenVPN.Auth", "--auth" },
- { "OpenVPN.CompLZO", "--comp-lzo" },
+ { "Host", "--remote", 1 },
+ { "OpenVPN.CACert", "--ca", 1 },
+ { "OpenVPN.Cert", "--cert", 1 },
+ { "OpenVPN.Key", "--key", 1 },
+ { "OpenVPN.MTU", "--mtu", 1 },
+ { "OpenVPN.Proto", "--proto", 1 },
+ { "OpenVPN.Port", "--port", 1 },
+ { "OpenVPN.AuthUserPass", "--auth-user-pass", 1 },
+ { "OpenVPN.TLSRemote", "--tls-remote", 1 },
+ { "OpenVPN.Cipher", "--cipher", 1 },
+ { "OpenVPN.Auth", "--auth", 1 },
+ { "OpenVPN.CompLZO", "--comp-lzo", 0 },
+ { "OpenVPN.RemoteCertTls", "--remote-cert-tls", 1 },
};
static void ov_append_dns_entries(const char *key, const char *value,
{
DBusMessageIter iter, dict;
const char *reason, *key, *value;
- const char *domain = NULL;
char *nameservers = NULL;
char *address = NULL, *gateway = NULL, *peer = NULL;
struct connman_ipaddress *ipaddress;
if (strcmp(reason, "up"))
return VPN_STATE_DISCONNECT;
- domain = connman_provider_get_string(provider, "VPN.Domain");
-
dbus_message_iter_recurse(&iter, &dict);
while (dbus_message_iter_get_arg_type(&dict) == DBUS_TYPE_DICT_ENTRY) {
return VPN_STATE_CONNECT;
}
+static int ov_save(struct connman_provider *provider, GKeyFile *keyfile)
+{
+ const char *option;
+ int i;
+
+ for (i = 0; i < (int)ARRAY_SIZE(ov_options); i++) {
+ if (strncmp(ov_options[i].cm_opt, "OpenVPN.", 8) == 0) {
+ option = connman_provider_get_string(provider,
+ ov_options[i].cm_opt);
+ if (option == NULL)
+ continue;
+
+ g_key_file_set_string(keyfile,
+ connman_provider_get_save_group(provider),
+ ov_options[i].cm_opt, option);
+ }
+ }
+ return 0;
+}
+
static int task_append_config_data(struct connman_provider *provider,
struct connman_task *task)
{
continue;
if (connman_task_add_argument(task,
- ov_options[i].ov_opt, option) < 0) {
+ ov_options[i].ov_opt,
+ ov_options[i].has_value ? option : NULL) < 0) {
return -EIO;
}
}
static struct vpn_driver vpn_driver = {
.notify = ov_notify,
.connect = ov_connect,
+ .save = ov_save,
};
static int openvpn_init(void)