diff options
author | Ansuel Smith <ansuelsmth@gmail.com> | 2018-06-17 19:31:43 +0200 |
---|---|---|
committer | Ansuel Smith <ansuelsmth@gmail.com> | 2018-07-03 17:46:39 +0200 |
commit | afd14fb9c71b4874292dc93c0a9e59142b443805 (patch) | |
tree | ee8503b5aaed344a4fd2fa1c4ab74eb975e8f51c /applications/luci-app-upnp/luasrc/controller/upnp.lua | |
parent | cde13dc2459fa20ad0f889dbee925c7bdddaf806 (diff) |
luci-app-upnp: add hostname info
This adds the hostname info in the index page of luci.
Signed-off-by: Ansuel Smith <ansuelsmth@gmail.com>
Diffstat (limited to 'applications/luci-app-upnp/luasrc/controller/upnp.lua')
-rw-r--r-- | applications/luci-app-upnp/luasrc/controller/upnp.lua | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/applications/luci-app-upnp/luasrc/controller/upnp.lua b/applications/luci-app-upnp/luasrc/controller/upnp.lua index 95a0ef4862..c4762434c5 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 } |