Skip to content

sd-ndisc: do not stop solicitations on zero-lifetime RA - #43698

Merged
yuwata merged 1 commit into
systemd:mainfrom
quanyeyang:fix-ndisc-zero-lifetime-ra
Sep 10, 2026
Merged

yuwata merged 1 commit into
systemd:mainfrom
quanyeyang:fix-ndisc-zero-lifetime-ra

Conversation

@quanyeyang

Copy link
Copy Markdown
Contributor

RFC 4861 section 6.3.7 says that a host should send at least one Router Solicitation when an advertisement is received before the first solicitation, and should desist only after receiving a valid Router Advertisement with a non-zero Router Lifetime.

Keep the RS timer active until both conditions are met, and add a regression test for a lifetime-zero RA arriving before the initial RS.

Fixes #43205.

@github-actions github-actions Bot added network tests please-review PR is ready for (re-)review by a maintainer labels Sep 9, 2026
Comment thread src/libsystemd-network/test-ndisc-rs.c Resolved
@poettering poettering added good-to-merge/with-minor-suggestions and removed please-review PR is ready for (re-)review by a maintainer labels Sep 9, 2026
Comment thread src/libsystemd-network/sd-ndisc.c Resolved
@yuwata yuwata added the ndisc/ra label Sep 9, 2026
@quanyeyang quanyeyang changed the title sd-ndisc: stop solicitations only after an RS and non-zero-lifetime RA sd-ndisc: do not stop solicitations on zero-lifetime RA Sep 9, 2026
@github-actions

github-actions Bot commented Sep 9, 2026 •

Copy link
Copy Markdown

Claude review failed (workflow run)

Completed five of eight review lenses: security and robustness, architecture/API design and compatibility, coding style and maintainability, tests and regression coverage, and IPv6 NDisc protocol conformance (RFC 4861/4862/8106, domain-specific lens). Incomplete lenses: correctness and memory safety, and resource lifetimes and concurrency — both reviewers exceeded their time budget and were stopped before returning findings, so those two perspectives are not represented below. Three candidate style findings (a terser sd_ndisc_router_get_lifetime() call form, braces/blank line around the new if (r > 0), and nested assertion macros in the new test handler) and two candidate test findings (asserting timeout_no_ra state, and a claimed sd_event_run() dispatch race) were rejected during validation as inaccurate or as pure style preference.

Confirmed findings:

  • Must fix (sd-ndisc.c:227): gating event_source_disable(nd->timeout_event_source) on a non-zero Router Lifetime removes the only terminator for RS retransmission. ndisc_timeout() always re-arms itself (interval saturating at 3600s) and NDISC_MAX_ROUTER_SOLICITATIONS is never enforced as a transmission count, so on a link whose routers only advertise Router Lifetime 0 the host multicasts an RS to ff02::2 roughly hourly forever, while timeout_no_ra is still disabled unconditionally.
  • Suggestion (test-ndisc-rs.c:355-358): the new test pins only that a zero-lifetime RA leaves the RS timer armed; no test pins the complementary case, so deleting the disable call outright would still leave the test binary green.
  • Nit (sd-ndisc.c:226): the commit messages and PR body still describe a two-condition rule ("only after an RS and non-zero-lifetime RA") that the second commit removed; the fixup commits should be squashed and the rationale reworded to match the implemented single-condition logic.

Comment thread src/libsystemd-network/sd-ndisc.c Resolved
Comment thread src/libsystemd-network/test-ndisc-rs.c Resolved
Comment thread src/libsystemd-network/sd-ndisc.c Resolved
RFC 4861 section 6.3.7 states that a host should send at least one Router
Solicitation even if it receives an unsolicited Router Advertisement
before sending its first solicitation, and should stop soliciting only
after receiving a valid Router Advertisement with a non-zero Router Lifetime.

Keep the RS timer active until both conditions are met, and add a
regression test for a zero-lifetime RA arriving before the initial RS.

Fixes systemd#43205.
@yuwata
yuwata force-pushed the fix-ndisc-zero-lifetime-ra branch from c038e83 to d28623d Compare September 9, 2026 15:50
@yuwata yuwata added good-to-merge/waiting-for-ci 👍 PR is good to merge, but CI hasn't passed at time of review. Please merge if you see CI has passed and removed good-to-merge/with-minor-suggestions labels Sep 9, 2026
@yuwata

yuwata commented Sep 9, 2026

Copy link
Copy Markdown
Member

@quanyeyang Thank you! I slightly adjusted the commits to address suggestions by Claude and squash them.

@yuwata yuwata added this to the v262 milestone Sep 9, 2026
@yuwata
yuwata merged commit 5199e96 into systemd:main Sep 10, 2026
74 of 97 checks passed
@github-actions github-actions Bot removed the good-to-merge/waiting-for-ci 👍 PR is good to merge, but CI hasn't passed at time of review. Please merge if you see CI has passed label Sep 10, 2026
@quanyeyang
quanyeyang deleted the fix-ndisc-zero-lifetime-ra branch September 10, 2026 06:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Development

Successfully merging this pull request may close these issues.

sd-ndisc: any received RA cancels the pending initial Router Solicitation, even a lifetime-0 RA that networkd itself then discards

4 participants