Skip to content

fix(cni): Advertise a default route to tap guests as soon as they start - #829

Merged
privateip merged 2 commits into
mainfrom
fix/issue-828
Oct 9, 2026
Merged

privateip merged 2 commits into
mainfrom
fix/issue-828

Conversation

@privateip

@privateip privateip commented Oct 9, 2026 •

Copy link
Copy Markdown
Contributor

Summary

A tap-attached guest learns its IPv6 default route only from galactic-cni's Router Advertisements, and the first one arrived seconds to minutes after the guest started, so outbound connections failed with network is unreachable in the meantime.

The sender now advertises the moment the VMM opens the tap, followed by the short initial burst RFC 4861 allows, and a guest that restarts gets a fresh burst.

Duplicate address detection is off on the tap's host side, and an address still being assigned is retried within a fraction of a second instead of growing the retry backoff. The end-to-end target, a first connection under two seconds after the tap gains carrier, needs a real VM guest, so it is checked on staging after merge.

Test plan

  • A new tap guest gets an advertisement without sending a Router Solicitation, then two more 3 seconds apart
  • A tap gaining carrier starts its sender at once, and an address still being assigned leaves the backoff unchanged
  • Build, lint, and unit tests pass

Fixes #828

🤖 Generated with Claude Code

A tap-attached guest learns its IPv6 default route only from the Router Advertisements galactic-cni sends on the tap's host side. Three things delayed the first one by seconds to minutes. The actor started only on the reconcile tick after the tap gained carrier. Its bind to the tap's link-local address failed while duplicate address detection held the address tentative, and each failure doubled the retry backoff. Once running it sent nothing until a solicitation arrived or the first 220 to 300 second resend fired, so a solicitation sent before it was listening was lost.

The actor now sends an advertisement as soon as its connection opens and two more 3 seconds apart, the initial burst RFC 4861 section 6.2.4 allows, before falling back to the jittered schedule. Solicited replies keep the 3 second rate limit.

The tap is created with accept_dad=0. It is a point-to-point link to one guest, so the address has nothing to collide with, and the sysctl is set before the tap has carrier, which is before the kernel assigns the link-local address. RunActor now wraps a missing link-local address or an EADDRNOTAVAIL bind in radv.ErrAddrNotReady. The actor goroutine retries that every 100ms for up to 2 seconds, since the kernel clears the tentative flag just after the carrier event, and a start that still fails with it is retried on the next reconcile without growing the backoff.

A netlink link subscription now reconciles the actors as soon as a tuntap device gains carrier. The 2 second ticker and the watcher feed one channel, keeping Run within the gocyclo budget, and a failed subscription is retried after 5 seconds while the ticker still serves every tap.

The burst test fails on the old loop, which sent nothing in the test's window. New tests cover the carrier transitions, resubscription, the address-not-ready retry, and the backoff staying flat. The under-two-seconds criterion needs a VMM, so it is left for staging.

Fixes #828

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@privateip privateip self-assigned this Oct 9, 2026
A guest that restarts loses and regains carrier on its tap while its actor keeps running, so it got no fresh initial burst. reconcileRadvActors now cancels a running actor whose interface has no carrier; the carrier's return starts a new one, which advertises at once and sends a new burst.

A tap with carrier that never gets a usable link-local address used to retry forever with debug logs only. Consecutive exhaustions of the address-not-ready retries are now counted, warned about once at the failure threshold, and backed off like any other failure.

A failed advertisement write no longer uses up a slot in the initial burst. A failed tap sysctl write is logged at debug level instead of discarded. The EADDRNOTAVAIL classification moves into a helper with a test through the net error wrapping, the initial-burst test no longer flakes on a loaded runner, and the docs note that a solicited reply counts toward the burst.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@privateip
privateip marked this pull request as ready for review October 9, 2026 12:47
@privateip
privateip requested a review from a team as a code owner October 9, 2026 12:47
@privateip
privateip enabled auto-merge October 9, 2026 12:48
@privateip

Copy link
Copy Markdown
Contributor Author

Both second-pass reviewers on head 5faa3cb returned VERDICT: merge. The re-review confirmed the carrier-loss restart, the sysctl debug log, the not-ready counter and backoff, the solicited-reply docs, the burst test timing and the address-not-ready helper fixed; two of those were tamper-tested.

Remaining nits, none blocking: the second commit subject says "RA actor", no test pins counting only successful writes, and a stale failure report from a cancelled actor could cancel a fresh one for a single cycle. The summary nit about sentence count is fixed in the body.

Reach is limited to galactic-cni Go code. It ships to staging on merge and to prod on release. The under-two-seconds end-to-end check needs a VM guest and runs on staging after merge.

CI is green on the head: build, lint, unit, root unit and e2e tests, and every image publish. Auto-merge is enabled with a merge commit, the only method the ruleset allows, and waits for one code-owner approval.

PRs #613 and #598 rebase onto this PR after it lands.

@privateip
privateip merged commit 097a838 into main Oct 9, 2026
15 checks passed
@privateip
privateip deleted the fix/issue-828 branch October 9, 2026 13:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Tap-attached guests have no IPv6 default route for several seconds after start

2 participants