From a18b1a6beabb5d58ea7ddfa9ffb13c513290382c Mon Sep 17 00:00:00 2001 From: Kevin Darbyshire-Bryant Date: Fri, 30 Dec 2022 12:26:08 +0000 Subject: [PATCH] luci-mod-status: fix neighbour display The neighbour display parses the output of 'ip -4 neigh show' e.g. 192.168.219.95 dev eth1 lladdr 38:b4:d3:c9:b2:0c REACHABLE 192.168.219.200 dev eth1 lladdr 04:c4:61:12:f2:d2 STALE Using regexp /^([0-9a-f:.]+) (.+) (\S+)$/ Unfortunately there's a space character that sneaks in at the end of line, so let's make this less brittle by accepting lines that may end with spaces e.g. /^([0-9a-f:.]+) (.+) (\S+) *$/ Signed-off-by: Kevin Darbyshire-Bryant --- .../htdocs/luci-static/resources/view/status/routes.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/luci-mod-status/htdocs/luci-static/resources/view/status/routes.js b/modules/luci-mod-status/htdocs/luci-static/resources/view/status/routes.js index 9b9b06e223..3bcddf6aa7 100644 --- a/modules/luci-mod-status/htdocs/luci-static/resources/view/status/routes.js +++ b/modules/luci-mod-status/htdocs/luci-static/resources/view/status/routes.js @@ -87,7 +87,7 @@ return view.extend({ res = []; for (var i = 0; i < lines.length; i++) { - var m = lines[i].match(/^([0-9a-f:.]+) (.+) (\S+)$/), + var m = lines[i].match(/^([0-9a-f:.]+) (.+) (\S+) *$/), addr = m ? m[1] : null, flags = m ? m[2].trim().split(/\s+/) : [], state = (m ? m[3] : null) || 'FAILED'; -- 2.30.2