luci-mod-admin-full: use nf_conntrack_count
for counting connections (#1114)
As suggested by PR #1114, use `/proc/sys/net/netfilter/nf_conntrack_count` instead of counting the lines in `/proc/net/nf_conntrack` but use a slightly more efficient approach which avoids spawning an extra `cat` command. Signed-off-by: Jo-Philipp Wich <jo@mein.io>
This commit is contained in:
parent
29fabe2639
commit
16ffea4bf5
1 changed files with 2 additions and 4 deletions
|
@ -37,10 +37,8 @@
|
|||
local wan = ntm:get_wannet()
|
||||
local wan6 = ntm:get_wan6net()
|
||||
|
||||
local conn_count = tonumber((
|
||||
luci.sys.exec("wc -l /proc/net/nf_conntrack") or
|
||||
luci.sys.exec("wc -l /proc/net/ip_conntrack") or
|
||||
""):match("%d+")) or 0
|
||||
local conn_count = tonumber(
|
||||
fs.readfile("/proc/sys/net/netfilter/nf_conntrack_count")) or 0
|
||||
|
||||
local conn_max = tonumber((
|
||||
luci.sys.exec("sysctl net.nf_conntrack_max") or
|
||||
|
|
Loading…
Reference in a new issue