Merge pull request #1933 from Ansuel/hostname_upnp
luci-app-upnp: add hostname info
This commit is contained in:
commit
98f4c3cf50
2 changed files with 14 additions and 0 deletions
|
@ -21,6 +21,8 @@ end
|
||||||
function act_status()
|
function act_status()
|
||||||
local uci = luci.model.uci.cursor()
|
local uci = luci.model.uci.cursor()
|
||||||
local lease_file = uci:get("upnpd", "config", "upnp_lease_file")
|
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")
|
local ipt = io.popen("iptables --line-numbers -t nat -xnvL MINIUPNPD 2>/dev/null")
|
||||||
if ipt then
|
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 uln then descr = uln:match(string.format("^%s:%d:%s:%d:%%d*:(.*)$", proto:upper(), extport, intaddr, intport)) end
|
||||||
if not descr then descr = "" end
|
if not descr then descr = "" end
|
||||||
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] = {
|
fwd[#fwd+1] = {
|
||||||
num = num,
|
num = num,
|
||||||
proto = proto:upper(),
|
proto = proto:upper(),
|
||||||
extport = extport,
|
extport = extport,
|
||||||
intaddr = intaddr,
|
intaddr = intaddr,
|
||||||
|
host_hint = host_hint,
|
||||||
intport = intport,
|
intport = intport,
|
||||||
descr = descr
|
descr = descr
|
||||||
}
|
}
|
||||||
|
|
|
@ -23,6 +23,7 @@
|
||||||
st[i].proto,
|
st[i].proto,
|
||||||
st[i].extport,
|
st[i].extport,
|
||||||
st[i].intaddr,
|
st[i].intaddr,
|
||||||
|
st[i].host_hint || "<%:Unknown%>",
|
||||||
st[i].intport,
|
st[i].intport,
|
||||||
st[i].descr,
|
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))
|
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"><%:Protocol%></div>
|
||||||
<div class="th"><%:External Port%></div>
|
<div class="th"><%:External Port%></div>
|
||||||
<div class="th"><%:Client Address%></div>
|
<div class="th"><%:Client Address%></div>
|
||||||
|
<div class="th"><%:Host%></div>
|
||||||
<div class="th"><%:Client Port%></div>
|
<div class="th"><%:Client Port%></div>
|
||||||
<div class="th"><%:Description%></div>
|
<div class="th"><%:Description%></div>
|
||||||
<div class="th cbi-section-actions"> </div>
|
<div class="th cbi-section-actions"> </div>
|
||||||
|
|
Loading…
Reference in a new issue