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.
This commit is contained in:
d00f
2026-08-08 17:38:10 +02:00
parent 1098e73337
commit 1e19a9abe2
+3 -1
View File
@@ -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 <port> <1-4094>\n");
} else if (cmd_compare(0, "vlan")) {
parse_vlan();
} else if (cmd_compare(0, "isolate")) {