port: pin the management MAC to the CPU port with a static L2 entry

The CPU's own MAC exists in the L2 table only as a learned entry,
created whenever the CPU transmits, and it ages out like any other
dynamic entry. Unknown unicast is not flooded to the CPU port, so on an
idle switch (no web session, no management traffic) the entry expires
after the aging time and frames for the management IP no longer reach
the CPU: pings die until the next CPU transmission (an ARP reply)
re-teaches the entry, then die again. Real management sessions keep the
entry alive continuously, which is why this is only visible on idle
switches.

Install a static entry for the management MAC on the CPU port after the
startup config has been replayed, so it lands in the final management
VLAN, and move it when the management VLAN is changed at runtime.

Entry mechanics, established on hardware: a table write with read-method
0 hashes the key in TBL_DATA_IN and places the entry itself (a search
returns index 0 on a miss, there is no software-visible insertion slot).
The age field in the third data word must be non-zero for the entry to
be visible to lookup at all, and the static flag (bit 0 of byte 1 of
that word) stops the aging engine from decrementing it: with the flag a
full-age entry survives untouched where an identical unflagged entry
ages to invisible within the aging period. With no management VLAN
configured the entry lives in VLAN 1.
This commit is contained in:
bloqaudio committed 2026-09-02 21:35:51 -05:00
1 parent 4c8e0ce975
commit 3b8dba6e87
4 files changed
+60

No files matched your search

+2
View File
@@ -2306,6 +2306,8 @@ void main(void)
early_boot_handle_button();
execute_config();
// After the config so the entry lands in the final management VLAN
port_l2_static_mgmt(uip_ethaddr.addr, management_vlan, false);
/* After the config: a name from it wins, otherwise derive one. */
set_hostname_default();
print_cmd_prompt();