From 2468154ad11ae5d5988cb21c488f6e0b842770a4 Mon Sep 17 00:00:00 2001 From: Nils Schneider Date: Thu, 3 Oct 2013 23:00:47 +0200 Subject: [PATCH] gluon-config-mode: add simple-tc settings for mesh_vpn --- package/gluon-config-mode/Makefile | 2 +- .../model/cbi/gluon-config-mode/wizard.lua | 36 +++++++++++-------- 2 files changed, 23 insertions(+), 15 deletions(-) diff --git a/package/gluon-config-mode/Makefile b/package/gluon-config-mode/Makefile index 85961871..75babcdd 100644 --- a/package/gluon-config-mode/Makefile +++ b/package/gluon-config-mode/Makefile @@ -15,7 +15,7 @@ define Package/gluon-config-mode SECTION:=gluon CATEGORY:=Gluon TITLE:=Luci based config mode for user friendly setup of new meshnodes - DEPENDS:=+gluon-core +gluon-location +uhttpd +dnsmasq +luci-mod-admin-core +ip +luci-theme-openwrt +haveged + DEPENDS:=+gluon-core +gluon-location +gluon-simple-tc +uhttpd +dnsmasq +luci-mod-admin-core +ip +luci-theme-openwrt +haveged endef define Package/gluon-config-mode/description diff --git a/package/gluon-config-mode/files/usr/lib/lua/luci/model/cbi/gluon-config-mode/wizard.lua b/package/gluon-config-mode/files/usr/lib/lua/luci/model/cbi/gluon-config-mode/wizard.lua index 89a635d5..d14a638e 100644 --- a/package/gluon-config-mode/files/usr/lib/lua/luci/model/cbi/gluon-config-mode/wizard.lua +++ b/package/gluon-config-mode/files/usr/lib/lua/luci/model/cbi/gluon-config-mode/wizard.lua @@ -15,22 +15,29 @@ o.value = uci:get_first("system", "system", "hostname") o.rmempty = false o.datatype = "hostname" +o = s:option(Flag, "_autoupdate", "Automatische Updates aktivieren?") +o.default = uci:get_bool("autoupdater", "settings", "enabled") and o.enabled or o.disabled +o.rmempty = false + +s = f:section(SimpleSection, "Mesh-VPN", nil) + o = s:option(Flag, "_meshvpn", "Mesh-VPN aktivieren?") o.default = uci:get_bool("fastd", meshvpn_name, "enabled") and o.enabled or o.disabled o.rmempty = false -local upstream, downstream -upstream = string.format("%d KBit/s", uci:get_first("freifunk", "bandwidth", "upstream")) -downstream = string.format("%d KBit/s", uci:get_first("freifunk", "bandwidth", "downstream")) - -o = s:option(Flag, "_bwlimit", "Bandbreitenbegrenzung aktivieren?") -o.default = uci:get_first("freifunk", "bandwidth", "enabled", "0") +o = s:option(Flag, "_limit_enabled", "Bandbreitenbegrenzung aktivieren?") +o.default = uci:get_bool("gluon-simple-tc", meshvpn_name, "enabled") and o.enabled or o.disabled o.rmempty = false -o.description = downstream .. " Downstream / " .. upstream .. " Upstream" -o = s:option(Flag, "_autoupdate", "Automatische Updates aktivieren?") -o.default = uci:get_bool("autoupdater", "settings", "enabled") and o.enabled or o.disabled +o = s:option(Value, "_limit_ingress", "Downstream") +o.value = uci:get("gluon-simple-tc", meshvpn_name, "limit_ingress") o.rmempty = false +o.datatype = "integer" + +o = s:option(Value, "_limit_egress", "Upstream") +o.value = uci:get("gluon-simple-tc", meshvpn_name, "limit_egress") +o.rmempty = false +o.datatype = "integer" s = f:section(SimpleSection, "GPS Koordinaten", "Hier kannst du die GPS Koordinaten deines Knotens festlegen damit er in der Karte angezeigt werden kann.") @@ -56,11 +63,12 @@ function f.handle(self, state, data) uci:save("autoupdater") uci:commit("autoupdater") - uci:foreach("freifunk", "bandwidth", function(s) - uci:set("freifunk", s[".name"], "enabled", data._bwlimit) - end) - uci:save("freifunk") - uci:commit("freifunk") + uci:set("gluon-simple-tc", meshvpn_name, "interface") + uci:set("gluon-simple-tc", meshvpn_name, "enabled", data._limit_enabled) + uci:set("gluon-simple-tc", meshvpn_name, "ifname", meshvpn_name) + uci:set("gluon-simple-tc", meshvpn_name, "limit_ingress", data._limit_ingress) + uci:set("gluon-simple-tc", meshvpn_name, "limit_egress", data._limit_egress) + uci:commit("gluon-simple-tc") uci:set("fastd", meshvpn_name, "enabled", data._meshvpn) uci:save("fastd")