From 592b9033054984db67a6475022441911fb3b3894 Mon Sep 17 00:00:00 2001 From: Erdnusschokolade <96622762+Erdnusschokolade@users.noreply.github.com> Date: Tue, 2 Jun 2026 22:52:06 +0200 Subject: [PATCH 1/4] Fix conf_overwrite filter removing vlan mgmt entries MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The vlan/mgmt lookahead split (commit dcc60c3) correctly separated the patterns so that `vlan N mgmt` and `vlan N ` match different conf_overwrite entries. But the filter that applies the overwrite still used `item.startsWith(matchStr + " ")` with matchStr = "vlan N", which also matches "vlan N mgmt" — so the management entry was removed whenever the VLAN's membership definition was re-saved. Example: with both `vlan 44 management 2t 4t 5 6t` and `vlan 44 mgmt` in the config, changing the membership dropped `vlan 44 mgmt` entirely. Added a `!item.endsWith(" mgmt")` guard so management entries survive the filter. No reordering is needed: `vlan N mgmt` only sets the global management_vlan variable (cmd_parser.c) and does not depend on the VLAN table entry existing, so its position in the config is irrelevant. --- html/config.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/html/config.js b/html/config.js index dd8512b..b9e2e9c 100644 --- a/html/config.js +++ b/html/config.js @@ -71,7 +71,7 @@ function parseConf(s){ let m = line.match(x); let matchStr = m[0]; configuration = configuration.filter(item => - !(item === matchStr || item.startsWith(matchStr + " "))); + !(item === matchStr || (item.startsWith(matchStr + " ") && !item.endsWith(" mgmt")))); break; } } From 06ee1ce38ea566ad12706b00c649a07d7fed0432 Mon Sep 17 00:00:00 2001 From: Erdnusschokolade <96622762+Erdnusschokolade@users.noreply.github.com> Date: Thu, 18 Jun 2026 14:44:19 +0200 Subject: [PATCH 2/4] Persist port speed settings in config parser parseConf() only recognized "port N name" in conf_cmds, so "port N " lines were treated as unknown commands and dropped on save - configured port speeds never persisted. Add the speed command (incl. optional half/full duplex suffix) to conf_cmds, add a "port N" entry to conf_overwrite so re-saving a speed replaces the previous value, and guard the per-port name entry so changing a port's speed no longer wipes its configured name. --- html/config.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/html/config.js b/html/config.js index b9e2e9c..fd426e9 100644 --- a/html/config.js +++ b/html/config.js @@ -14,6 +14,7 @@ const conf_cmds = [ /^pvid\s+\d{1,2}\s+\d{1,4}$/, /^ingress(\s+\d{1,2}[tua])+$/, /^ingress\s+[tua]$/, + /^port\s+\d{1,2}\s+(10m|100m|1g|2g5|5g|10g|auto|on|off)(\s+(half|full))?$/, /^port\s+\d{1,2}\s+name\s+\S+$/, /^eee(\s+\d{1,2})?\s+(on|off)$/, /^mirror(\s+\d{1,2})(\s+\d{1,2}[tr]?)+$/, @@ -36,6 +37,7 @@ const conf_overwrite = [ /^vlan\s+\d{1,4}(?!\s+mgmt\b)/, /^pvid\s+\d{1,2}\b/, /^ingress\b/, + /^port\s+\d{1,2}(?!\s+name\b)/, /^port\s+\d{1,2}\s+name\b/, /^eee\s+\d{1,2}\b/, /^eee\b/, @@ -71,7 +73,7 @@ function parseConf(s){ let m = line.match(x); let matchStr = m[0]; configuration = configuration.filter(item => - !(item === matchStr || (item.startsWith(matchStr + " ") && !item.endsWith(" mgmt")))); + !(item === matchStr || (item.startsWith(matchStr + " ") && !item.endsWith(" mgmt") && !item.startsWith(matchStr + " name ")))); break; } } From 718745e7b52e78fa4a4cf8c59909648bc1d6075a Mon Sep 17 00:00:00 2001 From: Erdnusschokolade <96622762+Erdnusschokolade@users.noreply.github.com> Date: Sat, 20 Jun 2026 08:00:54 +0200 Subject: [PATCH 3/4] Reduce stale management VLAN entries on config save The firmware has a single management VLAN (one management_vlan variable), so a stored config should never carry more than one "vlan N mgmt" line. When parsing a mgmt command, drop any previously stored mgmt entry so repeatedly changing the management VLAN no longer accumulates stale lines. --- html/config.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/html/config.js b/html/config.js index fd426e9..d54a556 100644 --- a/html/config.js +++ b/html/config.js @@ -77,6 +77,9 @@ function parseConf(s){ break; } } + // Only one management VLAN can be active, so drop any previous mgmt entry + if (/^vlan\s+\d{1,4}\s+mgmt$/.test(line)) + configuration = configuration.filter(item => !/^vlan\s+\d{1,4}\s+mgmt$/.test(item)); configuration.push(line); } console.log("Configuration now:"); From 4eaf16f96d84525c416f63380561e2a26f9ee807 Mon Sep 17 00:00:00 2001 From: Erdnusschokolade <96622762+Erdnusschokolade@users.noreply.github.com> Date: Sat, 20 Jun 2026 08:13:43 +0200 Subject: [PATCH 4/4] Drop dead exact-match check in vlan delete filter A bare "vlan N" line never matches conf_cmds (a VLAN entry always carries a member port or the mgmt/name keyword), so it is never stored. The c !== "vlan N" comparison could therefore never match an entry; the startsWith(prefix) check alone covers all stored vlan lines. --- html/config.js | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/html/config.js b/html/config.js index d54a556..6efa283 100644 --- a/html/config.js +++ b/html/config.js @@ -59,8 +59,7 @@ function parseConf(s){ const deleteMatch = line.match(/^vlan\s+(\d{1,4})\s+d$/); if (deleteMatch) { const prefix = "vlan " + deleteMatch[1] + " "; - configuration = configuration.filter(c => - c !== "vlan " + deleteMatch[1] && !c.startsWith(prefix)); + configuration = configuration.filter(c => !c.startsWith(prefix)); continue; } console.log(l + ' --> ' + line);