speed/duplex: a word after the value is refused, not dropped #2004

Merged
jaylouisw merged 1 commit from rev/1118-1601 into main 2026-11-18 16:42:49 +00:00
Owner

What was wrong

speed and duplex read the first word of the line and dropped the rest. Four orders did something a box would not, and three of them reported a different command than the one typed:

typed before
speed 100 flurbish forced 100 Mb/s, the word never mentioned
speed auto 10 answered as a plain speed auto - a different setting on hardware
speed nonegotiate % Invalid rate "nonegotiate" about a real keyword
no speed flurbish returned the port to autonegotiation anyway
duplex full flurbish set full duplex, the word never mentioned
no duplex flurbish returned the port to auto

What the vendor says

Catalyst 2960-X 15.2(6)E command reference, Interface and Hardware Commands:

speed { 10 | 100 | 1000 | 2500 | 5000 | auto [ 10 | 100 | 1000 | 2500 | 5000 ] | nonegotiate }
no speed
duplex { auto | full | half }
no duplex { auto | full | half }

One rate, one mode, no optional tail - except after auto, which takes the rates the port may advertise (the 3850 book's own example is speed auto 10 100). The two no forms do not match each other: no speed takes nothing, no duplex takes the same three words as its positive form and returns the port to the default, auto. A word outside those shapes is % Invalid input detected at '^' marker., at parse time - so a serial port with no line rate still answers about the stray word.

What this changes

Every refusal names the word back, says nothing was changed, and is answered before the port is consulted. speed auto <rates> and speed nonegotiate are refused as not modelled rather than as invalid input, which is what they are. no duplex half / no duplex full still reset to auto.

Evidence and open questions

research/speed-duplex-grammar.md - the syntax lines, the error table, and the ten other interface commands the same sweep found still dropping a trailing word (switchport mode, switchport access vlan, channel-group … mode, ip nat inside, vrrp … ip, encapsulation dot1q and others), each of which needs its own run. duplex nonegotiate is left alone: the 15.2(6)E page does not list it and no page in hand does.

Tests

  • test/speed-duplex-grammar.test.js - new, 46 checks; every refusal compared against show running-config before and after.
  • test/no-command-swallows-a-word.test.js - new section 4: a good value plus a stray word, both commands, both device kinds (24 checks).
  • node scripts/syntax-check.js: 419 files, all OK.
  • npm test: 345 suites, 11,975 assertions, 0 failed.
## What was wrong `speed` and `duplex` read the first word of the line and dropped the rest. Four orders did something a box would not, and three of them reported a different command than the one typed: | typed | before | | --- | --- | | `speed 100 flurbish` | forced 100 Mb/s, the word never mentioned | | `speed auto 10` | answered as a plain `speed auto` - a different setting on hardware | | `speed nonegotiate` | `% Invalid rate "nonegotiate"` about a real keyword | | `no speed flurbish` | returned the port to autonegotiation anyway | | `duplex full flurbish` | set full duplex, the word never mentioned | | `no duplex flurbish` | returned the port to auto | ## What the vendor says Catalyst 2960-X 15.2(6)E command reference, Interface and Hardware Commands: speed { 10 | 100 | 1000 | 2500 | 5000 | auto [ 10 | 100 | 1000 | 2500 | 5000 ] | nonegotiate } no speed duplex { auto | full | half } no duplex { auto | full | half } One rate, one mode, no optional tail - except after `auto`, which takes the rates the port may advertise (the 3850 book's own example is `speed auto 10 100`). The two `no` forms do not match each other: `no speed` takes nothing, `no duplex` takes the same three words as its positive form and returns the port to the default, `auto`. A word outside those shapes is `% Invalid input detected at '^' marker.`, at parse time - so a serial port with no line rate still answers about the stray word. ## What this changes Every refusal names the word back, says nothing was changed, and is answered before the port is consulted. `speed auto <rates>` and `speed nonegotiate` are refused as *not modelled* rather than as invalid input, which is what they are. `no duplex half` / `no duplex full` still reset to auto. ## Evidence and open questions `research/speed-duplex-grammar.md` - the syntax lines, the error table, and the ten other interface commands the same sweep found still dropping a trailing word (`switchport mode`, `switchport access vlan`, `channel-group … mode`, `ip nat inside`, `vrrp … ip`, `encapsulation dot1q` and others), each of which needs its own run. `duplex nonegotiate` is left alone: the 15.2(6)E page does not list it and no page in hand does. ## Tests - `test/speed-duplex-grammar.test.js` - new, 46 checks; every refusal compared against `show running-config` before and after. - `test/no-command-swallows-a-word.test.js` - new section 4: a *good* value plus a stray word, both commands, both device kinds (24 checks). - `node scripts/syntax-check.js`: 419 files, all OK. - `npm test`: 345 suites, 11,975 assertions, 0 failed.
speed/duplex: a word after the value is refused, not dropped
All checks were successful
CI / Classify the change (pull_request) Successful in 5s
PR rebase / Rebase onto main and arm auto-merge (pull_request) Successful in 6s
CI / Server smoke test (pull_request) Successful in 6s
CI / Docker build (pull_request) Successful in 19s
CI / Test (Node 20) (pull_request) Successful in 52s
CI / Test (Node 22) (pull_request) Successful in 56s
CI / Test (Node 18) (pull_request) Successful in 59s
CI / Arm auto-merge (pull_request) Successful in 15s
1b4836f95c
The vendor syntax lines close both commands after one value -
`speed {10|100|1000|2500|5000|auto [rates]|nonegotiate}` and
`duplex {auto|full|half}` - so `speed 100 flurbish` is a parse error
on a box. This console read the first word and dropped the rest, and
four orders lied in silence: the rate was forced, the duplex was set,
`speed auto 10` was answered as a plain `speed auto` (a different
setting on hardware), `speed nonegotiate` was called an invalid rate,
and `no speed flurbish` returned the port to autonegotiation anyway.

The two `no` forms do not match: `no speed` takes nothing, while
`no duplex {auto|full|half}` takes the same three words and returns the
port to the default. Every refusal names the word, changes nothing, and
is answered before the port is consulted.

research/speed-duplex-grammar.md carries the syntax lines, the vendor's
`speed auto 10 100` example and the ten other commands the same sweep
found still dropping a trailing word.

This branch conflicts with main, so it was not rebased:

CHANGELOG.md docs/CLI.md engine/cli.js research/speed-duplex-grammar.md test/no-command-swallows-a-word.test.js test/speed-duplex-grammar.test.js 

A conflict is a decision about behaviour rather than a mechanical fix, so this is left for a human. Rebasing by hand and force-pushing will let the automation pick it up again.

This branch conflicts with `main`, so it was not rebased: ``` CHANGELOG.md docs/CLI.md engine/cli.js research/speed-duplex-grammar.md test/no-command-swallows-a-word.test.js test/speed-duplex-grammar.test.js ``` A conflict is a decision about behaviour rather than a mechanical fix, so this is left for a human. Rebasing by hand and force-pushing will let the automation pick it up again.
jaylouisw force-pushed rev/1118-1601 from 1b4836f95c
All checks were successful
CI / Classify the change (pull_request) Successful in 5s
PR rebase / Rebase onto main and arm auto-merge (pull_request) Successful in 6s
CI / Server smoke test (pull_request) Successful in 6s
CI / Docker build (pull_request) Successful in 19s
CI / Test (Node 20) (pull_request) Successful in 52s
CI / Test (Node 22) (pull_request) Successful in 56s
CI / Test (Node 18) (pull_request) Successful in 59s
CI / Arm auto-merge (pull_request) Successful in 15s
to 63ab56af72
All checks were successful
PR rebase / Rebase onto main and arm auto-merge (pull_request) Successful in 3s
CI / Classify the change (pull_request) Successful in 6s
CI / Server smoke test (pull_request) Successful in 8s
CI / Docker build (pull_request) Successful in 18s
CI / Test (Node 20) (pull_request) Successful in 50s
CI / Test (Node 22) (pull_request) Successful in 53s
CI / Test (Node 18) (pull_request) Successful in 58s
CI / Arm auto-merge (pull_request) Successful in 31s
2026-11-18 16:40:18 +00:00
Compare
jaylouisw deleted branch rev/1118-1601 2026-11-18 16:42:51 +00:00
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
2 participants
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!2004
No description provided.