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 <jo@mein.io>
This commit is contained in:
Jo-Philipp Wich 2022-09-26 11:15:55 +02:00
parent 60a9f01978
commit 791a71d225

View file

@ -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];