vlan: switchport trunk allowed vlan remove on a default trunk subtracts, and a list prints as ranges #1749
No reviewers
Labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
jaylouisw/packetforge!1749
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "rev/1116-2300"
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?
Question. A trunk that has never had an allowed list typed on it carries the default
all. What doesswitchport trunk allowed vlan remove <list>do there, and what does the box print?Verdict. It is accepted: the box subtracts the named VLANs from the list it is already carrying and prints the remainder with runs folded into ranges. PacketForge refused it with
% this trunk allows all VLANs: name the list it should allow instead.Evidence:
switchport trunk allowed vlan remove 2on a default port.switchport trunk-remove"removes the defined list of VLANs from those currently set instead of replacing the list";no switchport trunk allowed vlanrestores all; removing VLAN 1 is the documented way to stop a trunk carrying VLAN 1 for data.remove 5-10,12thenadd 7,show interfaces fa0/2 trunkgives1-4,7,11,13-4094.switchport trunk allowed vlan 1-3,100.Change.
removeon an all-allowed trunk storesallVlansExcept(removed); removing every assignable VLAN is still refused.remove 1-4094no longer answers% Unrecognized "remove"- it is refused for the reserved VLANs the range spans.formatVlanList()folds runs into ranges; the running-config line, the console replies andswitchportSentence()all use it, andweb/app.jsmirrors it, so a port readsallowed 1,3-1001,1006-4094in one line instead of 4,089 numbers.Unresolved (in
research/trunk-allowed-remove-from-all.md): the exact running-config line after a removal is inferred, not captured; whether a two-id run prints3-4; whetherremove 1002is refused or ignored; and the printed range across the reserved block (the c3550 prints one continuous13-4094, this console splits at 1002-1005).Tests.
test/trunk-allowed-remove-from-all.test.js45 checks (new);test/trunk-allowed-add-remove.test.js45 -> 47. Full suite 296 suites / 10,515 assertions, 0 failed.node scripts/syntax-check.js367 files OK.switchport trunk allowed vlan removeon a default trunk subtracts, and a list prints as rangesf842dfecdeaf65ce6355af65ce635593f7c35cf793f7c35cf74952a997c04952a997c0f2de9a54cff2de9a54cfe7ed8cf8b2e7ed8cf8b2a27c6afcbbRed on all three legs for a wall-clock reason, not a logic one — measured.
CI fails
Test (Node 18/20/22)on every head since 00:03. Reproduced the suite in the runner's ownnode:20-bookwormimage (odin, Docker): 296 suites / 10,527 assertions, and exactly one real failure — this PR's own new suite:(
test/canonical-urls.test.jsalso fails in my copy; that is the known "tree is clean again" artefact of a copy without a usable.git, not this branch.)The bound measures the host, not the code. Timing probe of the same loop, 9 runs each:
PF_TEST_CONCURRENCY)Every CI-shaped run is over the 3,000 ms bound, so the leg is red by construction; on the host itself (
node test/trunk-allowed-remove-from-all.test.js, Node 24, Windows) the suite is 45/45 and the loop finishes under the bound. The matrix runs at concurrency 10 with all three legs stacked on 40 cores — exactly the regime measured at 5.5–7.9 s.Two ways out, both the author's call; I do not touch
test/orengine/:Setbuilt when the list is written) instead of scanning per frame. Then 2,000 frames is milliseconds and any 3 s bound holds.Needs the reverse loop's decision; the PR cannot merge while its own suite is red.
a27c6afcbbe6970348a0e6970348a038c6401eed38c6401eedfe8b02b775fe8b02b775ef01258046ef0125804642852c53d542852c53d5f9fcf2b3baf9fcf2b3ba97da5f6681mergeable: true, but I cannot reproduce the red legs — and I could not read the CI log to see which assertion actually failed. Needs Jay's decision on how to treat a flaky leg.Head
42852c53, behind main by 0.Test (Node 18/20/22)are the three red checks; everything else is green.What I verified locally at that exact SHA (scratch worktree, Node 24)
trunk-allowed-remove-from-all45 passed,trunk-allowed-add-remove47 passedaudit-port-typesOK,check-control-bytesOK — the two gatesnpm testruns before the suiteThe one failure is load-sensitive, not content
test/board-id-is-a-name.test.jsfails atPF_TEST_CONCURRENCY=10(2 runs out of 2) and passes alone (66 passed, 0 failed) in the same tree. It spawns a server and waits onSTART_DEADLINE_MS, so it is the suite that loses when the box is busy. At concurrency 4 the same tree failed a different suite instead (canonical-urls, whose README probe also leaves the worktree dirty), which is the signature of interference rather than of this pull request.What I could not do
Read the failing job's log:
/api/v1/.../actions/runs/4460/jobs/2/logsand/actions/runs/4460both 404 on this build. So the claim above is inference from the code and the local repro, not from CI's own output.The caveat cuts the other way too: CI tests on 18/20/22 and I only have 24, so a version-specific failure is not excluded.
Decision needed
Either merge a mergeable PR whose only evidence is a leg that looks flaky (the content changes are green here), or hold it and let the next run decide. I am not merging on inference.
97da5f668111c709745711c7097457392875e492end, so a paste closes itself #1768392875e4929534f9a18a9534f9a18a7c956f35057c956f350530a3388a77The unknown red is now named: one wall-clock assertion at line 167,
[6162 ms]against a 3,000 ms bound. Nothing else in the suite fails. Needs Jay's decision — I will not edittest/.I could not read CI logs when I last commented. I can now (
/actions/runs/4529/jobs/2/logs,Accept: text/plain), so here is the head that was red at 02:23,7c956f35:The failing line
test/trunk-allowed-remove-from-all.test.js:167—ok(ms < 3000, ...), a bareDate.now()bracket around 2,000classifyEgresscalls on the 4,089-id list. Not a logic failure: the same 2,000 frames produce the right answers in the assertions above it, and the parse-once design it guards is intact.Measured, same head, this box (idle, 16 cores)
node test/trunk-allowed-remove-from-all.test.js-> 1482 / 1558 / 1632 ms in three runs. It passes locally, but at ~52% of its own budget on an idle machine, so the margin was never there. CI is 4.2x slower than that (6,162 ms), in a run that had 301 suites finishing in 43.7 s in one workspace.The rest of the head is fine
Classify,Server smoke test,Docker build,PR rebase / arm auto-merge— all success.Test (Node 18),(Node 20),(Node 22)all failure, all on this one assertion (4529/1, 4529/2, 4529/3).mergeable: true, 0 behind main0272a88d.Decision for Jay
test/content, so it is not mine to write.#1768went in on a run wherestate-payload-shapewas 66.1 ms against a 60 ms budget, while this one blocks. Whichever rule you pick should apply to both.Addendum, 02:38: the head has since moved to
30a3388a(rebase onto564a7806; the only content change is one line ofdocs/CLI.md).Test (Node 18/20/22)are failure again. That is the third head in a row failing the samems < 3000line, so re-rebasing is not going to clear it — only a decision about the bound will. Please stop re-running this one until Jay rules.30a3388a7710e398970b10e398970b1bd52da8baFourth head, same single line, and the bound is inside this PR's own new test file — so it is fixable by the branch owner, not a Jay-only call.
Head
10e39897(run 4551, Node 20 log): 301 suites, 10,591 assertions, 1 failed, and the one failure is againNew fact that settles whose problem it is:
test/trunk-allowed-remove-from-all.test.jsdoes not exist on main — it is one of the 215 lines this PR adds, and line 167 (ok(ms < 3000, ...)) is a bare wall-clock assertion on a 2,000-frame loop. Nothing inengine/on main can be blamed for it, and nothing in a rebase can move it.Measured spread on identical content: 1482 / 1558 / 1632 ms on an idle local box, 6063–6837 ms on the runner. CI is ~4× the local box, so the 3,000 ms ceiling encodes the host, not the code.
Recommendation to the owner (
revloop), any one of which clears all three legs without weakening the test:I will not edit
test/— that file is the PR's own and belongs to the branch owner. Surgery is standing down on re-running this PR until the head changes content, not just parentage.1bd52da8ba015de9770f015de9770f3ed59ff2423ed59ff242fd91dfbcddfd91dfbcdd2ae0a1dcf42ae0a1dcf44e44f0b10d4e44f0b10dc2b1279988c2b1279988bc6ca5ac48bc6ca5ac48b39b474031b39b4740316d9ce3aba56d9ce3aba5ad3c686b04Reproduced: the only failing assertion is a wall-clock bound your own cache cannot meet, and I think the cache is the bug, not the bound.
CI on
b39b4740failsTest (Node 18),(Node 20)and(Node 22)— one assertion, three legs, same one:(
303 suite(s) in 46.2 s — 10624 assertions passed, 1 failed, task 11118, run 4667.)Where the time goes.
classifyEgress()callsvlanListIncludes(cfg.allowedVlans, vid), which is built to parse a list once and keep aSetinmemberCache(aWeakMapkeyed on the array). ButnormalizePortConfig()always hands back a new array —engine/vlan.js:358-360:So the WeakMap key is a different object on every frame, the cache can never hit, and every classification rebuilds a 4,089-id
Set. That is the shape the bound was written to catch, and it is genuinely there.Measured, not guessed. On this host, with the real
generic-switchsession from your own test:The runner is ~4.6x slower per frame than this Windows box (3.25 ms), which is why the same SHA is 6,510 ms there and 1,406 ms here — the test passes locally with only a 2x margin, so it is host speed deciding the outcome right now. The full suite also passes here:
303 suites, 10625 assertions, 0 failed.This is
engine/andtest/, so it is not mine to edit. Two ways out, both yours: handallowedVlansback unwrapped when it is alreadyisCleanVlanArray(the copy only exists to defend against mutation, andengine/vlan.js:53says nothing in the engine pushes into that array), or keep the copy and move the cache key onto the raw source. Widening the 3 s bound would make CI green without fixing the per-frame rebuild — I would not do that.Not merged: red run, and I do not merge red. The queue is otherwise empty of mergeable work.
ad3c686b04596de26584596de2658491ff10c32491ff10c32475d135ccc775d135ccc777adf96d9877adf96d98bc74790724Red on all three legs at
91ff10c3and again at75d135cc— it is the timing assertion, and the cause is still innormalizePortConfig.The suite is green here, so the failure is one assertion that only trips on a loaded runner:
npm teston91ff10c3: 304 suites, 10,645 assertions, 0 failed — 736 s atPF_TEST_CONCURRENCY=1, 204.6 s at=10(green both ways).test/trunk-allowed-remove-from-all.test.js:167measures 2,000classifyEgresscalls against3,000 ms. Measured on an idle host, three runs: 1,464 / 1,544 / 1,600 ms. CI runs that step atPF_TEST_CONCURRENCY=10with three legs on one host, which is roughly the 2x that crosses the bound.engine/vlan.js:358-360returnsraw.allowedVlans.slice(), andclassifyEgresscallsnormalizePortConfigper frame (line 432). A fresh array object per frame means thevlanListIncludesWeakMap misses every time and the 4,089-id Set is rebuilt per frame.The fix is a normalize cache keyed on the raw port config (or returning the same array when
isCleanVlanArrayis already true) inengine/vlan.js— engine content is the owning loop's contribution, not mine, and widening the 3,000 ms bound would hide a per-frame parse rather than remove it. Needs the owning loop's fix; not merging red.The red leg is real and it is arithmetic, not a flake — and the cost is in
engine/vlan.js, not in this PR's data. Measured on this exact head (bc747907) and onorigin/main(23e3d9b2), Windows/Node 24, 2,000classifyEgresscalls against a 4,089-id list (the shaperemove 2on a default trunk produces):Cause, one line:
normalizePortConfigreturnsraw.allowedVlans.slice()(engine/vlan.js ~356-360).vlanListIncludeskeysmemberCacheon the array object, so every frame gets a fresh array, misses the cache, and paysparseVlanList+new Setover 4,089 ids — 0.77 ms per frame here, 3.1 ms on a loaded runner, which is exactly the[6162 ms]in CI. The copy in the normaliser defeats the cache added for exactly this case.Why it is red in CI and green here: the assertion at line 167 allows 3,000 ms; the honest cost of this shape is 1.5 s idle here and 2.5 s on main, so a 2x margin is all this bound ever had. It is not runner starvation and not this PR's test data.
Everything else on this head is clean: full
npm testatbc747907→ 304 suites, 10,647 assertions, 0 failed (487 s), and both touched suites pass.Not fixable by me: the fix is in
engine/, which belongs to another loop — either key the membership cache on the source array before the copy, or skip theslice()whenisCleanVlanArrayis already true (that alone takes this loop to a few ms). Otherwise the bound needs to be ~10,000 ms, which just hides it. Needs the branch owner's change; needs Jay's ruling only if the bound is to stay at 3,000 ms.Handing the fix off rather than re-diagnosing it a fifth time: filed #1809 against
engine/vlan.js(array-keyedmemberCachenever hits behindnormalizePortConfig()'sslice()), with the measurements from this thread. Once it lands, this PR's auto-rebase workflow picks it up and the bound stays as-is. No source change from this branch, please - the regression is upstream of it.bc747907241b29675b2fRebased onto
af8c7f35(was 27 behind) — the red runs were #1809's cache miss, and main fixed #1809 ina95227e3(#1812) while this branch independently fixed it a different way.The one conflict was
engine/vlan.js, in two hunks, both the same fast path added twice:vlanListIncludes()— main:isCanonicalVlanArray()+ binary search (canonicalVlanIncludes). Branch:WeakMapcache of aSetbuilt byparseVlanList.normalizePortConfig()— main:isCanonicalVlanArray()fast-path. Branch:isCleanVlanArray()(identical predicate: integers, in range, not reserved, strictly ascending) with its ownWeakMap.Both predicates are the same test, so this is not a behaviour question: I kept main's, which is already merged and pinned per-id 1-4094 by
test/vlan-membership-lookup.test.js, and dropped this branch's now-unusedmemberCache/cleanListCache/isCleanVlanArrayrather than leave three dead declarations behind. This PR's actual subject —removeon a default trunk subtracting, and lists printing as ranges — is untouched.Worth knowing: main's version is also the faster one. The 2,000-frame classification in
test/trunk-allowed-remove-from-all.test.jsnow measures 43 ms (was 1,202 ms on the old base; the bound is 3,000 ms). Verified locally on the rebased head1b29675b: 310 suites, 10,835 assertions, 0 failed (406.9 s), plusnode scripts/syntax-check.js.If the
WeakMap-cached design is preferred over the binary search, that is a follow-up worth its own issue — it would replacecanonicalVlanIncludes, not sit beside it.addandremove#1822