Skip to content

ospfd: Implement RFC4222 Recommendation 5#22175

Draft
raviravindran123 wants to merge 5 commits into
FRRouting:masterfrom
raviravindran123:ospf-adj-pacing-static-dynamic
Draft

ospfd: Implement RFC4222 Recommendation 5#22175
raviravindran123 wants to merge 5 commits into
FRRouting:masterfrom
raviravindran123:ospf-adj-pacing-static-dynamic

Conversation

@raviravindran123
Copy link
Copy Markdown

Summary

Implements RFC 4222 Recommendation 5: per-interface adjacency pacing
to limit the number of simultaneous OSPF adjacency formations and
avoid database-exchange bursts on bandwidth-constrained interfaces.

Two modes are provided:

Static mode — a fixed concurrency limit per interface:
ip ospf adjacency-pacing static <1-65535>

Dynamic mode — an AIMD-based limit that adapts to retransmission
pressure on the interface:
ip ospf adjacency-pacing dynamic
ip ospf adjacency-pacing dynamic thresholds

In dynamic mode the total unacknowledged LSA count U(t) across all
neighbors on the interface is used as the congestion signal. When
U(t) rises above the high-water mark H the limit is halved; when it
falls below the low-water mark L the limit is incremented by one.
The limit starts at 1 and is bounded at 50. Default thresholds are
H=100, L=2.

Neighbors that cannot immediately enter ExStart are queued per
interface in FIFO order and restarted (via NSM_AdjOK) when a slot
opens.

Testing

Three topotest files covering:

  • Configuration persistence, interface flap, daemon restart,
    no-command cleanup, threshold validation (point-to-point topology)
  • AIMD congestion detection under LSA flood and queue-kick on
    limit increase (7-router broadcast topology)
  • Static pacing on the broadcast topology

Documentation

  • doc/developer/ospf-adj-pacing.rst — developer reference
  • doc/user/ospfd.rst — four new clicmd entries

@frrbot frrbot Bot added documentation ospf tests Topotests, make check, etc labels Jun 2, 2026
@frrbot frrbot Bot added the bugfix label Jun 2, 2026
Implement RFC 4222 recommendation 5: per-interface adjacency pacing to
limit the number of simultaneous OSPF adjacency formations and avoid
database-exchange bursts on bandwidth-constrained interfaces.

Two modes are provided:

- Static: a fixed concurrency limit configured per interface.
- Dynamic: an AIMD-based limit that adjusts automatically using the
  total unacknowledged LSA count (U) across the interface as a
  congestion signal. When U rises above a high-water mark the limit
  is halved; when U falls below a low-water mark the limit is
  incremented by one.

Neighbors that cannot immediately enter ExStart are queued per
interface in FIFO order. When a slot opens, ospf_adj_pacing_kick()
restarts the next queued neighbor. The dynamic limit is re-evaluated
on LSA acknowledgement and on the retransmit timer.

Signed-off-by: Ravi Ravindran <rravindran@labn.net>
Add topotests for RFC 4222 recommendation 5 adjacency pacing covering
three test files:

- test_ospf_adj_pacing_config.py: verifies static and dynamic pacing
  configuration persistence, interface flap behavior, FRR daemon
  restart, no-command cleanup, threshold validation, and defaults.

- test_ospf_broadcast_router_dynamic_pacing.py: verifies dynamic
  pacing on a 7-router broadcast topology with DR election; tests
  AIMD congestion detection under LSA flood and queue-kick behavior
  when the dynamic limit increases after congestion clears.

- test_ospf_broadcast_router_static_pacing.py: verifies static pacing
  on the same broadcast topology.

Router configurations cover point-to-point (r1-r3) and broadcast
(r1_broadcast through r7_broadcast) topologies with hello/dead timers
tuned for fast convergence.

Signed-off-by: Ravi Ravindran <rravindran@labn.net>
Add developer and user documentation for RFC 4222 recommendation 5
adjacency pacing.

doc/developer/ospf-adj-pacing.rst: describes the static and dynamic
pacing modes, the AIMD algorithm, code paths in ospf_nsm.c, and how
unacknowledged LSA counting works across broadcast and point-to-point
segments.

doc/developer/ospf.rst: add ospf-adj-pacing to the OSPF developer
documentation toctree.

doc/user/ospfd.rst: add four clicmd entries for the adjacency pacing
interface commands: static limit, dynamic mode, dynamic thresholds,
and no-form.

Signed-off-by: Ravi Ravindran <rravindran@labn.net>
Add 7 test cases to test_ospf_adj_pacing_config.py covering static
pacing configuration that was missing from initial test coverage:

- config persistence (write memory / running-config)
- persistence across ospfd restart
- persistence across interface flap
- no-command removes static config
- boundary values (limit=1 minimum, limit=65535 maximum)
- transition from static to dynamic mode
- transition from dynamic to static mode

Signed-off-by: Ravi Ravindran <rravindran@labn.net>
Fix checkpatch violations flagged by FRR CI Verify Source:
- trailing whitespace in ospf_nsm.c, ospf_vty.c, ospf_interface.c
- brace placement and spacing in ospf_nsm.c
- tabs vs spaces indentation in ospf_vty.c
- pointer style and operator spacing in ospf_interface.h
- missing blank lines after declarations in ospf_packet.c

Applied via git clang-format against upstream base.

Signed-off-by: Ravi Ravindran <rravindran@labn.net>
@raviravindran123 raviravindran123 force-pushed the ospf-adj-pacing-static-dynamic branch from 9b612e9 to f6be918 Compare June 2, 2026 18:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant