Repository navigation
fix(cni): pin neighbor entries for DAN taps on both sides - #1374
Merged
Merged
Conversation
A new Kata guest's first packets waited for neighbor discovery between the guest and the host: the host had no entry for the guest, and the guest had to resolve its gateway. In a test cell a fresh guest's DNS lookups failed until the guest's first neighbor reconfirmation, several seconds after boot. The DAN file already fixes the guest's MAC, and galactic-tap knows the tap's host MAC, so neither side needs discovery: - galactic-tap gives the guest a permanent neighbor entry for each gateway, pointing at the tap's host MAC. - galactic-bgp reads the guest MAC back from the DAN file and primes a permanent neighbor entry for the guest's addresses on the host, as it does for a veth. Taps without a DAN file are unchanged.
ecv
approved these changes
Nov 6, 2026
ecv
left a comment
Contributor
There was a problem hiding this comment.
Approve.
Pinned entries are per-link, so they die with the tap and cannot leak to a later tenant; the guest MAC is host-derived, not guest-supplied.
- Isolation: the host-side permanent entry is installed on the tap link in the host netns via the existing
installGatewayNeighbor; the guest-side entries live in the guest's own stack from the DAN file. A reused IP lands on a new tap with its own neighbor table, so nothing stale carries over. DEL removes the DAN file (ops_del.go) and the tap, which drops its entries. - MAC trust: the guest MAC comes from
guestMAC(tapName), a sha256 of the host-generated tap name, written by cnitap and read back by cnibgp. It is not guest-supplied, and it is stable across reboots, so the old comment's "stale permanent entry after a guest reboot" worry does not apply to DAN taps. - Repair and re-up:
activateTrafficPolicypassescfg.guestHWAddrintoRestoreHostGateway, andreenslave.goalready preserves NUD_PERMANENT entries, so both paths keep the pin. - Upgrade: existing DAN files carry
"neighbors": [], which still unmarshals into[]Neighbor. A repeated ADD on a live tap just re-sets the entry idempotently (NeighSet). Already-running guests keep their old file with no guest-side pin and still resolve through the existingEnsureTapGuestNeighborssweep. - No new conflist field.
DANDiralready existed, and cnibgp now reads it with the same env/conflist/default resolution as cnitap, so the two agree. A DAN read failure only warns and skips the pin. - Guest-side pin uses the tap's kernel-assigned MAC at ADD. If a tap were ever recreated for a live guest with a new MAC, the guest's permanent gateway entry would go stale and never refresh; nothing here does that today.
Follow-ups:
- Confirm on a real Kata runtime-rs node that the shim honors
state: 0x80for guest neighbors (the PR does not say it was observed), and that the entry showsPERMANENTin the guest.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Requested by Scot Schuchert-Wells
Addresses datum-cloud/compute#630. Related: datum-cloud/enhancements#921.
Problem
A freshly started Kata guest cannot resolve names for its first few seconds. A boot-time trace inside a test guest showed this:
The host had no neighbor entry for the guest. The guest had to resolve its gateway itself. So the first packets in each direction depended on neighbor discovery completing.
Change
The DAN file already fixes the guest's MAC (derived from the tap name), and
galactic-tapknows the tap's host MAC. So neither side needs to discover the other:galactic-tapwrites a permanent neighbor entry for each gateway (IPv6 and IPv4) into the DAN file, pointing at the tap's host MAC. The Kata runtime-rs shim installs these in the guest at boot.galactic-bgpreads the guest MAC back from the DAN file.RestoreHostGatewaythen installs a permanent neighbor entry for the guest's addresses on the host side of the tap, as it already does for a veth.The DAN
neighborsfield is now typed. It follows Kata's schema:ip_addressas CIDR,hardware_addr,state,flags.stateisNUD_PERMANENT. The CNI conflist reference describes the behaviour.Testing
galactic-bgpderiving the tap guest's MACgo build ./...,go vet,golangci-lint(0 issues) andgo testpass in a Linux build container forinternal/cnitap,internal/plumbing/danand the newinternal/cnibgptest.internal/cnibgpandinternal/hostgwtests need VRF support. They fail in that container onmaintoo, with the same 13 failures.