Repository navigation
fix(xdp): Retire gateway and NAT hooks from unselected interfaces - #1553
Conversation
The XDP dispatcher's links are pinned, so they outlive the process that attached them, and DispatchSet only ever added roles and links. After a restart that moved a side from its bond members to a VLAN netdevice, the members kept xdp_dispatch with the gateway's and the shard's role bits. The programs kept claiming untagged and wrong-VLAN frames on the parent. An interface an earlier auto-detection had picked kept its hook the same way. Add RetireRole in xdpattach. Under the dispatch lock it removes one datapath's role from every interface outside the kept set, then releases the root from each such interface that no Galactic role uses any more. A bond member goes through the attach guards: one that is the only member of its bond carrying traffic stays attached until a sibling carries traffic, and each released member must rejoin its bond before the next is touched. Other datapaths' role bits and slots stay as they are. DispatchSet.Retire and Set.Retire expose this for dispatch and direct mode, and ReleaseDispatcherRoles covers a component that starts in direct mode after running in dispatch mode. xdpdispatch gains read-only PinnedLinks and RoleRows. galactic-gateway retires on startup and after every re-resolution, and takes a role it no longer runs off every interface. galactic-nat retires on startup, and after a re-resolution only with an explicit uplink override: an auto-detected set follows routes, and a route flap would bounce an uplink twice. Root tests in edgeattach move the public side from tagged on a VLAN of a bond, to untagged on the bond, and back, with a restart for each move in both host modes. They check that XDP runs on the selected interfaces only and that untagged and wrong-VLAN frames are not claimed while the side is tagged. They also check that an interface dropped from the selection loses its role and its pinned link after a restart. Both tests fail without the fix, and the first one reproduces the wrong-VLAN claims. Fixes #1552
|
Test evidence for 3a29399. The root tests ran as root in a privileged container with a private bpffs.
With Checks:
|
The gateway and the NAT shard retired on every pass, even one that left a newly selected interface uncovered, so an old hook could come off before its replacement was on. Retire a side only on a pass whose targets are all covered. The NAT shard's startup retirement now waits for the same condition. It runs on the first pass that covers every uplink, and later passes retire again only with an explicit uplink override.
Wrap the over-long line in the XDP mode guide, make the nil-retirer test fail on a panic instead of asserting dead code, and drop an issue number from a production comment.
|
Review record for head 82197ef, the last commit of three on this branch. First pass at 3a29399: pr-adversary VERDICT merge, with a nit that retire ran before full coverage and a warning about lock hold when the gateway retires a departed bond member. The warning was answered: a departed member is no longer a bond slave, so the wait returns immediately. It could not run the root tests. pr-conventions-reviewer VERDICT hold, for a body over the summary limit, no checkbox test plan, a contract.md overlap with draft #1549, the lab soak, and no test run. Fixes in 9f209b5: retire is gated on full coverage in the gateway (retireCovered) and in NAT (uplinkRetirer.afterCoverage), and the body was rewritten with a checkbox test plan. Second pass at 9f209b5: pr-rereviewer VERDICT merge, both fixes confirmed, with nits on a doc line wrap and a dead-code test assertion. pr-conventions-reviewer VERDICT merge, with a decision on the overlap with #597 and #1549. The overlap is resolved: #1549 merges cleanly with this head by git merge-tree, and #597 is a stale draft against main, outside this base's scope. The lab soak is deferred to a later #1405 run per the epic coordinator's brief. Commit 82197ef applies only the two nits (doc wrap, nil-retirer test), so there was no third review. Tests: the author ran the root tests in a privileged container, and edgeattach, xdpattach, xdpdispatch, galactic-gateway and galactic-nat all pass. CI on 82197ef is green, including Unit Tests (root). Auto-merge is enabled with the merge method, as the epic requires. The base branch has no pull-request rule, so auto-merge can complete without a human approval here. |
Fixes #1552
When a restart changes which interfaces the gateway or the NAT shard selects, the new process now removes the XDP hooks it left on the interfaces it dropped. It does this only after every newly selected interface is covered. Other datapaths' hooks stay as they are, and bond members are detached one at a time. Lab confirmation is still to come, in a later #1405 run; the test output is in a comment below.