180-increase-arp-caches 673 B

1234567891011121314151617181920
  1. #!/usr/bin/lua
  2. require 'luci.sys'
  3. local sysctl = require 'gluon.sysctl'
  4. function sysctl_set_if_lower(_key, _value)
  5. local command = "sysctl " .. _key
  6. if (tonumber(luci.sys.exec(command):match('%d+', 34)) or 128) < _value then
  7. sysctl.set(_key, _value)
  8. end
  9. end
  10. sysctl_set_if_lower('net.ipv4.neigh.default.gc_thresh1', 192)
  11. sysctl_set_if_lower('net.ipv4.neigh.default.gc_thresh2', 640)
  12. sysctl_set_if_lower('net.ipv4.neigh.default.gc_thresh3', 1280)
  13. sysctl_set_if_lower('net.ipv6.neigh.default.gc_thresh1', 512)
  14. sysctl_set_if_lower('net.ipv6.neigh.default.gc_thresh2', 1024)
  15. sysctl_set_if_lower('net.ipv6.neigh.default.gc_thresh3', 1536)
  16. os.execute('sync; sysctl -qp')