A stated range in a refusal is not always the range the check applies: channel-group 4097 is accepted #1505

Closed
opened 2026-11-12 08:43:55 +00:00 by jaylouisw · 2 comments
Owner

What happens

channel-group 4097 is accepted and creates a bundle, while the refusal for a bad id in the same handler says the range is 1-4096:

sw1(config-if)#channel-group 4097 mode active
Interface Fa0/1 added to channel group 4097 (mode active)

sw1(config-if)#channel-group flurbish mode active
% Invalid channel group id "flurbish": a channel group is identified by a number, 1-4096

The condition is !/^\d+$/.test(id) || Number(id) < 1 — a lower bound only. #1495 fixed the "a word became configuration" half and left the ceiling unapplied, so an id one digit too far creates a group that the console's own message says cannot exist, and every view that lists bundles prints it.

What changes

  • engine/cli.js: the channel-group id check applies both ends of the range it prints (Number(id) >= 1 && Number(id) <= 4096).
  • docs/CLI.md § A stated range is the range the check applies.

Verification

test/stated-range-is-the-enforced-range.test.js — 10 checks. Every range the console prints is probed at four points (below, low, high, above) and must go refused, accepted, accepted, refused:

setting range probed
vlan <id> 1-4094 0, 1, 4094, 4095
channel-group <id> 1-4096 0, 1, 4096, 4097
vrrp <vrid> 1-255 0, 1, 255, 256
vrrp <vrid> priority 1-255 0, 1, 255, 256
spanning-tree priority 0-61440 -1, 0, 61440, 61441
ipv6 nd ra lifetime 0-65535 0, 65535, 65536
ip ospf cost 1-65535 0, 1, 65535, 65536
ping <count> 1-50 0, 1, 50, 51

Plus: a refused bundle id leaves no entry in dev.config.lags, nothing in show etherchannel summary and no lag on the port; and both edges (1 and 4096) still work.

With the old handler: 8 passed / 2 failed, both naming 4097.

Full suite 249 suites / 9147 assertions / 0 failed; syntax 319 files; skip-audit 15/15; help-completeness 8/8.

Measured and left alone

encapsulation dot1q and ip access-group showed up in the first sweep as edge refusals and are correct: dot1q on a physical port is refused for being on a physical port, and an access list that does not exist is refused for not existing — both answered in terms of the real problem, not the number.

## What happens `channel-group 4097` is accepted and creates a bundle, while the refusal for a bad id in the same handler says the range is `1-4096`: ``` sw1(config-if)#channel-group 4097 mode active Interface Fa0/1 added to channel group 4097 (mode active) sw1(config-if)#channel-group flurbish mode active % Invalid channel group id "flurbish": a channel group is identified by a number, 1-4096 ``` The condition is `!/^\d+$/.test(id) || Number(id) < 1` — a **lower bound only**. #1495 fixed the "a word became configuration" half and left the ceiling unapplied, so an id one digit too far creates a group that the console's own message says cannot exist, and every view that lists bundles prints it. ## What changes - `engine/cli.js`: the channel-group id check applies both ends of the range it prints (`Number(id) >= 1 && Number(id) <= 4096`). - `docs/CLI.md` § *A stated range is the range the check applies*. ## Verification `test/stated-range-is-the-enforced-range.test.js` — 10 checks. Every range the console prints is probed at **four points** (below, low, high, above) and must go refused, accepted, accepted, refused: | setting | range | probed | |---|---|---| | `vlan <id>` | 1-4094 | 0, 1, 4094, 4095 | | `channel-group <id>` | 1-4096 | 0, 1, 4096, 4097 | | `vrrp <vrid>` | 1-255 | 0, 1, 255, 256 | | `vrrp <vrid> priority` | 1-255 | 0, 1, 255, 256 | | `spanning-tree priority` | 0-61440 | -1, 0, 61440, 61441 | | `ipv6 nd ra lifetime` | 0-65535 | 0, 65535, 65536 | | `ip ospf cost` | 1-65535 | 0, 1, 65535, 65536 | | `ping <count>` | 1-50 | 0, 1, 50, 51 | Plus: a refused bundle id leaves no entry in `dev.config.lags`, nothing in `show etherchannel summary` and no `lag` on the port; and both edges (1 and 4096) still work. With the old handler: **8 passed / 2 failed**, both naming `4097`. Full suite **249 suites / 9147 assertions / 0 failed**; syntax 319 files; `skip-audit` 15/15; `help-completeness` 8/8. ## Measured and left alone `encapsulation dot1q` and `ip access-group` showed up in the first sweep as edge refusals and are **correct**: `dot1q` on a physical port is refused for being on a physical port, and an access list that does not exist is refused for not existing — both answered in terms of the real problem, not the number.
Author
Owner

