Skip to content
Snippets Groups Projects
Commit d87c4b52 authored by Felix Kaechele's avatar Felix Kaechele Committed by Andreas Ziegler
Browse files

gluon-mesh-vpn: support ingress bandwidth shaping with tunneldigger (#1460)

parent b9b61ed7
No related branches found
No related tags found
No related merge requests found
......@@ -41,14 +41,25 @@ return function(form, uci)
uci:set("simple-tc", "mesh_vpn", "interface")
uci:set("simple-tc", "mesh_vpn", "enabled", data)
uci:set("simple-tc", "mesh_vpn", "ifname", "mesh-vpn")
if not data and has_tunneldigger then
uci:delete("tunneldigger", "mesh_vpn", "limit_bw_down")
end
end
o = s:option(Value, "limit_ingress", pkg_i18n.translate("Downstream (kbit/s)"))
o:depends(limit, true)
o.default = uci:get("simple-tc", "mesh_vpn", "limit_ingress")
if has_tunneldigger then
o.default = uci:get("tunneldigger", "mesh_vpn", "limit_bw_down")
else
o.default = uci:get("simple-tc", "mesh_vpn", "limit_ingress")
end
o.datatype = "uinteger"
function o:write(data)
uci:set("simple-tc", "mesh_vpn", "limit_ingress", data)
if has_tunneldigger then
uci:set("tunneldigger", "mesh_vpn", "limit_bw_down", data)
else
uci:set("simple-tc", "mesh_vpn", "limit_ingress", data)
end
end
o = s:option(Value, "limit_egress", pkg_i18n.translate("Upstream (kbit/s)"))
......
......@@ -79,6 +79,11 @@ uci:save('fastd')
if has_tunneldigger then
uci:set('tunneldigger', 'mesh_vpn', 'enabled', enabled)
if site.mesh_vpn.bandwidth_limit.enabled(false) then
uci:set('tunneldigger', 'mesh_vpn', 'limit_bw_down', site.mesh_vpn.bandwidth_limit.ingress())
uci:set('simple-tc', 'mesh_vpn', 'limit_ingress', 0)
uci:save('simple-tc')
end
else
uci:delete('tunneldigger', 'mesh_vpn')
end
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment