summaryrefslogtreecommitdiffhomepage
path: root/applications/luci-app-upnp
diff options
context:
space:
mode:
authorJo-Philipp Wich <jo@mein.io>2018-07-13 14:50:28 +0200
committerGitHub <noreply@github.com>2018-07-13 14:50:28 +0200
commit98f4c3cf50f52ace0c1f93135ef7a06291cb4650 (patch)
tree0b0c64f90a1b987d68e4876774e2bb78fa537cc8 /applications/luci-app-upnp
parent524ce90c4e22dcb64ac8e6c2e012eb54cd5f098e (diff)
parentafd14fb9c71b4874292dc93c0a9e59142b443805 (diff)
Merge pull request #1933 from Ansuel/hostname_upnp
luci-app-upnp: add hostname info
Diffstat (limited to 'applications/luci-app-upnp')
-rw-r--r--applications/luci-app-upnp/luasrc/controller/upnp.lua12
-rw-r--r--applications/luci-app-upnp/luasrc/view/upnp_status.htm2
2 files changed, 14 insertions, 0 deletions
diff --git a/applications/luci-app-upnp/luasrc/controller/upnp.lua b/applications/luci-app-upnp/luasrc/controller/upnp.lua
index 95a0ef486..c4762434c 100644
--- a/applications/luci-app-upnp/luasrc/controller/upnp.lua
+++ b/applications/luci-app-upnp/luasrc/controller/upnp.lua
@@ -21,6 +21,8 @@ end
function act_status()
local uci = luci.model.uci.cursor()
local lease_file = uci:get("upnpd", "config", "upnp_lease_file")
+
+ local ipv4_hints = luci.sys.net.ipv4_hints()
local ipt = io.popen("iptables --line-numbers -t nat -xnvL MINIUPNPD 2>/dev/null")
if ipt then
@@ -45,12 +47,22 @@ function act_status()
if uln then descr = uln:match(string.format("^%s:%d:%s:%d:%%d*:(.*)$", proto:upper(), extport, intaddr, intport)) end
if not descr then descr = "" end
end
+
+ local host_hint, _, e
+
+ for _,e in pairs(ipv4_hints) do
+ if e[1] == intaddr then
+ host_hint = e[2]
+ break
+ end
+ end
fwd[#fwd+1] = {
num = num,
proto = proto:upper(),
extport = extport,
intaddr = intaddr,
+ host_hint = host_hint,
intport = intport,
descr = descr
}
diff --git a/applications/luci-app-upnp/luasrc/view/upnp_status.htm b/applications/luci-app-upnp/luasrc/view/upnp_status.htm
index e5cb9854d..ea79e57a6 100644
--- a/applications/luci-app-upnp/luasrc/view/upnp_status.htm
+++ b/applications/luci-app-upnp/luasrc/view/upnp_status.htm
@@ -23,6 +23,7 @@
st[i].proto,
st[i].extport,
st[i].intaddr,
+ st[i].host_hint || "<%:Unknown%>",
st[i].intport,
st[i].descr,
E('<div><input class="cbi-button cbi-button-remove" type="button" value="<%:Delete%>" onclick="upnp_delete_fwd(%d)" /></div>'.format(st[i].num))
@@ -41,6 +42,7 @@
<div class="th"><%:Protocol%></div>
<div class="th"><%:External Port%></div>
<div class="th"><%:Client Address%></div>
+ <div class="th"><%:Host%></div>
<div class="th"><%:Client Port%></div>
<div class="th"><%:Description%></div>
<div class="th cbi-section-actions">&#160;</div>