From 791a71d225bf8c65ca4f126f19c44f3d4f93d408 Mon Sep 17 00:00:00 2001 From: Jo-Philipp Wich Date: Mon, 26 Sep 2022 11:15:55 +0200 Subject: [PATCH] luci-base: sys.uc: fix parsing conntrack list Ensure that the extracted tuple string starts with a space to fully match all contained key-value pairs. Signed-off-by: Jo-Philipp Wich --- modules/luci-base/ucode/sys.uc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/modules/luci-base/ucode/sys.uc b/modules/luci-base/ucode/sys.uc index 5bbaa8b19d..33a7ac7d76 100644 --- a/modules/luci-base/ucode/sys.uc +++ b/modules/luci-base/ucode/sys.uc @@ -49,7 +49,7 @@ export function conntrack_list(callback) { if (nfct) { for (let line = nfct.read('line'); length(line); line = nfct.read('line')) { - let m = match(line, /^(ipv[46]) +([0-9]+) +\S+ +([0-9]+) +(.+)\n$/); + let m = match(line, /^(ipv[46]) +([0-9]+) +\S+ +([0-9]+)( +.+)\n$/); if (!m) continue; @@ -60,7 +60,7 @@ export function conntrack_list(callback) { let tuples = m[4]; let timeout = null; - m = match(tuples, /^([0-9]+) (.+)$/); + m = match(tuples, /^ +([0-9]+)( .+)$/); if (m) { timeout = m[1]; -- 2.30.2