cli: ip ospf priority exists, and the DR election reads it #2291

Merged
jaylouisw merged 1 commit from rev/1120-0942 into main 2026-11-20 10:09:57 +00:00
Owner

Question

What decides DR/BDR on a multiaccess segment, and what does a box print when a port may not stand? The Pri column of show ip ospf neighbor was a constant 1 and the role beside it was decided by router ID alone, because ip ospf priority did not exist (docs/plans/ospf-elections.md).

Evidence

  • Cisco IOS IP Routing: OSPF Command Reference, ip ospf priority - range 0-255, default 1, higher priority wins, ties fall to the higher router ID, and "A router with a router priority set to zero is ineligible to become the designated router or backup designated router."
    https://cisco.com/c/en/us/td/docs/ios-xml/ios/iproute_ospf/command/iro-cr-book.pdf
  • RFC 2328 9.4 - priority-0 routers are discarded before the election, and the BDR step excludes the router that just became DR, so a single eligible speaker yields a DR and no BDR.
    https://www.rfc-editor.org/rfc/rfc2328.html#section-9.4
  • Cisco 13688-16 (already cited in the repo) states the default and that the field is the neighbour's.

What changed

  • ip ospf priority <0-255> in interface mode (no restores 1), stored per interface, printed in show running-config, and read back as a new Pri column in show ip ospf interface.
  • computeOspf() puts the value in the per-interface record, elects DR by priority then router ID, and the neighbour record now carries the peer's own priority, so Pri and State come from one source.
  • A port at 0 is ineligible: the other end takes the DR alone and no BDR is elected; the 0-priority box still reads FULL/DR, since a DROTHER synchronises with the DR. On serial (point-to-point) the line is stored and FULL/ - is unchanged, as IOS accepts it there and no election runs.
  • Both ends at 0: no DR exists, so a real pair stops at 2WAY/DROTHER and carries no route. This model has no two-way state, so the link is refused and the console prints the reason plus RFC 2328 9.4 instead of a FULL that cannot exist.
  • test/ospf-priority.test.js (38 checks) plus the 0-255 probe set in test/stated-range-is-the-enforced-range.test.js; docs, plan status and the two research notes updated.

Tests

node scripts/syntax-check.js OK; full npm test: 409 suites, 13586 assertions, 0 failed (baseline 408 / 13542).

Unresolved

A third speaker on one segment (true DROTHER/2WAY rows), DR stickiness/boot order, and ip ospf network remain unmodelled - the two-way row is documented in research/show-ospf-neighbor-state.md.

## Question What decides DR/BDR on a multiaccess segment, and what does a box print when a port may not stand? The `Pri` column of `show ip ospf neighbor` was a constant `1` and the role beside it was decided by router ID alone, because `ip ospf priority` did not exist (`docs/plans/ospf-elections.md`). ## Evidence * Cisco IOS IP Routing: OSPF Command Reference, `ip ospf priority` - range 0-255, default 1, higher priority wins, ties fall to the higher router ID, and "A router with a router priority set to zero is ineligible to become the designated router or backup designated router." https://cisco.com/c/en/us/td/docs/ios-xml/ios/iproute_ospf/command/iro-cr-book.pdf * RFC 2328 9.4 - priority-0 routers are discarded before the election, and the BDR step excludes the router that just became DR, so a single eligible speaker yields a DR and no BDR. https://www.rfc-editor.org/rfc/rfc2328.html#section-9.4 * Cisco 13688-16 (already cited in the repo) states the default and that the field is the neighbour's. ## What changed * `ip ospf priority <0-255>` in interface mode (`no` restores 1), stored per interface, printed in `show running-config`, and read back as a new `Pri` column in `show ip ospf interface`. * `computeOspf()` puts the value in the per-interface record, elects DR by priority then router ID, and the neighbour record now carries the peer's own priority, so `Pri` and `State` come from one source. * A port at 0 is ineligible: the other end takes the DR alone and no BDR is elected; the 0-priority box still reads `FULL/DR`, since a DROTHER synchronises with the DR. On serial (point-to-point) the line is stored and `FULL/ -` is unchanged, as IOS accepts it there and no election runs. * Both ends at 0: no DR exists, so a real pair stops at `2WAY/DROTHER` and carries no route. This model has no two-way state, so the link is refused and the console prints the reason plus RFC 2328 9.4 instead of a `FULL` that cannot exist. * `test/ospf-priority.test.js` (38 checks) plus the 0-255 probe set in `test/stated-range-is-the-enforced-range.test.js`; docs, plan status and the two research notes updated. ## Tests `node scripts/syntax-check.js` OK; full `npm test`: 409 suites, 13586 assertions, 0 failed (baseline 408 / 13542). ## Unresolved A third speaker on one segment (true `DROTHER`/`2WAY` rows), DR stickiness/boot order, and `ip ospf network` remain unmodelled - the two-way row is documented in `research/show-ospf-neighbor-state.md`.
cli: ip ospf priority exists, and the DR election reads it
All checks were successful
CI / Classify the change (pull_request) Successful in 14s
PR rebase / Rebase onto main and arm auto-merge (pull_request) Successful in 16s
CI / Test (Node 22) (pull_request) Successful in 57s
CI / Test (Node 20) (pull_request) Successful in 58s
CI / Server smoke and Docker build (pull_request) Successful in 24s
CI / Test (Node 18) (pull_request) Successful in 1m2s
CI / Arm auto-merge (pull_request) Successful in 4s
2dd5584f9c
forgejo-actions scheduled this pull request to auto merge when all checks succeed 2026-11-20 10:06:27 +00:00
jaylouisw deleted branch rev/1120-0942 2026-11-20 10:10:00 +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!2291
No description provided.