290-legacy-simple-tc 599 B

12345678910111213141516171819202122232425262728
  1. #!/usr/bin/lua
  2. local site = require 'gluon.site_config'
  3. local sysconfig = require 'gluon.sysconfig'
  4. local uci = require('luci.model.uci').cursor()
  5. if sysconfig.gluon_version == 'legacy' then
  6. for _, config in ipairs(site.legacy.tc_configs) do
  7. local s = uci:get_first(config, 'bandwidth')
  8. if s then
  9. old = uci:get_all(config, s)
  10. uci:section('simple-tc', 'interface', 'mesh_vpn',
  11. {
  12. ifname = 'mesh-vpn',
  13. enabled = old.enabled,
  14. limit_ingress = old.downstream,
  15. limit_egress = old.upstream,
  16. }
  17. )
  18. uci:save('simple-tc')
  19. break
  20. end
  21. end
  22. end