summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorJo-Philipp Wich <jow@openwrt.org>2016-02-20 22:14:37 +0100
committerJo-Philipp Wich <jow@openwrt.org>2016-02-20 22:14:47 +0100
commit4323935a1eab53f3109066ec08c8cdfcdf69db75 (patch)
tree99dffb38e8190bc1014d1e352909d4d07094ef69
parent6ee5c593b3599af3696d3a1eb3440137f863a378 (diff)
luci-base: luci.sys: canonicalize src and dest addrs in luci.sys.net.conntrack()
Signed-off-by: Jo-Philipp Wich <jow@openwrt.org>
-rw-r--r--modules/luci-base/luasrc/sys.lua6
1 files changed, 5 insertions, 1 deletions
diff --git a/modules/luci-base/luasrc/sys.lua b/modules/luci-base/luasrc/sys.lua
index fb2c4b1f8..a97271732 100644
--- a/modules/luci-base/luasrc/sys.lua
+++ b/modules/luci-base/luasrc/sys.lua
@@ -343,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)
- 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