projects
/
project
/
luci.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Merge pull request #831 from danrl/patch-1
[project/luci.git]
/
modules
/
luci-base
/
luasrc
/
sys.lua
diff --git
a/modules/luci-base/luasrc/sys.lua
b/modules/luci-base/luasrc/sys.lua
index
ae35652
..
a972717
100644
(file)
--- a/
modules/luci-base/luasrc/sys.lua
+++ b/
modules/luci-base/luasrc/sys.lua
@@
-325,12
+325,10
@@
function net.conntrack(callback)
local line, connt = nil, (not callback) and { }
for line in nfct do
local line, connt = nil, (not callback) and { }
for line in nfct do
- local fam, l3, l4, timeout,
state,
tuples =
- line:match("^(ipv[46]) +(%d+) +%S+ +(%d+) +(%d+) +(
[A-Z_]+) +(
.+)$")
+ local fam, l3, l4, timeout, tuples =
+ line:match("^(ipv[46]) +(%d+) +%S+ +(%d+) +(%d+) +(.+)$")
- if fam and l3 and l4 and timeout and state and tuples and
- state ~= "TIME_WAIT"
- then
+ if fam and l3 and l4 and timeout and not tuples:match("^TIME_WAIT ") then
l4 = nixio.getprotobynumber(l4)
local entry = {
l4 = nixio.getprotobynumber(l4)
local entry = {
@@
-345,7
+343,11
@@
function net.conntrack(callback)
for key, val in tuples:gmatch("(%w+)=(%S+)") do
if key == "bytes" or key == "packets" then
entry[key] = entry[key] + tonumber(val, 10)
for key, val in tuples:gmatch("(%w+)=(%S+)") do
if key == "bytes" or key == "packets" then
entry[key] = entry[key] + tonumber(val, 10)
- elseif key == "src" or key == "dst" or key == "sport" or key == "dport" then
+ elseif key == "src" or key == "dst" then
+ if entry[key] == nil then
+ entry[key] = luci.ip.new(val):string()
+ end
+ elseif key == "sport" or key == "dport" then
if entry[key] == nil then
entry[key] = val
end
if entry[key] == nil then
entry[key] = val
end