mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager.git
synced 2026-05-08 12:28:11 +02:00
contrib/scripts: fix importing 'remote' and 'remote-random' options for openvpn
see https://bugzilla.redhat.com/show_bug.cgi?id=1194643
(cherry picked from commit 466515e953)
This commit is contained in:
parent
6b8dee613f
commit
9543f2ef73
1 changed files with 14 additions and 7 deletions
|
|
@ -104,17 +104,23 @@ function handle_dev_type(t, option, value)
|
||||||
t[option] = value[2]
|
t[option] = value[2]
|
||||||
end
|
end
|
||||||
function handle_remote(t, option, value)
|
function handle_remote(t, option, value)
|
||||||
|
local rem
|
||||||
if not value[2] then io.stderr:write("Warning: ignoring invalid option 'remote'\n") end
|
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
|
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
|
end
|
||||||
g_switches[value[1]] = true
|
g_switches[value[1]] = true
|
||||||
end
|
end
|
||||||
function handle_port(t, option, value)
|
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
|
if tonumber(value[2]) then
|
||||||
t[option] = value[2]
|
t[option] = value[2]
|
||||||
end
|
end
|
||||||
|
|
@ -177,14 +183,15 @@ vpn2nm = {
|
||||||
["mssfix"] = { nm_opt="mssfix", func=handle_yes },
|
["mssfix"] = { nm_opt="mssfix", func=handle_yes },
|
||||||
["pkcs12"] = { nm_opt="client", func=handle_path },
|
["pkcs12"] = { nm_opt="client", func=handle_path },
|
||||||
["port"] = { nm_opt="port", func=handle_port },
|
["port"] = { nm_opt="port", func=handle_port },
|
||||||
|
["rport"] = { nm_opt="port", func=handle_port },
|
||||||
["proto"] = { nm_opt="proto-tcp", func=handle_proto },
|
["proto"] = { nm_opt="proto-tcp", func=handle_proto },
|
||||||
["http-proxy"] = { nm_opt={"proxy-type", "proxy-server", "proxy-port"}, func=handle_proxy },
|
["http-proxy"] = { nm_opt={"proxy-type", "proxy-server", "proxy-port"}, func=handle_proxy },
|
||||||
["http-proxy-retry"] = { nm_opt="proxy-retry", func=handle_yes },
|
["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"] = { nm_opt={"proxy-type", "proxy-server", "proxy-port"}, func=handle_proxy },
|
||||||
["socks-proxy-retry"] = { nm_opt="proxy-retry", func=handle_yes },
|
["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 },
|
["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 },
|
["secret"] = { nm_opt={"static-key", "static-key-direction"}, func=handle_secret },
|
||||||
["tls-auth"] = { nm_opt={"ta", "ta-dir"}, func=handle_secret },
|
["tls-auth"] = { nm_opt={"ta", "ta-dir"}, func=handle_secret },
|
||||||
["tls-client"] = { nm_opt="tls-client=", func=set_bool },
|
["tls-client"] = { nm_opt="tls-client=", func=set_bool },
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue