gluon-config-mode: add simple-tc settings for mesh_vpn

This commit is contained in:
Nils Schneider 2013-10-03 23:00:47 +02:00
parent 05633089c4
commit 2468154ad1
2 changed files with 23 additions and 15 deletions

View File

@ -15,7 +15,7 @@ define Package/gluon-config-mode
SECTION:=gluon SECTION:=gluon
CATEGORY:=Gluon CATEGORY:=Gluon
TITLE:=Luci based config mode for user friendly setup of new meshnodes 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 endef
define Package/gluon-config-mode/description define Package/gluon-config-mode/description

View File

@ -15,22 +15,29 @@ o.value = uci:get_first("system", "system", "hostname")
o.rmempty = false o.rmempty = false
o.datatype = "hostname" 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 = s:option(Flag, "_meshvpn", "Mesh-VPN aktivieren?")
o.default = uci:get_bool("fastd", meshvpn_name, "enabled") and o.enabled or o.disabled o.default = uci:get_bool("fastd", meshvpn_name, "enabled") and o.enabled or o.disabled
o.rmempty = false o.rmempty = false
local upstream, downstream o = s:option(Flag, "_limit_enabled", "Bandbreitenbegrenzung aktivieren?")
upstream = string.format("%d KBit/s", uci:get_first("freifunk", "bandwidth", "upstream")) o.default = uci:get_bool("gluon-simple-tc", meshvpn_name, "enabled") and o.enabled or o.disabled
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.rmempty = false o.rmempty = false
o.description = downstream .. " Downstream / " .. upstream .. " Upstream"
o = s:option(Flag, "_autoupdate", "Automatische Updates aktivieren?") o = s:option(Value, "_limit_ingress", "Downstream")
o.default = uci:get_bool("autoupdater", "settings", "enabled") and o.enabled or o.disabled o.value = uci:get("gluon-simple-tc", meshvpn_name, "limit_ingress")
o.rmempty = false 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.") 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:save("autoupdater")
uci:commit("autoupdater") uci:commit("autoupdater")
uci:foreach("freifunk", "bandwidth", function(s) uci:set("gluon-simple-tc", meshvpn_name, "interface")
uci:set("freifunk", s[".name"], "enabled", data._bwlimit) uci:set("gluon-simple-tc", meshvpn_name, "enabled", data._limit_enabled)
end) uci:set("gluon-simple-tc", meshvpn_name, "ifname", meshvpn_name)
uci:save("freifunk") uci:set("gluon-simple-tc", meshvpn_name, "limit_ingress", data._limit_ingress)
uci:commit("freifunk") 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:set("fastd", meshvpn_name, "enabled", data._meshvpn)
uci:save("fastd") uci:save("fastd")