Skip to content

Commit

Permalink
gluon-mesh-vpn: support ingress bandwidth shaping with tunneldigger (#…
Browse files Browse the repository at this point in the history
…1460)

Signed-off-by: Felix Kaechele <[email protected]>
  • Loading branch information
kaechele authored and rotanid committed Jul 25, 2018
1 parent b9b61ed commit d87c4b5
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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)"))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit d87c4b5

Please sign in to comment.