1234567891011121314151617181920 |
- #!/usr/bin/lua
- require 'luci.sys'
- local sysctl = require 'gluon.sysctl'
- function sysctl_set_if_lower(_key, _value)
- local command = "sysctl " .. _key
- if (tonumber(luci.sys.exec(command):match('%d+', 34)) or 128) < _value then
- sysctl.set(_key, _value)
- end
- end
- sysctl_set_if_lower('net.ipv4.neigh.default.gc_thresh1', 192)
- sysctl_set_if_lower('net.ipv4.neigh.default.gc_thresh2', 640)
- sysctl_set_if_lower('net.ipv4.neigh.default.gc_thresh3', 1280)
- sysctl_set_if_lower('net.ipv6.neigh.default.gc_thresh1', 512)
- sysctl_set_if_lower('net.ipv6.neigh.default.gc_thresh2', 1024)
- sysctl_set_if_lower('net.ipv6.neigh.default.gc_thresh3', 1536)
- os.execute('sync; sysctl -qp')
|