diff options
author | Cody R. Brown <dev@codybrown.ca> | 2017-01-27 20:32:21 -0800 |
---|---|---|
committer | Cody R. Brown <dev@codybrown.ca> | 2017-01-28 07:20:23 -0800 |
commit | dd0b5cfd16eaea51b3653a91a1e136898d685849 (patch) | |
tree | 8b84903efedab2c9e27f392620517a7e09418c01 /protocols/luci-proto-ipip/luasrc/model | |
parent | f5461669afa4aba943ecc5800d9a468fb0ce1cd0 (diff) |
luci-app-upnp: Adding and displaying "Description" to upnp data
Getting the Description data from upnp_lease_file. This data often displays the Application Name which made the upnp call. If the upnp_lease_file doesn't exist, it'll just return a blank entry under "Description".
upnp_lease_file order example: TCP:33333:192.168.0.100:33333:1485578298:NAT-PMP 33333 tcp
As an optimisation, since the upnp_lease_file has only active leases and is ordered by epoch timestamp (5th column above), and since "iptables --line-numbers -t nat -xnvL MINIUPNPD" has active leases and is also displayed in order of rule applied (time). This means the order of these two sources will be the same. This prevents us from "searching" the upnp_lease_file for every rule, and instead for the n'th rule, look at the n'th upnp_lease_file line. As a result we only need to read in one line at a time. For a safety, the upnp_lease_file description is always checked to see if it matches the rule it's being assigned to. If it doesn't match it'll return blank. This means we'll never put an incorrect description to a upnp rule, even if someone messes with the upnp_lease_file.
This is the case on my system, more testing may be necessary? If this is false we'll need to loop over the upnp_lease_file for every rule, or read in the whole upnp_lease_file once for the iptables loop.
The Description column is added to the upnp_status, and the "Delete Redirect" renamed to "Delete" to make more horizontal space in the table.
Signed-off-by: Cody R. Brown <dev@codybrown.ca>
Diffstat (limited to 'protocols/luci-proto-ipip/luasrc/model')
0 files changed, 0 insertions, 0 deletions