From f2966ad248e3fde26f53c5530129a597f4d150e5 Mon Sep 17 00:00:00 2001 From: d00f <8052722+DrDoof@users.noreply.github.com> Date: Sat, 5 Sep 2026 13:28:14 +0200 Subject: [PATCH 1/3] lag gui: create the group the page says it is creating The LAG page draws four sections headed LAG 1 to LAG 4 and wires their buttons to lagSub(0) through lagSub(3), which then sends the index straight through as the group number. So the first button asks for "lag 0", which the parser rejects, and the page shows nothing at all because the error only goes to the console. Every other button is off by one: the section headed LAG 2 creates group 1. The index stays 0-based for the element ids and only the command gets the 1-based number the CLI documents. --- html/lag.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/html/lag.js b/html/lag.js index 2c56d1a5..2a4e4f26 100644 --- a/html/lag.js +++ b/html/lag.js @@ -57,7 +57,7 @@ function fetchLag() { sendXHTTP(xhttp); } async function lagSub(l) { - var cmd = "lag " + l; + var cmd = "lag " + (l + 1); for (let i = 1; i <= numPorts; i++) { if (document.getElementById("p_mLAG"+l+"_"+i).checked) cmd = cmd + ` ${i}`; From ecac6d1934cbfe68bbe0cc5fe5d72cf8c2af5aa8 Mon Sep 17 00:00:00 2001 From: d00f <8052722+DrDoof@users.noreply.github.com> Date: Sat, 5 Sep 2026 13:28:15 +0200 Subject: [PATCH 2/3] lag: say what the command takes, and delete only when asked Two small things about the same command. The usage line offered "lag <1-4> [port]...", which leaves out "lag show" even though that is the only way to see the groups, so the one subcommand a reader most needs is the one the error does not mention. And a group number with no ports after it quietly wiped the group. That is a reasonable thing to want and an unreasonable thing to do by accident, as it is one fat-fingered return away from a bare "lag 1". It now takes "lag 1 delete" or "lag 1 d", and a bare group number prints the usage instead. Nothing changes for a saved configuration: "lag 1 5 6" is what gets written and what gets replayed, and neither the old bare form nor the new delete matches the pattern that decides what is persisted. --- cmd_parser.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/cmd_parser.c b/cmd_parser.c index bd2fc544..8798e8be 100644 --- a/cmd_parser.c +++ b/cmd_parser.c @@ -406,10 +406,16 @@ void parse_lag(void) if (group > 3) goto err; + if (cmd_words_len == 2) + goto err; + + if (cmd_compare(2, "delete") || cmd_compare(2, "d")) { + port_lag_members_set(group, 0); + return; + } + uint8_t w = 2; while (w < cmd_words_len) { -// write_char('|'); print_byte(w); write_char(':'); write_char(cmd_buffer[cmd_words_b[w]]); write_char('-'); - // Parse port. if (cmd_parse_port_separator(cmd_words_b[w++]) == 0) goto err; @@ -419,7 +425,7 @@ void parse_lag(void) port_lag_members_set(group, members); return; err: - print_string("Error: lag <1-4> [port]...\n"); + print_string("Error: lag (show | <1-4> (delete | ...))\n"); } From 078a446ceea2bbf15d9c394419857a21a3f0b5e8 Mon Sep 17 00:00:00 2001 From: d00f <8052722+DrDoof@users.noreply.github.com> Date: Sun, 6 Sep 2026 18:41:27 +0200 Subject: [PATCH 3/3] lag: address review, single arg-count check and "d" only Fold the "group with no ports" case into the argument-count guard (cmd_words_len < 3) instead of a separate check, and accept only "d" for delete, dropping the longer "delete" spelling. Update the serial-console docs to match. --- cmd_parser.c | 9 +++------ doc/link_aggregation.md | 8 +++++--- 2 files changed, 8 insertions(+), 9 deletions(-) diff --git a/cmd_parser.c b/cmd_parser.c index 8798e8be..4fc2b0cf 100644 --- a/cmd_parser.c +++ b/cmd_parser.c @@ -395,7 +395,7 @@ void parse_lag(void) return; } - if (cmd_words_len < 2) + if (cmd_words_len < 3) goto err; // Parse group, expect only one number 0-9; @@ -406,10 +406,7 @@ void parse_lag(void) if (group > 3) goto err; - if (cmd_words_len == 2) - goto err; - - if (cmd_compare(2, "delete") || cmd_compare(2, "d")) { + if (cmd_compare(2, "d")) { port_lag_members_set(group, 0); return; } @@ -425,7 +422,7 @@ void parse_lag(void) port_lag_members_set(group, members); return; err: - print_string("Error: lag (show | <1-4> (delete | ...))\n"); + print_string("Error: lag (show | <1-4> (d | ...))\n"); } diff --git a/doc/link_aggregation.md b/doc/link_aggregation.md index 6bde787e..b725e419 100644 --- a/doc/link_aggregation.md +++ b/doc/link_aggregation.md @@ -48,9 +48,11 @@ void port_lag_hash_set(__xdata uint8_t lag, __xdata uint8_t hash_bits) __banked; ## LAG configuration on the Serial Console For testing the following commands are provided on the serial console: ``` -> lag [p1] [p2]... - Create or set a LAG. Trunk-ID is 1 or 2. Ports are physical ports - If only the LAG-ID is given but no members, the LAG is deleted +> lag [p2]... + Create or set a LAG. LAG-ID is 1 to 4. Ports are physical ports. + +> lag d + Delete the LAG. > lag show Shows information on all 4 lags