cli: a saved config names its VLAN and its access list after the port that uses them, so a restore silently drops the ACL binding #1766

Closed
opened 2026-11-17 01:55:46 +00:00 by jaylouisw · 0 comments
Owner

The measurement

On a WS-C3560CX-8PC-S, configure a VLAN, an ACL, and a port that uses both:

enable
configure terminal
vlan 10 name sales
access-list 101 permit tcp any any eq 443
access-list 101 deny ip any any
interface Gi1/0/9
switchport mode access
switchport access vlan 10
ip access-group 101 in
exit
end

show running-config prints the port first and the objects it names afterwards:

interface Gi1/0/9
  switchport access vlan 10
  switchport mode access
  ip access-group 101 in
exit
vlan 10 sales
access-list 101 permit tcp any any eq 443
access-list 101 deny ip any any

Pasted back into a second switch of the same model, that text is rejected twice:

% Access VLAN does not exist.
% Access list 101 does not exist

The VLAN's assignment is applied anyway (the console auto-creates it, as Cisco's does), but the ACL
binding is dropped outright: the source switch reports aclBindings = {"Gi1/0/9":{"in":101}} and
show access-lists says applied IN on Gi1/0/9; the restored switch reports {} and the port filters
nothing. Nothing in the replay output says the port lost its filter, so a backup/restore silently
weakens the device - the failure mode is a hole, not an error.

Why

The printer writes the interface blocks first, then the VLAN table, then the access lists. Both parsers
refuse a reference to an object that does not exist yet, and an interface line is allowed to make exactly
that reference (switchport access vlan <id>, ip access-group <acl> in|out). Replayability of the
printed text is the property the page claims (#1230, #1232); the order of the references defeats it.

The fix

Print the VLAN table and the access lists before the interface blocks. Both are plain config-mode lines
with no sub-mode, so nothing else in the order changes.

test/config-roundtrip.test.js gains six assertions (the VLAN is defined above the port that names it,
the access list is defined above the port that binds it, nothing is rejected on the way back in,
the ACL binding survives the restore, in and out, and the byte-identical config). Five of the six fail
on the previous printer; all pass after.

Measured after the change: node scripts/syntax-check.js -> 369 files, all OK; npm test -> 298 suites,
10521 assertions, 0 failed.

## The measurement On a `WS-C3560CX-8PC-S`, configure a VLAN, an ACL, and a port that uses both: ``` enable configure terminal vlan 10 name sales access-list 101 permit tcp any any eq 443 access-list 101 deny ip any any interface Gi1/0/9 switchport mode access switchport access vlan 10 ip access-group 101 in exit end ``` `show running-config` prints the port first and the objects it names afterwards: ``` interface Gi1/0/9 switchport access vlan 10 switchport mode access ip access-group 101 in exit vlan 10 sales access-list 101 permit tcp any any eq 443 access-list 101 deny ip any any ``` Pasted back into a second switch of the same model, that text is rejected twice: ``` % Access VLAN does not exist. % Access list 101 does not exist ``` The VLAN's assignment is applied anyway (the console auto-creates it, as Cisco's does), but the ACL binding is **dropped outright**: the source switch reports `aclBindings = {"Gi1/0/9":{"in":101}}` and `show access-lists` says `applied IN on Gi1/0/9`; the restored switch reports `{}` and the port filters nothing. Nothing in the replay output says the port lost its filter, so a backup/restore silently weakens the device - the failure mode is a hole, not an error. ## Why The printer writes the interface blocks first, then the VLAN table, then the access lists. Both parsers refuse a reference to an object that does not exist yet, and an interface line is allowed to make exactly that reference (`switchport access vlan <id>`, `ip access-group <acl> in|out`). Replayability of the printed text is the property the page claims (#1230, #1232); the order of the references defeats it. ## The fix Print the VLAN table and the access lists before the interface blocks. Both are plain config-mode lines with no sub-mode, so nothing else in the order changes. `test/config-roundtrip.test.js` gains six assertions (`the VLAN is defined above the port that names it`, `the access list is defined above the port that binds it`, `nothing is rejected on the way back in`, `the ACL binding survives the restore, in and out`, and the byte-identical config). Five of the six fail on the previous printer; all pass after. Measured after the change: `node scripts/syntax-check.js` -> 369 files, all OK; `npm test` -> 298 suites, 10521 assertions, 0 failed.
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#1766
No description provided.