From 1e19a9abe28c3127c239a2f589ce1cad69320500 Mon Sep 17 00:00:00 2001 From: d00f Date: Sat, 8 Aug 2026 17:38:10 +0200 Subject: [PATCH] cmd: bound the PVID and say something when it is refused "pvid 1 5000" packed 5000 into the 12-bit PVID field and truncated on the way, so the port ended up with a PVID nobody chose. 0 and anything above 4094 are refused now, matching what the VLAN table can hold. A failed parse used to be dropped without a word; both cases print the usage line. --- cmd_parser.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/cmd_parser.c b/cmd_parser.c index e10d8c7..a7d1d0d 100644 --- a/cmd_parser.c +++ b/cmd_parser.c @@ -1568,8 +1568,10 @@ void cmd_parser(void) __banked uint8_t port; port = cmd_buffer[cmd_words_b[1]] - '1'; port = machine.phys_to_log_port[port]; - if (!atoi_short(&pvid, cmd_words_b[2])) + if (!atoi_short(&pvid, cmd_words_b[2]) && pvid && pvid <= 4094) port_pvid_set(port, pvid); + else + print_string("Error: pvid <1-4094>\n"); } else if (cmd_compare(0, "vlan")) { parse_vlan(); } else if (cmd_compare(0, "isolate")) {