From 224addc2b33311ed73300b2a7b84ca27f3ae8a35 Mon Sep 17 00:00:00 2001 From: Nils Schneider Date: Mon, 23 Jul 2012 22:04:08 +0200 Subject: [PATCH] bandwidth fields --- luci/config-mode/files/etc/config/ffhl | 3 +++ .../usr/lib/lua/luci/model/cbi/ffhl-wizard/meshvpn.lua | 8 ++++++++ 2 files changed, 11 insertions(+) diff --git a/luci/config-mode/files/etc/config/ffhl b/luci/config-mode/files/etc/config/ffhl index 5993307..614978e 100644 --- a/luci/config-mode/files/etc/config/ffhl +++ b/luci/config-mode/files/etc/config/ffhl @@ -2,3 +2,6 @@ config wizard option enabled '1' +config bandwidth + option upstream 0 + option downstream 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 6bd76d6..eb59cab 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 @@ -9,12 +9,20 @@ meshvpn = f:field(Flag, "meshvpn", "Mesh-VPN aktivieren?") meshvpn.default = string.format("%d", uci:get("fastd", "ffhl_mesh_vpn", "enabled")) meshvpn.rmempty = false +upstream = f:field(Value, "upstream", "Upstream bandwidth (kbit/s)") +upstream.default = uci:get("ffhl", "bandwidth", "upstream") +downstream = f:field(Value, "dowstream", "Downstream bandwidth (kbit/s)") +downstream.default = uci:get("ffhl", "bandwidth", "downstream") + function f.handle(self, state, data) if state == FORM_VALID then local stat = false uci:set("fastd", "ffhl_mesh_vpn", "enabled", data.meshvpn) uci:save("fastd") uci:commit("fastd") + + uci:set("ffhl", "bandwidth", "upstream", data.upstream) + uci:set("ffhl", "bandwidth", "downstream", data.downstream) if data.meshvpn == "1" then local secret = uci:get("fastd", "ffhl_mesh_vpn", "secret")