luci-mod-status: iptables.js: fix parsing IP addresses in rules

Rework the regexp pattern to allow both IP addresses without mask
and IPv6 addresses with netmask instead of CIDR notation.

Fixes: #2495, #2530
Fixes: f6bfac211 ("luci-mod-status: rework iptables status page")
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
This commit is contained in:
Jo-Philipp Wich 2019-02-12 07:57:35 +01:00
parent 8e4780a65d
commit 83df3eb6c7

View file

@ -165,7 +165,7 @@ function parse_output(table, s)
else if (m[1].match(/^num /)) { else if (m[1].match(/^num /)) {
continue; continue;
} }
else if ((m2 = m[1].match(/^(\d+) +(\d+) +(\d+) +(.*?) +(\S+) +(\S*) +(\S+) +(\S+) +([a-f0-9:.]+\/\d+) +([a-f0-9:.]+\/\d+) +(.+)$/)) !== null) { else if ((m2 = m[1].match(/^(\d+) +(\d+) +(\d+) +(.*?) +(\S+) +(\S*) +(\S+) +(\S+) +([a-f0-9:.]+(?:\/[a-f0-9:.]+)?) +([a-f0-9:.]+(?:\/[a-f0-9:.]+)?) +(.+)$/)) !== null) {
var num = +m2[1], var num = +m2[1],
pkts = +m2[2], pkts = +m2[2],
bytes = +m2[3], bytes = +m2[3],