no vlan 20 deletes a VLAN that a port is still staged for as its voice VLAN #1701

Closed
opened 2026-11-16 18:10:51 +00:00 by jaylouisw · 1 comment
Owner

The transcript

On a Catalyst 2960 (and any switch in the catalogue), with switchport voice vlan on a port that is not a trunk - the one case the console itself calls stored:

switch(config)#vlan 20 name VOICE
VLAN 20 created (name: VOICE)
switch(config)#interface Fa0/1
switch(config-if)#switchport voice vlan 20
Voice VLAN 20 on Fa0/1 (stored; the port is in access mode - set "switchport mode trunk" to use it)
switch(config-if)#exit
switch(config)#no vlan 20
VLAN 20 removed                    <-- the reference is not named, and the VLAN goes

Afterwards the two surfaces describe different switches:

switch#show running-config
  switchport voice vlan 20          <-- a VLAN that is not configured
switch#show vlan brief
1    default   active  Fa0/1, ...
(no row 20)
switch#show interfaces Fa0/1
  switchport: access VLAN 1 · trunk staged: voice 20 (not in use)

and one command later it is not staged any more - it is in use, on a VLAN the switch does not have:

switch(config-if)#switchport mode trunk
Switchport mode trunk on Fa0/1
switch#show interfaces Fa0/1
  switchport: trunk · native 1 · allowed all · voice 20
switch#show vlan brief
(no row 20)

Why this is a defect rather than a policy

no vlan already refuses two kinds of reference and names them (engine/cli.js, the staged array):

  • a trunk that carries the VLAN: % VLAN 20 is still carried by 1 port(s): Fa0/1 - move them off it first;
  • a port that only references it - a native VLAN or an allowed list stored on a port that is not in trunk mode yet:
    % VLAN 20 is still referenced by 1 port(s): Fa0/1 (trunk native, trunk allowed, stored) - clear that first.

The second guard exists on the stated ground that removing the VLAN "rewrote the port's staged configuration in silence". switchport voice vlan (#1368) added a third staged reference, and the guard was never extended to it - so the last command that can leave a port pointing at a VLAN that does not exist is the only one that is not stopped.

The access VLAN reference is deliberately not refused (the device deletes the VLAN and the port goes inactive, vlan-delete-leaves-port-inactive.test.js); this is the other case, the one the console stores and does not use yet.

Expected

no vlan 20 refuses while any port has VLAN 20 staged as its voice VLAN, names the port and the field, and leaves both the VLAN and the port untouched - the same answer the other two staged references already get.

## The transcript On a Catalyst 2960 (and any switch in the catalogue), with `switchport voice vlan` on a port that is not a trunk - the one case the console itself calls *stored*: ``` switch(config)#vlan 20 name VOICE VLAN 20 created (name: VOICE) switch(config)#interface Fa0/1 switch(config-if)#switchport voice vlan 20 Voice VLAN 20 on Fa0/1 (stored; the port is in access mode - set "switchport mode trunk" to use it) switch(config-if)#exit switch(config)#no vlan 20 VLAN 20 removed <-- the reference is not named, and the VLAN goes ``` Afterwards the two surfaces describe different switches: ``` switch#show running-config switchport voice vlan 20 <-- a VLAN that is not configured switch#show vlan brief 1 default active Fa0/1, ... (no row 20) switch#show interfaces Fa0/1 switchport: access VLAN 1 · trunk staged: voice 20 (not in use) ``` and one command later it is not staged any more - it is in use, on a VLAN the switch does not have: ``` switch(config-if)#switchport mode trunk Switchport mode trunk on Fa0/1 switch#show interfaces Fa0/1 switchport: trunk · native 1 · allowed all · voice 20 switch#show vlan brief (no row 20) ``` ## Why this is a defect rather than a policy `no vlan` already refuses two kinds of reference and names them (`engine/cli.js`, the `staged` array): * a trunk that carries the VLAN: `% VLAN 20 is still carried by 1 port(s): Fa0/1 - move them off it first`; * a port that only *references* it - a native VLAN or an allowed list stored on a port that is not in trunk mode yet: `% VLAN 20 is still referenced by 1 port(s): Fa0/1 (trunk native, trunk allowed, stored) - clear that first`. The second guard exists on the stated ground that removing the VLAN "rewrote the port's staged configuration in silence". `switchport voice vlan` (#1368) added a third staged reference, and the guard was never extended to it - so the last command that can leave a port pointing at a VLAN that does not exist is the only one that is not stopped. The access VLAN reference is deliberately *not* refused (the device deletes the VLAN and the port goes inactive, `vlan-delete-leaves-port-inactive.test.js`); this is the other case, the one the console stores and does not use yet. ## Expected `no vlan 20` refuses while any port has VLAN 20 staged as its voice VLAN, names the port and the field, and leaves both the VLAN and the port untouched - the same answer the other two staged references already get.
Author
Owner

Fixed in PR #1705 (branch fix/1116-1805, commit 6f7ad821). The staged guard now names the voice VLAN with the native VLAN and the allowed list:

% VLAN 20 is still referenced by 1 port(s): Fa0/3 (trunk native, trunk allowed, voice, stored) - clear that first

Suites: 285 / 10237 assertions / 0 failed; syntax check 356 files all OK.

Fixed in PR #1705 (branch `fix/1116-1805`, commit `6f7ad821`). The staged guard now names the voice VLAN with the native VLAN and the allowed list: ``` % VLAN 20 is still referenced by 1 port(s): Fa0/3 (trunk native, trunk allowed, voice, stored) - clear that first ``` Suites: 285 / 10237 assertions / 0 failed; syntax check 356 files all OK.
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#1701
No description provided.