From c2656a722097a7b4004d2da9c223b347cfa1a4af Mon Sep 17 00:00:00 2001 From: Dirk Brenken Date: Sun, 16 Sep 2018 18:58:26 +0200 Subject: luci-app-openvpn: remove obsolete config options * remove obsolete config options according to openwrt/openwrt@89b8ba9, fix for #2135 * whitespace/intendation fixes * replace fieldset leftover with div * fix finally recipe options transfer to regular config with "Add" Signed-off-by: Dirk Brenken --- .../luasrc/model/cbi/openvpn-advanced.lua | 34 +--------------------- .../luasrc/model/cbi/openvpn-basic.lua | 3 -- .../luci-app-openvpn/luasrc/model/cbi/openvpn.lua | 23 ++++++++------- 3 files changed, 13 insertions(+), 47 deletions(-) (limited to 'applications/luci-app-openvpn/luasrc/model/cbi') diff --git a/applications/luci-app-openvpn/luasrc/model/cbi/openvpn-advanced.lua b/applications/luci-app-openvpn/luasrc/model/cbi/openvpn-advanced.lua index dc7718217c..6dc43bec24 100644 --- a/applications/luci-app-openvpn/luasrc/model/cbi/openvpn-advanced.lua +++ b/applications/luci-app-openvpn/luasrc/model/cbi/openvpn-advanced.lua @@ -204,10 +204,6 @@ local knownParams = { "dev_node", "/dev/net/tun", translate("Use tun/tap device node") }, - { Flag, - "tun_ipv6", - 0, - translate("Make tun device IPv6 capable") }, { Value, "ifconfig", "10.200.200.3 10.200.200.1", @@ -248,15 +244,6 @@ local knownParams = { "mtu_test", 0, translate("Empirically measure MTU") }, - { ListValue, - "comp_lzo", - { "yes", "no", "adaptive" }, - translate("Use fast LZO compression") }, - { Flag, - "comp_noadapt", - 0, - translate("Don't use adaptive lzo compression"), - { comp_lzo=1 } }, { Value, "link_mtu", 1500, @@ -375,7 +362,7 @@ local knownParams = { { client="0" }, { client="" } }, { DynamicList, "push", - { "redirect-gateway", "comp-lzo" }, + { "redirect-gateway" }, translate("Push options to peer"), { client="0" }, { client="" } }, { Flag, @@ -398,12 +385,6 @@ local knownParams = { "/etc/openvpn/ipp.txt 600", translate("Persist/unpersist ifconfig-pool"), { client="0" }, { client="" } }, - -- deprecated and replaced by --topology p2p - -- { Flag, - -- "ifconfig_pool_linear", - -- 0, - -- translate("Use individual addresses rather than /30 subnets"), - -- { client="0" }, { client="" } }, { Value, "ifconfig_push", "10.200.200.1 255.255.255.255", @@ -469,11 +450,6 @@ local knownParams = { "3 10", translate("Allowed maximum of new connections"), { client="0" }, { client="" } }, - { Flag, - "client_cert_not_required", - 0, - translate("Don't require client certificate"), - { client="0" }, { client="" } }, { Flag, "username_as_common_name", 0, @@ -591,10 +567,6 @@ local knownParams = { "engine", "dynamic", translate("Enable OpenSSL hardware crypto engines") }, - { Flag, - "no_replay", - 0, - translate("Disable replay protection") }, { Value, "replay_window", "64 15", @@ -607,10 +579,6 @@ local knownParams = { "replay_persist", "/var/run/openvpn-replay-state", translate("Persist replay-protection state") }, - { Flag, - "no_iv", - 0, - translate("Disable cipher initialisation vector") }, { Flag, "tls_server", 0, diff --git a/applications/luci-app-openvpn/luasrc/model/cbi/openvpn-basic.lua b/applications/luci-app-openvpn/luasrc/model/cbi/openvpn-basic.lua index 3f651c0ada..483860c8e9 100644 --- a/applications/luci-app-openvpn/luasrc/model/cbi/openvpn-basic.lua +++ b/applications/luci-app-openvpn/luasrc/model/cbi/openvpn-basic.lua @@ -4,7 +4,6 @@ require("luci.ip") require("luci.model.uci") - local basicParams = { -- -- Widget, Name, Default(s), Description @@ -14,14 +13,12 @@ local basicParams = { { Value, "nice",0, translate("Change process priority") }, { Value,"port",1194, translate("TCP/UDP port # for both local and remote") }, { ListValue,"dev_type",{ "tun", "tap" }, translate("Type of used device") }, - { Flag,"tun_ipv6",0, translate("Make tun device IPv6 capable") }, { Value,"ifconfig","10.200.200.3 10.200.200.1", translate("Set tun/tap adapter parameters") }, { Value,"server","10.200.200.0 255.255.255.0", translate("Configure server mode") }, { Value,"server_bridge","192.168.1.1 255.255.255.0 192.168.1.128 192.168.1.254", translate("Configure server bridge") }, { Flag,"nobind",0, translate("Do not bind to local address and port") }, - { ListValue,"comp_lzo",{"yes","no","adaptive"}, translate("Use fast LZO compression") }, { Value,"keepalive","10 60", translate("Helper directive to simplify the expression of --ping and --ping-restart in server mode configurations") }, { ListValue,"proto",{ "udp", "tcp-client", "tcp-server" }, translate("Use protocol") }, diff --git a/applications/luci-app-openvpn/luasrc/model/cbi/openvpn.lua b/applications/luci-app-openvpn/luasrc/model/cbi/openvpn.lua index 93a901e9b8..e17aa4085b 100644 --- a/applications/luci-app-openvpn/luasrc/model/cbi/openvpn.lua +++ b/applications/luci-app-openvpn/luasrc/model/cbi/openvpn.lua @@ -52,21 +52,22 @@ function s.create(self, name) luci.cbi.CREATE_PREFIX .. self.config .. "." .. self.sectiontype .. ".select" ) - name = luci.http.formvalue( + local name = luci.http.formvalue( luci.cbi.CREATE_PREFIX .. self.config .. "." .. self.sectiontype .. ".text" ) if #name > 3 and not name:match("[^a-zA-Z0-9_]") then - uci:section( - "openvpn", "openvpn", name, - { uci:get_all( "openvpn_recipes", recipe ) } - ) - - uci:delete("openvpn", name, "_role") - uci:delete("openvpn", name, "_description") - uci:save("openvpn") - - luci.http.redirect( self.extedit:format(name) ) + local s = uci:section("openvpn", "openvpn", name) + if s then + local options = uci:get_all("openvpn_recipes", recipe) + for k, v in pairs(options) do + uci:set("openvpn", name, k, v) + end + uci:delete("openvpn", name, "_role") + uci:delete("openvpn", name, "_description") + uci:save("openvpn") + luci.http.redirect( self.extedit:format(name) ) + end elseif #name > 0 then self.invalid_cts = true end -- cgit v1.2.3