A port moved to another VLAN keeps its old MAC entries, and a stale row reads as live #1255

Closed
opened 2026-11-09 19:16:49 +00:00 by jaylouisw · 0 comments
Owner

What happens

Move a port from one VLAN to another and the switch keeps every MAC it learned there, forever:

SW1#show mac address-table
Vlan    Mac Address         Type        Ports
1       02:00:00:00:01:00   DYNAMIC     Fa0/1
1       02:00:00:00:02:00   DYNAMIC     Fa0/2

SW1(config-if)#interface Fa0/2
SW1(config-if)#switchport access vlan 20

SW1#show mac address-table
Vlan    Mac Address         Type        Ports
1       02:00:00:00:01:00   DYNAMIC     Fa0/1
1       02:00:00:00:02:00   DYNAMIC     Fa0/2      <- Fa0/2 is VLAN 20 now

A VLAN-1 entry on a port that is access VLAN 20 is not a forwarding decision any switch could make, and
nothing in this engine ever removes it: MAC entries are learned and overwritten but never aged out, and a
membership change does not touch them.

The second half is presentation. Every row looks identical whether its port is up, shut, uncabled, or does
not exist, so a stale row reads as a live one. (Same defect as show arp before #1253.)

What a real switch does

Flushes the dynamic entries for a port whose VLAN membership changes, and ages the rest out on a timer.
This engine has no aging, so the flush is the fix and the marking is what covers the rest.

Checked, and not a defect

Before filing this I chased the dangerous version of it — does the stale entry forward a VLAN-1 frame into a
VLAN-20 port? Measured: no. The switch drops with no egress ports in VLAN 1, and the only frame a moved
host receives is the switch's own LLDP. VLAN isolation holds; this is a table that lies, not a leak.

Expected

  • Device.flushMacsOnPort(name) — one call, every VLAN — invoked whenever a port's membership changes:
    switchport access vlan, switchport mode, switchport trunk native vlan,
    switchport trunk allowed vlan, and no switchport / switchport reset;
  • show mac address-table marks a row whose port cannot carry a frame (with the reason, the same sentence
    show arp uses), and a row whose VLAN the port does not carry, as (vlan mismatch);
  • a row pointing at a port that does not exist says (name: gone) rather than printing [object Object] or
    nothing;
  • shutting a port does not flush: real switches age entries, and the mark is what says the row is stale.

Scope

The existing table and the existing switchport commands. No new commands.

## What happens Move a port from one VLAN to another and the switch keeps every MAC it learned there, forever: ``` SW1#show mac address-table Vlan Mac Address Type Ports 1 02:00:00:00:01:00 DYNAMIC Fa0/1 1 02:00:00:00:02:00 DYNAMIC Fa0/2 SW1(config-if)#interface Fa0/2 SW1(config-if)#switchport access vlan 20 SW1#show mac address-table Vlan Mac Address Type Ports 1 02:00:00:00:01:00 DYNAMIC Fa0/1 1 02:00:00:00:02:00 DYNAMIC Fa0/2 <- Fa0/2 is VLAN 20 now ``` A VLAN-1 entry on a port that is access VLAN 20 is not a forwarding decision any switch could make, and nothing in this engine ever removes it: MAC entries are learned and overwritten but never aged out, and a membership change does not touch them. The second half is presentation. Every row looks identical whether its port is up, shut, uncabled, or does not exist, so a stale row reads as a live one. (Same defect as `show arp` before #1253.) ## What a real switch does Flushes the dynamic entries for a port whose VLAN membership changes, and ages the rest out on a timer. This engine has no aging, so the flush is the fix and the marking is what covers the rest. ## Checked, and *not* a defect Before filing this I chased the dangerous version of it — does the stale entry forward a VLAN-1 frame into a VLAN-20 port? Measured: no. The switch drops with `no egress ports in VLAN 1`, and the only frame a moved host receives is the switch's own LLDP. VLAN isolation holds; this is a table that lies, not a leak. ## Expected * `Device.flushMacsOnPort(name)` — one call, every VLAN — invoked whenever a port's membership changes: `switchport access vlan`, `switchport mode`, `switchport trunk native vlan`, `switchport trunk allowed vlan`, and `no switchport` / `switchport` reset; * `show mac address-table` marks a row whose port cannot carry a frame (with the reason, the same sentence `show arp` uses), and a row whose VLAN the port does not carry, as `(vlan mismatch)`; * a row pointing at a port that does not exist says `(name: gone)` rather than printing `[object Object]` or nothing; * shutting a port does **not** flush: real switches age entries, and the mark is what says the row is stale. ## Scope The existing table and the existing switchport commands. No new commands.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
jaylouisw/packetforge#1255
No description provided.