mirror of
https://github.com/logicog/RTLPlayground.git
synced 2026-08-30 14:52:51 +08:00
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:
+3
-1
@@ -1568,8 +1568,10 @@ void cmd_parser(void) __banked
|
|||||||
uint8_t port;
|
uint8_t port;
|
||||||
port = cmd_buffer[cmd_words_b[1]] - '1';
|
port = cmd_buffer[cmd_words_b[1]] - '1';
|
||||||
port = machine.phys_to_log_port[port];
|
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);
|
port_pvid_set(port, pvid);
|
||||||
|
else
|
||||||
|
print_string("Error: pvid <port> <1-4094>\n");
|
||||||
} else if (cmd_compare(0, "vlan")) {
|
} else if (cmd_compare(0, "vlan")) {
|
||||||
parse_vlan();
|
parse_vlan();
|
||||||
} else if (cmd_compare(0, "isolate")) {
|
} else if (cmd_compare(0, "isolate")) {
|
||||||
|
|||||||
Reference in New Issue
Block a user