Moving lldp cmd parsing to be above the is_sfp check to take precedence

Needed to increase buffer size for this to send app.js

The logical port status is what is returned in the array, for
non-sequential systems we need to map through physToLog rather
than just subtracting 1

physToLog is 1 based! not 0; also fixing up typecasts

Reimplementing using an array of objects to represent ports.
The previous approach of a bitmask of logical ports, was just too
simple on devices such as the SWGT024_V2_0_MANAGED which has
gaps in the port assignments.
This commit is contained in:
Rob Emery committed 2026-10-10 09:51:33 +01:00
1 parent 9b2bd7f1b8
commit dda873a633
5 files changed
+53 -35

No files matched your search

+8 -8
View File
@@ -914,6 +914,14 @@ void parse_port(void)
print_string("\nName set to: \"");
print_string_x(port_names[phy_settings.port]);
print_string("\"\n");
} else if (cmd_compare(2, "lldp")) {
if (cmd_compare(3, "block")){
lldp_logical_port_status &= ~((uint16_t)1 << phy_settings.port);
} else if (cmd_compare(3, "permit")) {
lldp_logical_port_status |= (uint16_t)1 << phy_settings.port;
} else {
print_string ("Unknown port <port> lldp [block|permit] command\n");
}
} else if (machine.is_sfp[phy_settings.port]) {
print_string(" is SFP no PHY information available.\n");
} else if (cmd_compare(2, "10m")) {
@@ -967,14 +975,6 @@ void parse_port(void)
else
phy_settings.duplex = PHY_DUPLEX_HALF;
phy_set_duplex();
} else if (cmd_compare(2, "lldp")) {
if (cmd_compare(3, "block")){
lldp_logical_port_status &= ~(1 << phy_settings.port);
} else if (cmd_compare(3, "permit")) {
lldp_logical_port_status |= 1 << phy_settings.port;
} else {
print_string ("Unknown port <port> lldp [block|permit] command\n");
}
} else {
cmd_error("Unknown port command\n");
}