diff options
author | Jo-Philipp Wich <jo@mein.io> | 2017-04-20 16:55:29 +0200 |
---|---|---|
committer | Jo-Philipp Wich <jo@mein.io> | 2017-04-20 16:55:29 +0200 |
commit | 7ae244a26ef516511a5e476dd14ec033501a1d8d (patch) | |
tree | 16056db1c9c02bb12406aa961a81664dac3147a9 /modules | |
parent | 2eda14beee54d885ab2a607ca54beb48807999c6 (diff) |
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>
Diffstat (limited to 'modules')
-rw-r--r-- | modules/luci-mod-admin-full/luasrc/view/admin_status/index.htm | 6 |
1 files changed, 2 insertions, 4 deletions
diff --git a/modules/luci-mod-admin-full/luasrc/view/admin_status/index.htm b/modules/luci-mod-admin-full/luasrc/view/admin_status/index.htm index 206f9ef82..d29a89427 100644 --- a/modules/luci-mod-admin-full/luasrc/view/admin_status/index.htm +++ b/modules/luci-mod-admin-full/luasrc/view/admin_status/index.htm @@ -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 |