gluon-mesh-vpn: support ingress bandwidth shaping with tunneldigger (#1460)
Signed-off-by: Felix Kaechele <felix@kaechele.ca>
This commit is contained in:
parent
b9b61ed79c
commit
d87c4b521b
@ -41,15 +41,26 @@ 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)
|
||||
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)
|
||||
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)"))
|
||||
o:depends(limit, true)
|
||||
|
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user