Ready on the server, waiting for a pull request to be creatable.

Branch fix/stated-range at 403b512e (pushed as a new ref — new refs still push, updates do not), base 1b1e1287, verified: 249 suites / 9147 assertions / 0 failed, syntax 319, new suite 10/10 (old handler 8/2).

Creating the PR failed twice with 500 … could not write config file /data/gitea/data/tmp/local-repo/pull.git…/.git/config: No space left on device — a PR needs a temp clone and the volume has no room for one. Two attempts is where I stop; each failure leaves a half-clone.

To finish it in one move once there is space: POST /repos/jaylouisw/packetforge/pulls with head: fix/stated-range, base: main, then squash-merge on the first attempt that reports mergeable: true.

**Ready on the server, waiting for a pull request to be creatable.** Branch `fix/stated-range` at **`403b512e`** (pushed as a new ref — new refs still push, updates do not), base `1b1e1287`, verified: 249 suites / 9147 assertions / 0 failed, syntax 319, new suite 10/10 (old handler 8/2). Creating the PR failed twice with `500 … could not write config file /data/gitea/data/tmp/local-repo/pull.git…/.git/config: No space left on device` — a PR needs a temp clone and the volume has no room for one. Two attempts is where I stop; each failure leaves a half-clone. To finish it in one move once there is space: `POST /repos/jaylouisw/packetforge/pulls` with `head: fix/stated-range`, `base: main`, then squash-merge on the first attempt that reports `mergeable: true`.
Author
Owner

Filed as #1510 and fixed on the combined branch (land-all-v4 @ 45b437da) — the range fix here was right
and its neighbours were not:

  • no channel-group 9999 answered Fa0/1 removed from channel group 2. The dispatcher threw the id away, so the
    destructive no named nothing and removed something, and the id was never range-checked either;
  • channel-group 10 on a port already in group 2 added a second membership, so one cable was listed as a member of
    every bundle it had ever joined — an impossible state, and show etherchannel summary reported it;
  • the summary's ids were sorted as strings (10, 100, 2).

All three fixed, with three checks in no-command-touches-only-what-it-names (11/11; 8 passed / 3 failed against
the previous handler). Full suite 251 suites / 9213 assertions / 0 failed. The range check this issue is about is
unchanged — it applies to both directions now, which is what the no form was missing.

Filed as **#1510** and fixed on the combined branch (`land-all-v4` @ `45b437da`) — the range fix here was right and its neighbours were not: * `no channel-group 9999` answered `Fa0/1 removed from channel group 2`. The dispatcher threw the id away, so the destructive `no` named nothing and removed something, and the id was never range-checked either; * `channel-group 10` on a port already in group 2 added a *second* membership, so one cable was listed as a member of every bundle it had ever joined — an impossible state, and `show etherchannel summary` reported it; * the summary's ids were sorted as strings (`10, 100, 2`). All three fixed, with three checks in `no-command-touches-only-what-it-names` (**11/11**; 8 passed / 3 failed against the previous handler). Full suite **251 suites / 9213 assertions / 0 failed**. The range check this issue is about is unchanged — it applies to both directions now, which is what the `no` form was missing.
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#1505
No description provided.