Skip to content
Snippets Groups Projects
Commit 4d9e4f36 authored by Stefan Laudemann's avatar Stefan Laudemann
Browse files

Adds "is already larger" value-checks for the ARP table resizing.

Closes issue #2 by adding appropriate tests to the script as requested
by @hej, such that values that have already been set to a higher value
to not get changed.
parent 25734057
No related branches found
No related tags found
No related merge requests found
#!/usr/bin/lua
require 'luci.sys'
local sysctl = require 'gluon.sysctl'
sysctl.set('net.ipv4.neigh.default.gc_thresh1', 192)
sysctl.set('net.ipv4.neigh.default.gc_thresh2', 640)
sysctl.set('net.ipv4.neigh.default.gc_thresh3', 1280)
sysctl.set('net.ipv6.neigh.default.gc_thresh1', 512)
sysctl.set('net.ipv6.neigh.default.gc_thresh2', 1024)
sysctl.set('net.ipv6.neigh.default.gc_thresh3', 1536)
if (tonumber(luci.sys.exec('sysctl net.ipv4.neigh.default.gc_thresh1'):match('%d+', 34)) or 128) < 192 then
sysctl.set('net.ipv4.neigh.default.gc_thresh1', 192)
end
if (tonumber(luci.sys.exec('sysctl net.ipv4.neigh.default.gc_thresh2'):match('%d+', 34)) or 512) < 640 then
sysctl.set('net.ipv4.neigh.default.gc_thresh2', 640)
end
if (tonumber(luci.sys.exec('sysctl net.ipv4.neigh.default.gc_thresh3'):match('%d+', 34)) or 1024) < 1280 then
sysctl.set('net.ipv4.neigh.default.gc_thresh3', 1280)
end
if (tonumber(luci.sys.exec('sysctl net.ipv6.neigh.default.gc_thresh1'):match('%d+', 34)) or 128) < 512 then
sysctl.set('net.ipv6.neigh.default.gc_thresh1', 512)
end
if (tonumber(luci.sys.exec('sysctl net.ipv6.neigh.default.gc_thresh2'):match('%d+', 34)) or 512) < 1024 then
sysctl.set('net.ipv6.neigh.default.gc_thresh2', 1024)
end
if (tonumber(luci.sys.exec('sysctl net.ipv6.neigh.default.gc_thresh3'):match('%d+', 34)) or 1024) < 1536 then
sysctl.set('net.ipv6.neigh.default.gc_thresh3', 1536)
end
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment