A list bound to a VLAN interface is evaluated, in both directions (#1517) #1612

Merged
jaylouisw merged 1 commit from fix/1116-0540 into main 2026-11-16 06:08:36 +00:00
Owner

interface Gi0/0.10 + encapsulation dot1q 10 is this console's VLAN interface: the interface the box terminates and routes VLAN 10 at. ip access-group 101 in was accepted there, running-config printed the binding back inside the subinterface's block, and the forwarding path only ever asked the physical port for a policy - so the list was respected by every surface an operator reads and evaluated by nothing.

It failed open: a lab that binds a policy to a VLAN interface and then checks that the VLAN is isolated passes while the isolation does nothing. Same for out.

What changed

  • engine/simulator.js
    • _aclBound(dev, iface, dir) - is there a policy here at all, asked before evaluating so a caller can decide which interface to consult without paying for a lookup that always permits.
    • _vlanIfaceName(dev, ifaceName, vid) - the VLAN interface a frame arriving in vid on ifaceName is handled by, i.e. the subinterface whose encapVid is that VLAN.
    • ingress (_processFrame): the port's in list is still asked first, then the VLAN interface's in list. A denial is attributed to the interface that denied it.
    • egress (_emitFrame): the out list is looked up on the subinterface when one is bound, otherwise on the physical port - so a port-level binding keeps working exactly as before, and a frame routed out of a VLAN interface passes through that interface's policy.

Reproduction, before the fix

Router-on-a-stick: PC1 in VLAN 10, PC2 in VLAN 20, Gi0/0.10/Gi0/0.20, ACL 101 deny ip any any.

% ping 10.20.20.10        -> ok (1/1)          <- should be refused
show running-config       -> ip access-group 101 in   (inside interface Gi0/0.10)
acl-deny events           -> 0

After:

ping 10.20.20.10  -> 0/1, "ACL 101 denied (in) (dropped by R1)"
openFlow          -> E_ACL_DENY, "denied by access list 101 in Gi0/0.10 on R1"
show interfaces Gi0/0.10 -> 2 drops ("ACL 101 denied (in)" x2)

Tests

test/acl-vlan-interface.test.js - 25 assertions: the lab itself (two VLAN interfaces, a clean baseline), in deny (ping, reason, one event, attributed to the subinterface, list number), a flow refused with E_ACL_DENY naming the interface, out deny, scope (VLAN 20 talking to its own VLAN interface is untouched while VLAN 10 is refused), a permit list permitting, counters + running-config agreement, and no regression for a list on the physical port.

Against the previous engine/simulator.js the same file gives 13 failures; with the fix 25/25.

Full suite: 268 suites, 9686 assertions passed, 1 failed - test/property-validator.test.js (random link seed 30: unknown code E_PROTOCOL_MISMATCH), which fails identically on unmodified origin/main (3/3 runs with this change stashed), so it is pre-existing and unrelated. Syntax check: 338 files, all OK.

Not covered here: an ACL on a VLAN interface is still only as good as the routing model - the box has no SVIs, so interface Gi0/0.10 is the VLAN interface this fix speaks about.

Fixes #1517

`interface Gi0/0.10` + `encapsulation dot1q 10` is this console's VLAN interface: the interface the box terminates and routes VLAN 10 at. `ip access-group 101 in` was accepted there, `running-config` printed the binding back inside the subinterface's block, and the forwarding path only ever asked the **physical** port for a policy - so the list was respected by every surface an operator reads and evaluated by nothing. It failed **open**: a lab that binds a policy to a VLAN interface and then checks that the VLAN is isolated passes while the isolation does nothing. Same for `out`. ## What changed - `engine/simulator.js` - `_aclBound(dev, iface, dir)` - is there a policy here at all, asked before evaluating so a caller can decide *which* interface to consult without paying for a lookup that always permits. - `_vlanIfaceName(dev, ifaceName, vid)` - the VLAN interface a frame arriving in `vid` on `ifaceName` is handled by, i.e. the subinterface whose `encapVid` is that VLAN. - ingress (`_processFrame`): the port's `in` list is still asked first, then the VLAN interface's `in` list. A denial is attributed to the interface that denied it. - egress (`_emitFrame`): the `out` list is looked up on the subinterface when one is bound, otherwise on the physical port - so a port-level binding keeps working exactly as before, and a frame routed out of a VLAN interface passes through that interface's policy. ## Reproduction, before the fix Router-on-a-stick: PC1 in VLAN 10, PC2 in VLAN 20, `Gi0/0.10`/`Gi0/0.20`, ACL 101 `deny ip any any`. ``` % ping 10.20.20.10 -> ok (1/1) <- should be refused show running-config -> ip access-group 101 in (inside interface Gi0/0.10) acl-deny events -> 0 ``` After: ``` ping 10.20.20.10 -> 0/1, "ACL 101 denied (in) (dropped by R1)" openFlow -> E_ACL_DENY, "denied by access list 101 in Gi0/0.10 on R1" show interfaces Gi0/0.10 -> 2 drops ("ACL 101 denied (in)" x2) ``` ## Tests `test/acl-vlan-interface.test.js` - 25 assertions: the lab itself (two VLAN interfaces, a clean baseline), `in` deny (ping, reason, one event, attributed to the subinterface, list number), a flow refused with `E_ACL_DENY` naming the interface, `out` deny, scope (VLAN 20 talking to its own VLAN interface is untouched while VLAN 10 is refused), a permit list permitting, counters + running-config agreement, and no regression for a list on the physical port. Against the previous `engine/simulator.js` the same file gives **13 failures**; with the fix **25/25**. Full suite: **268 suites, 9686 assertions passed, 1 failed** - `test/property-validator.test.js` (random link seed 30: `unknown code E_PROTOCOL_MISMATCH`), which fails identically on unmodified `origin/main` (3/3 runs with this change stashed), so it is pre-existing and unrelated. Syntax check: 338 files, all OK. Not covered here: an ACL on a *VLAN interface* is still only as good as the routing model - the box has no SVIs, so `interface Gi0/0.10` is the VLAN interface this fix speaks about. Fixes #1517
An access list on a VLAN interface is evaluated, in both directions (#1517)
Some checks failed
CI / Classify the change (pull_request) Successful in 10s
PR rebase / Rebase onto main and arm auto-merge (pull_request) Successful in 13s
CI / Docker build (pull_request) Successful in 30s
CI / Server smoke test (pull_request) Successful in 33s
CI / Test (Node 20) (pull_request) Failing after 1m28s
CI / Test (Node 18) (pull_request) Failing after 1m40s
CI / Test (Node 22) (pull_request) Failing after 14m12s
afb871ac87
jaylouisw scheduled this pull request to auto merge when all checks succeed 2026-11-16 06:08:24 +00:00
Sign in to join this conversation.
No reviewers
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!1612
No description provided.