luci-mod-status: iptables.js: fix parsing IP addresses in rules
authorJo-Philipp Wich <jo@mein.io>
Tue, 12 Feb 2019 06:57:35 +0000 (07:57 +0100)
committerJo-Philipp Wich <jo@mein.io>
Tue, 12 Feb 2019 06:57:35 +0000 (07:57 +0100)
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>
modules/luci-mod-status/htdocs/luci-static/resources/view/status/iptables.js

index 39ddab3979bde17c4a04cd7cc299c1caef5ce934..a742243a036faee8ad6977e8b4c50bb14fbaf9fb 100644 (file)
@@ -165,7 +165,7 @@ function parse_output(table, s)
                else if (m[1].match(/^num /)) {
                        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],
                            pkts = +m2[2],
                            bytes = +m2[3],