docs(cli): the default-gateway gate is cited inside the OSPF loop #2432

Merged
jaylouisw merged 1 commit from docs/1121-1417 into main 2026-11-21 14:40:25 +00:00
Owner

What was untrue

docs/CLI.md (the ip default-gateway / S* 0.0.0.0/0 section, ~line 3558) said the typed config.defaultGateway is consulted only when isL3() is false, and cited engine/device.js:1139 for that gate.

Evidence from the code

  • engine/device.js:1161 is the gate: if (!best && this.config.defaultGateway && !this.isL3()).
  • engine/device.js:1435 repeats the same test where the route table builds the S* row.
  • engine/device.js:755 defines isL3(); line 1139 is inside the OSPF-learned-routes loop (for (const r of (this.ospfRoutes || []))), which is not about the default gateway at all.
  • Reproduced the page's behaviour to be sure the claim itself holds: on an ISR 4331, ip default-gateway 10.0.0.254 then show ip route prints Gateway of last resort is not set and no S* row.

Fix

Citation corrected to :1161, with the sibling at :1435 named. Wording unchanged; one paragraph rewrapped.

Guards (before / after)

  • scripts/check-doc-citations.js: 380 citations, 3 suspects -> 2 suspects (the two remaining are docs/BGP-POLICY.md:77/:827 naming cli.js:8114 for _help() at 8161, left for another run)
  • node scripts/syntax-check.js: 535 files, all OK (before and after)
  • docs-cli-transcript 9 passed / 0 failed (both)
  • docs-show-commands 7 passed / 0 failed (both)
  • no-form-help-key 81 passed / 0 failed (both)
  • help-completeness 8 passed / 0 failed (both)

Not done

No code change: the code is right and the doc was wrong. The two BGP-POLICY.md citation suspects are untouched (one item per run).

## What was untrue `docs/CLI.md` (the `ip default-gateway` / `S* 0.0.0.0/0` section, ~line 3558) said the typed `config.defaultGateway` is consulted only when `isL3()` is false, and cited `engine/device.js:1139` for that gate. ## Evidence from the code - `engine/device.js:1161` is the gate: `if (!best && this.config.defaultGateway && !this.isL3())`. - `engine/device.js:1435` repeats the same test where the route table builds the `S*` row. - `engine/device.js:755` defines `isL3()`; line 1139 is inside the OSPF-learned-routes loop (`for (const r of (this.ospfRoutes || []))`), which is not about the default gateway at all. - Reproduced the page's behaviour to be sure the claim itself holds: on an ISR 4331, `ip default-gateway 10.0.0.254` then `show ip route` prints `Gateway of last resort is not set` and no `S*` row. ## Fix Citation corrected to `:1161`, with the sibling at `:1435` named. Wording unchanged; one paragraph rewrapped. ## Guards (before / after) - `scripts/check-doc-citations.js`: 380 citations, 3 suspects -> 2 suspects (the two remaining are `docs/BGP-POLICY.md:77`/`:827` naming `cli.js:8114` for `_help()` at 8161, left for another run) - `node scripts/syntax-check.js`: 535 files, all OK (before and after) - docs-cli-transcript 9 passed / 0 failed (both) - docs-show-commands 7 passed / 0 failed (both) - no-form-help-key 81 passed / 0 failed (both) - help-completeness 8 passed / 0 failed (both) ## Not done No code change: the code is right and the doc was wrong. The two `BGP-POLICY.md` citation suspects are untouched (one item per run).
docs(cli): the default-gateway gate is at device.js:1161, not inside the OSPF loop
All checks were successful
CI / Server smoke and Docker build (pull_request) Successful in 16s
PR rebase / Rebase onto main and arm auto-merge (pull_request) Successful in 9s
CI / Test (Node 18) (pull_request) Successful in 1m3s
CI / Test (Node 20) (pull_request) Successful in 1m4s
CI / Test (Node 22) (pull_request) Successful in 1m4s
CI / Arm auto-merge (pull_request) Successful in 3s
e9a1d5fc0a
The page cited engine/device.js:1139 for the `!isL3()` condition that keeps a
typed `ip default-gateway` inert on a routing box. Line 1139 is in the middle of
the OSPF-learned-routes loop; the condition itself is at 1161
(`if (!best && this.config.defaultGateway && !this.isL3())`), with the same test
repeated where the table's `S*` row is built at 1435. `isL3()` is defined at 755.
scripts/check-doc-citations.js now reports 2 suspects instead of 3.
forgejo-actions scheduled this pull request to auto merge when all checks succeed 2026-11-21 14:21:56 +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!2432
No description provided.