add tc disable field

This commit is contained in:
Nils Schneider 2012-07-24 00:54:04 +02:00 committed by Matthias Schiffer
parent 7ce4cf07f6
commit 44e3850193
1 changed files with 10 additions and 0 deletions

View File

@ -9,6 +9,12 @@ meshvpn = f:field(Flag, "meshvpn", "Mesh-VPN aktivieren?")
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.rmempty = false
upstream = f:field(Value, "upstream", "Upstream bandwidth (kbit/s)")
upstream.value = uci:get_first("ffhl", "bandwidth", "upstream")
downstream = f:field(Value, "downstream", "Downstream bandwidth (kbit/s)")
@ -21,9 +27,13 @@ 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)
end
)