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
Labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
jaylouisw/packetforge#1766
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
The measurement
On a
WS-C3560CX-8PC-S, configure a VLAN, an ACL, and a port that uses both:show running-configprints the port first and the objects it names afterwards:Pasted back into a second switch of the same model, that text is rejected twice:
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}}andshow access-listssaysapplied IN on Gi1/0/9; the restored switch reports{}and the port filtersnothing. 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 theprinted 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.jsgains 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 failon 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.