diff options
author | Jiří Klimeš <jklimes@redhat.com> | 2015-05-18 17:42:13 +0200 |
---|---|---|
committer | Jiří Klimeš <jklimes@redhat.com> | 2015-05-19 09:21:50 +0200 |
commit | 466515e953df297c4f2d41560a2edd568d787ed2 (patch) | |
tree | 3ef8b95bfdfe574383b796a6d1f944f1fc7cdd4c /contrib | |
parent | 29473f1bc4229469f27dfdcf9ba08afc8e09f9eb (diff) | |
download | NetworkManager-466515e953df297c4f2d41560a2edd568d787ed2.tar.gz |
contrib/scripts: fix importing 'remote' and 'remote-random' options for openvpn
see https://bugzilla.redhat.com/show_bug.cgi?id=1194643
Diffstat (limited to 'contrib')
-rwxr-xr-x | contrib/scripts/nm-import-openvpn | 21 |
1 files changed, 14 insertions, 7 deletions
diff --git a/contrib/scripts/nm-import-openvpn b/contrib/scripts/nm-import-openvpn index a5fac05765..fb9f7f851b 100755 --- a/contrib/scripts/nm-import-openvpn +++ b/contrib/scripts/nm-import-openvpn @@ -104,17 +104,23 @@ function handle_dev_type(t, option, value) t[option] = value[2] end function handle_remote(t, option, value) + local rem if not value[2] then io.stderr:write("Warning: ignoring invalid option 'remote'\n") end - t[option[1]] = value[2] + rem = value[2] if tonumber(value[3]) then - t[option[2]] = value[3] + rem = rem .. ":" .. value[3] + end + if value[4] == "udp" or value[4] == "tcp" then + rem = rem .. ":" .. value[4] + end + if t[option] then + t[option] = t[option] .. " " .. rem + else + t[option] = rem end g_switches[value[1]] = true end function handle_port(t, option, value) - -- Port value from 'remote' option takes precedence. So if port is already set - -- do not overwrite it - if t[option] then return end if tonumber(value[2]) then t[option] = value[2] end @@ -177,14 +183,15 @@ vpn2nm = { ["mssfix"] = { nm_opt="mssfix", func=handle_yes }, ["pkcs12"] = { nm_opt="client", func=handle_path }, ["port"] = { nm_opt="port", func=handle_port }, + ["rport"] = { nm_opt="port", func=handle_port }, ["proto"] = { nm_opt="proto-tcp", func=handle_proto }, ["http-proxy"] = { nm_opt={"proxy-type", "proxy-server", "proxy-port"}, func=handle_proxy }, ["http-proxy-retry"] = { nm_opt="proxy-retry", func=handle_yes }, ["socks-proxy"] = { nm_opt={"proxy-type", "proxy-server", "proxy-port"}, func=handle_proxy }, ["socks-proxy-retry"] = { nm_opt="proxy-retry", func=handle_yes }, - ["remote"] = { nm_opt={"remote", "port"}, func=handle_remote }, + ["remote"] = { nm_opt="remote", func=handle_remote }, + ["remote-random"] = { nm_opt="remote-random", func=handle_yes }, ["reneg-sec"] = { nm_opt="reneg-seconds", func=handle_generic }, - ["rport"] = { nm_opt="port", func=handle_port }, ["secret"] = { nm_opt={"static-key", "static-key-direction"}, func=handle_secret }, ["tls-auth"] = { nm_opt={"ta", "ta-dir"}, func=handle_secret }, ["tls-client"] = { nm_opt="tls-client=", func=set_bool }, |