Commit 6afd16bc authored by Federico Mena Quintero's avatar Federico Mena Quintero Committed by Thomas Haller

properties: import the keepalive option

[thaller@redhat.com: fix leaking temporary variable]
parent 990d7495
......@@ -58,6 +58,7 @@
#define FRAGMENT_TAG "fragment "
#define IFCONFIG_TAG "ifconfig "
#define KEY_TAG "key "
#define KEEPALIVE_TAG "keepalive "
#define MSSFIX_TAG "mssfix"
#define PING_TAG "ping "
#define PING_EXIT_TAG "ping-exit "
......@@ -705,6 +706,33 @@ do_import (const char *path, char **lines, GError **error)
continue;
}
if (!strncmp (*line, KEEPALIVE_TAG, strlen (KEEPALIVE_TAG))) {
int ping_secs;
int ping_restart_secs;
items = get_args (*line + strlen (KEEPALIVE_TAG), &nitems);
if (nitems == 2) {
ping_secs = parse_seconds (items[0], *line);
ping_restart_secs = parse_seconds (items[1], *line);
if (ping_secs >= 0 && ping_restart_secs >= 0) {
tmp = g_strdup_printf ("%d", ping_secs);
tmp2 = g_strdup_printf ("%d", ping_restart_secs);
nm_setting_vpn_add_data_item (s_vpn, NM_OPENVPN_KEY_PING, tmp);
nm_setting_vpn_add_data_item (s_vpn, NM_OPENVPN_KEY_PING_RESTART, tmp2);
g_free (tmp);
g_free (tmp2);
} else
g_warning ("%s: invalid arguments in option '%s', must be two integers", __func__, *line);
} else
g_warning ("%s: invalid number of arguments in option '%s', must be two integers", __func__, *line);
g_strfreev (items);
continue;
}
if (!strncmp (*line, KEYSIZE_TAG, strlen (KEYSIZE_TAG))) {
items = get_args (*line + strlen (KEYSIZE_TAG), &nitems);
if (nitems == 1) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment