From 73039fe51b507f3c48c7a24f6a194c31707dfbd1 Mon Sep 17 00:00:00 2001 From: Matthias Schiffer Date: Thu, 2 Aug 2012 21:32:47 +0200 Subject: [PATCH] Reverse logic for tc enable option --- luci/config-mode/files/etc/config/ffhl | 7 +++---- .../usr/lib/lua/luci/model/cbi/ffhl-wizard/meshvpn.lua | 9 ++------- 2 files changed, 5 insertions(+), 11 deletions(-) diff --git a/luci/config-mode/files/etc/config/ffhl b/luci/config-mode/files/etc/config/ffhl index c92aac7..3a58575 100644 --- a/luci/config-mode/files/etc/config/ffhl +++ b/luci/config-mode/files/etc/config/ffhl @@ -1,8 +1,7 @@ - config wizard option enabled '1' config bandwidth - option upstream 0 - option downstream 0 - option disabled 1 + option upstream '0' + option downstream '0' + option enabled '0' diff --git a/luci/config-mode/files/usr/lib/lua/luci/model/cbi/ffhl-wizard/meshvpn.lua b/luci/config-mode/files/usr/lib/lua/luci/model/cbi/ffhl-wizard/meshvpn.lua index 745c5b9..7eb016c 100644 --- a/luci/config-mode/files/usr/lib/lua/luci/model/cbi/ffhl-wizard/meshvpn.lua +++ b/luci/config-mode/files/usr/lib/lua/luci/model/cbi/ffhl-wizard/meshvpn.lua @@ -10,9 +10,7 @@ meshvpn.default = string.format("%d", uci:get("fastd", "ffhl_mesh_vpn", "enabled meshvpn.rmempty = false tc = f:field(Flag, "tc", "Bandbreitenbegrenzung aktivieren?") -local v = string.format("%d", uci:get_first("ffhl", "bandwidth", "disabled")) -if v == "1" then v = "0" else v = "1" end -tc.default = v +tc.default = string.format("%d", uci:get_first("ffhl", "bandwidth", "enabled")) tc.rmempty = false upstream = f:field(Value, "upstream", "Upstream bandwidth (kbit/s)") @@ -27,13 +25,10 @@ function f.handle(self, state, data) uci:save("fastd") uci:commit("fastd") - local v = string.format("%d", data.tc) - if v == "1" then v = "0" else v = "1" end - uci:foreach("ffhl", "bandwidth", function(s) uci:set("ffhl", s[".name"], "upstream", data.upstream) uci:set("ffhl", s[".name"], "downstream", data.downstream) - uci:set("ffhl", s[".name"], "disabled", v) + uci:set("ffhl", s[".name"], "enabled", data.tc) end )