Updated Tunneldigger packages to Gluon 2012.2

This commit is contained in:
CyrusFox 2015-11-27 01:49:35 +01:00
parent 8ebb23163d
commit a564386fa5
5 changed files with 50 additions and 12 deletions

View File

@ -14,7 +14,7 @@ define Package/gluon-config-mode-tunneldigger
SECTION:=gluon
CATEGORY:=Gluon
TITLE:=Toggle tunneldigger and bandwidth limit
DEPENDS:=gluon-config-mode-core-virtual +gluon-mesh-vpn-tunneldigger +gluon-simple-tc
DEPENDS:=gluon-config-mode-core-virtual +gluon-mesh-vpn-tunneldigger
endef
define Build/Prepare

View File

@ -21,18 +21,18 @@ function M.section(form)
o = s:option(cbi.Flag, "_limit_enabled", i18n.translate("Limit bandwidth"))
o:depends("_meshvpn", "1")
o.default = uci:get_bool("gluon-simple-tc", "mesh_vpn", "enabled") and o.enabled or o.disabled
o.default = uci:get_bool("simple-tc", "mesh_vpn", "enabled") and o.enabled or o.disabled
o.rmempty = false
o = s:option(cbi.Value, "_limit_ingress", i18n.translate("Downstream (kbit/s)"))
o:depends("_limit_enabled", "1")
o.value = uci:get("gluon-simple-tc", "mesh_vpn", "limit_ingress")
o.value = uci:get("simple-tc", "mesh_vpn", "limit_ingress")
o.rmempty = false
o.datatype = "integer"
o = s:option(cbi.Value, "_limit_egress", i18n.translate("Upstream (kbit/s)"))
o:depends("_limit_enabled", "1")
o.value = uci:get("gluon-simple-tc", "mesh_vpn", "limit_egress")
o.value = uci:get("simple-tc", "mesh_vpn", "limit_egress")
o.rmempty = false
o.datatype = "integer"
end
@ -44,20 +44,20 @@ function M.handle(data)
-- checks for nil needed due to o:depends(...)
if data._limit_enabled ~= nil then
uci:set("gluon-simple-tc", "mesh_vpn", "interface")
uci:set("gluon-simple-tc", "mesh_vpn", "enabled", data._limit_enabled)
uci:set("gluon-simple-tc", "mesh_vpn", "ifname", "mesh-vpn")
uci:set("simple-tc", "mesh_vpn", "interface")
uci:set("simple-tc", "mesh_vpn", "enabled", data._limit_enabled)
uci:set("simple-tc", "mesh_vpn", "ifname", "mesh-vpn")
if data._limit_ingress ~= nil then
uci:set("gluon-simple-tc", "mesh_vpn", "limit_ingress", data._limit_ingress)
uci:set("simple-tc", "mesh_vpn", "limit_ingress", data._limit_ingress)
end
if data._limit_egress ~= nil then
uci:set("gluon-simple-tc", "mesh_vpn", "limit_egress", data._limit_egress)
uci:set("simple-tc", "mesh_vpn", "limit_egress", data._limit_egress)
end
uci:commit("gluon-simple-tc")
uci:commit("gluon-simple-tc")
uci:commit("simple-tc")
uci:commit("simple-tc")
end
end

View File

@ -11,7 +11,7 @@ define Package/gluon-mesh-vpn-tunneldigger
SECTION:=gluon
CATEGORY:=Gluon
TITLE:=Support for connecting batman-adv meshes via tunneltigger/l2tpv3 pseudowire
DEPENDS:=+gluon-core gluon-mesh-batman-adv +gluon-wan-dnsmasq +tunneldigger +iptables-mod-extra
DEPENDS:=+gluon-core gluon-mesh-batman-adv +gluon-wan-dnsmasq +tunneldigger +iptables-mod-extra +simple-tc
endef
define Package/gluon-mesh-vpn-tunneldigger/description

View File

@ -1,3 +1,9 @@
need_number('tunneldigger_mesh_vpn.mtu')
need_boolean('tunneldigger_mesh_vpn.enabled', false)
need_string_array('tunneldigger_mesh_vpn.brokers')
if need_table('tunneldigger_mesh_vpn.bandwidth_limit', nil, false) then
need_boolean('tunneldigger_mesh_vpn.bandwidth_limit.enabled', false)
need_number('tunneldigger_mesh_vpn.bandwidth_limit.ingress', false)
need_number('tunneldigger_mesh_vpn.bandwidth_limit.egress', false)
end

View File

@ -0,0 +1,32 @@
#!/usr/bin/lua
local site = require 'gluon.site_config'
local uci = require('luci.model.uci').cursor()
local fs = require 'nixio.fs'
if fs.access('/etc/config/gluon-simple-tc') then
os.rename('/etc/config/gluon-simple-tc', '/etc/config/simple-tc')
end
if not uci:get('simple-tc', 'mesh_vpn') then
local config = {
ifname = 'mesh-vpn',
enabled = 0,
}
if site.tunneldigger_mesh_vpn.bandwidth_limit then
if site.tunneldigger_mesh_vpn.bandwidth_limit.enabled then
config.enabled = 1
end
config.limit_ingress = site.tunneldigger_mesh_vpn.bandwidth_limit.ingress
config.limit_egress = site.tunneldigger_mesh_vpn.bandwidth_limit.egress
end
uci:section('simple-tc', 'interface', 'mesh_vpn', config)
uci:save('simple-tc')
uci:commit('simple-tc')
end