From 5a0adcbae0f845b124fa3625b7d31144ec84b00d 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 --- gluon/gluon-config-mode/Makefile | 2 +- .../model/cbi/gluon-config-mode/wizard.lua | 36 +++++++++++-------- 2 files changed, 23 insertions(+), 15 deletions(-) diff --git a/gluon/gluon-config-mode/Makefile b/gluon/gluon-config-mode/Makefile index 8596187..75babcd 100644 --- a/gluon/gluon-config-mode/Makefile +++ b/gluon/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/gluon/gluon-config-mode/files/usr/lib/lua/luci/model/cbi/gluon-config-mode/wizard.lua b/gluon/gluon-config-mode/files/usr/lib/lua/luci/model/cbi/gluon-config-mode/wizard.lua index 89a635d..d14a638 100644 --- a/gluon/gluon-config-mode/files/usr/lib/lua/luci/model/cbi/gluon-config-mode/wizard.lua +++ b/gluon/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")