projects
/
project
/
luci.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
8cab9e2
)
libs/sys: ignore TIME_WAIT connections in luci.sys.net.conntrack()
author
Jo-Philipp Wich
<jow@openwrt.org>
Sun, 13 Mar 2011 22:08:32 +0000
(22:08 +0000)
committer
Jo-Philipp Wich
<jow@openwrt.org>
Sun, 13 Mar 2011 22:08:32 +0000
(22:08 +0000)
libs/sys/luasrc/sys.lua
patch
|
blob
|
history
diff --git
a/libs/sys/luasrc/sys.lua
b/libs/sys/luasrc/sys.lua
index
cc29fa3
..
53204b1
100644
(file)
--- a/
libs/sys/luasrc/sys.lua
+++ b/
libs/sys/luasrc/sys.lua
@@
-240,32
+240,36
@@
function net.conntrack(callback)
for line in io.lines("/proc/net/nf_conntrack") do
line = line:match "^(.-( [^ =]+=).-)%2"
local entry, flags = _parse_mixed_record(line, " +")
for line in io.lines("/proc/net/nf_conntrack") do
line = line:match "^(.-( [^ =]+=).-)%2"
local entry, flags = _parse_mixed_record(line, " +")
- entry.layer3 = flags[1]
- entry.layer4 = flags[3]
- for i=1, #entry do
- entry[i] = nil
- end
+ if flags[6] ~= "TIME_WAIT" then
+ entry.layer3 = flags[1]
+ entry.layer4 = flags[3]
+ for i=1, #entry do
+ entry[i] = nil
+ end
- if callback then
- callback(entry)
- else
- connt[#connt+1] = entry
+ if callback then
+ callback(entry)
+ else
+ connt[#connt+1] = entry
+ end
end
end
elseif fs.access("/proc/net/ip_conntrack", "r") then
for line in io.lines("/proc/net/ip_conntrack") do
line = line:match "^(.-( [^ =]+=).-)%2"
local entry, flags = _parse_mixed_record(line, " +")
end
end
elseif fs.access("/proc/net/ip_conntrack", "r") then
for line in io.lines("/proc/net/ip_conntrack") do
line = line:match "^(.-( [^ =]+=).-)%2"
local entry, flags = _parse_mixed_record(line, " +")
- entry.layer3 = "ipv4"
- entry.layer4 = flags[1]
- for i=1, #entry do
- entry[i] = nil
- end
+ if flags[4] ~= "TIME_WAIT" then
+ entry.layer3 = "ipv4"
+ entry.layer4 = flags[1]
+ for i=1, #entry do
+ entry[i] = nil
+ end
- if callback then
- callback(entry)
- else
- connt[#connt+1] = entry
+ if callback then
+ callback(entry)
+ else
+ connt[#connt+1] = entry
+ end
end
end
else
end
end
else