You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Cilium removes Galactic's uplink uSID filter whenever it reloads #1561
Galactic's CNI attaches its uSID ingress program to each uplink as a classic tc filter. On nodes where Cilium also attaches to those uplinks through TCX, Cilium deletes every classic tc filter on the interface each time it reloads its own programs. It reloads whenever pods or links change on the node.
The filter stays gone for about a second, until Galactic's CNI notices and attaches it again. During that second:
SRv6 traffic for the node arrives on the uplink and is not decapsulated.
The gateway reports that it cannot deliver to backends on its own node, so core stops serving those backends and an Edge public listener's backend set flaps.
On the containerlab lab this happened every 6 to 13 seconds while a listener failover test ran, on both edge nodes at once. Evidence and the Cilium source are in the first comment.
Expected
Galactic's ingress program stays attached while Cilium reloads, and the gateway's local delivery report changes only when Galactic's own datapath does.
Proposed fix
Attach the uSID ingress program through TCX on kernels that support it, ordered after Cilium's programs so packets see today's order. Cilium's cleanup removes classic tc filters only, not another program's TCX attachment. Keep the classic filter as the fallback where TCX is unavailable, and point the attachment health check at whichever one is in use.
Acceptance criteria
On a node where Cilium attaches to the uplinks through TCX, a Cilium reload leaves the uSID ingress program attached, and a test covers an outside process deleting every classic tc filter on the interface.
The gateway's local delivery report stays steady during pod and link churn on the lab's edge nodes.
Kernels without TCX keep today's classic filter attach.
galactic-cni attaches usid_ingress as the clsact filter galactic_usid_ingress, priority 1, handle 1.
In Cilium v1.20.4, attachSKBProgram in pkg/datapath/loader/tc.go calls removeTCFilters(device, parent) after every successful TCX upsert, including updates of an existing link. removeTCFilters lists every filter for that parent and deletes each one, with no check on name, priority or handle. Only the legacy path, removeStaleTCFilters, skips filters it does not own.
On the containerlab lab, both dfw edge nodes' uplinks are bonds that Cilium auto-detects as devices, with TCX on. During a listener failover test:
tc filter show dev bond0 ingress, sampled every 0.5 s, showed both bonds empty at the same instant for about 1 s, every 6 to 13 s, then galactic_usid_ingress back at pref 1 handle 0x1.
The empty samples match Cilium agent log lines Updated link for program ... devices/bond0/links/cil_from_netdev and the same for bond1.
galactic-gateway logged Not delivering to backends on this node: usid_ingress is not attached to the public interface with interface "bond0": galactic uSID ingress filter not attached 33 times in one 26 s window, and galactic-cni's periodic health check reported the same for bond0 and bond1.
The NetworkGateways' status.localDelivery flipped between true and false every 2 to 4 s while Ready stayed True, and the EdgeListener's Programmed message alternated with "1 on gateway nodes are excluded".
Cilium's netdev reloads came only with link churn: none during a test run with no link changes, and 11 in one minute while interfaces were reconfigured.
Confirmed on main at 2d5d35b, from source on both sides. I didn't rerun it in the lab. The lab evidence in the first comment matches what the source predicts.
Galactic.usid_ingress reaches an uplink only through the classic clsact filter galactic_usid_ingress, priority 1, handle 1 (attachOneAtPriority). Both the CNI's health check and the gateway's IngressAttachedTo find it by that filter name (checkAttachedOne). The only repair is the watch loop's next reconcile, which runs after a netlink event or a health nudge (reconcile), and that leaves the gap.
Cilium v1.20.4. After every successful TCX upsert, attachSKBProgram calls removeTCFilters (tc.go#L44-L57), and that function deletes every filter on the parent with no ownership check (tc.go#L199-L216). Cilium creates its own TCX links at link.Tail() (tcx.go#L63).
Findings beyond the issue text:
ResolveInterfaces expands a bond into the master plus its members (expandBondSlaves). Cilium manages only the master, so on a bonded uplink the members keep their filters. The datapath gap (point 1 in the issue) then depends on how much traffic the master's own filter handles. The health and local-delivery flap (point 2) happens whatever the answer, because both checks require the master's filter. On a non-bonded uplink that Cilium manages, both points apply in full.
Because Cilium attaches at the tail, a Galactic TCX link attached before Cilium's first link is created ends up ahead of Cilium. "After Cilium's programs" therefore needs an ordering check and repair, not only a tail anchor at attach time.
A TCX link detaches when its last reference closes. It has to be pinned under the existing bpffs pin directory to survive a galactic-cni restart, the way the classic filter does today.
Root cause.attachOneAtPriority attaches usid_ingress to uplinks only as a classic tc filter, and checkAttachedOne and IngressAttachedTo recognise only that filter. Cilium deletes every classic filter on a device it moves to TCX, as the comment above shows.
Fix, in internal/plumbing/ebpf/attach:
Attach usid_ingress to each uplink through a TCX link at the tail of the ingress chain, pinned under the existing bpffs pin directory so it survives a galactic-cni restart.
On re-attach, open the pinned link and update its program in place. Once the TCX link is in place, remove any classic galactic_usid_ingress filter on that interface, so the upgrade has no gap.
Where the kernel has no TCX, keep today's classic filter attach.
When another program sits after ours on the hook, the watch loop's reconcile re-attaches ours at the tail, new link first and old link second.
The health check and IngressAttachedTo accept either our TCX program or the classic filter.
Tenant veths and taps keep the classic path, since Cilium does not manage them.
Tests. Unit tests cover the TCX path, the fallback, the ordering repair, and the health check through the package's override points. A privileged test attaches, deletes every classic filter on the interface the way Cilium does, and checks that usid_ingress stays attached. It fails on main and passes with the fix.
Risk. A program after Cilium's runs only if Cilium's program passes the packet on to the next program in the chain. Today's classic filter has the same dependency, and the lab shows it carries traffic. Kernels without TCX see no change.
Verification.task ci, task test:unit-root, and a lab run with link churn that checks status.localDelivery stays steady.
Three changes from the approved plan, found while implementing it:
Moving the link to the tail. The plan said to attach the new link first and detach the old one second. The kernel refuses the same program twice on one tcx hook, so that order cannot work. The move now attaches the classic galactic_usid_ingress filter first, detaches the old link, attaches the new link at the tail, and removes the filter. While the old link is gone, packets pass the tcx chain and reach the classic filter, so usid_ingress stays on the path throughout.
Pin names. Links are pinned under /sys/fs/bpf/galactic/links/usid_ingress/<netns inode>_<interface name>, not by ifindex. galactic-gateway knows only the interface name, and one bpffs serves every network namespace on a host.
Pin cleanup. Every attach and reconcile removes pins whose device is gone. The kernel has already detached those links, and without the cleanup each deleted interface would leave its pin behind.
One more change from the approved plan, in #1571: the tcx link goes at the head of the chain, ahead of Cilium, not at the tail.
tcx runs the next program only after a TC_ACT_UNSPEC verdict. Cilium v1.20.4's cil_from_netdev returns CTX_ACT_OK, which is TC_ACT_OK (skb.h#L26), so a program behind it never sees the packets it passes. The classic galactic_usid_ingress filter has the same blind spot on every device Cilium manages. Bonded uplinks kept working because their member ports, which Cilium leaves alone, carry their own filter. On a bond, then, point 1 of this issue (traffic not decapsulated) did not come from the master's filter going missing.
usid_ingress returns TC_ACT_UNSPEC for every packet it does not handle, so Cilium still sees all other traffic. It no longer sees the outer form of the SRv6 packets usid_ingress decapsulates. This comes from reading the source; the PR stays a draft until root tests and a lab run confirm it on a kernel.
Activity
privateip commentedon Dec 1, 2026
Evidence and the Cilium source behind this issue.
galactic-cniattachesusid_ingressas the clsact filtergalactic_usid_ingress, priority 1, handle 1.In Cilium v1.20.4,
attachSKBPrograminpkg/datapath/loader/tc.gocallsremoveTCFilters(device, parent)after every successful TCX upsert, including updates of an existing link.removeTCFilterslists every filter for that parent and deletes each one, with no check on name, priority or handle. Only the legacy path,removeStaleTCFilters, skips filters it does not own.On the containerlab lab, both dfw edge nodes' uplinks are bonds that Cilium auto-detects as devices, with TCX on. During a listener failover test:
tc filter show dev bond0 ingress, sampled every 0.5 s, showed both bonds empty at the same instant for about 1 s, every 6 to 13 s, thengalactic_usid_ingressback at pref 1 handle 0x1.Updated link for program ... devices/bond0/links/cil_from_netdevand the same for bond1.galactic-gatewayloggedNot delivering to backends on this node: usid_ingress is not attached to the public interfacewithinterface "bond0": galactic uSID ingress filter not attached33 times in one 26 s window, andgalactic-cni's periodic health check reported the same for bond0 and bond1.status.localDeliveryflipped between true and false every 2 to 4 s while Ready stayed True, and the EdgeListener's Programmed message alternated with "1 on gateway nodes are excluded".privateip commentedon Dec 1, 2026
Confirmed on
mainat 2d5d35b, from source on both sides. I didn't rerun it in the lab. The lab evidence in the first comment matches what the source predicts.Galactic.
usid_ingressreaches an uplink only through the classic clsact filtergalactic_usid_ingress, priority 1, handle 1 (attachOneAtPriority). Both the CNI's health check and the gateway'sIngressAttachedTofind it by that filter name (checkAttachedOne). The only repair is the watch loop's next reconcile, which runs after a netlink event or a health nudge (reconcile), and that leaves the gap.Cilium v1.20.4. After every successful TCX upsert,
attachSKBProgramcallsremoveTCFilters(tc.go#L44-L57), and that function deletes every filter on the parent with no ownership check (tc.go#L199-L216). Cilium creates its own TCX links atlink.Tail()(tcx.go#L63).Findings beyond the issue text:
ResolveInterfacesexpands a bond into the master plus its members (expandBondSlaves). Cilium manages only the master, so on a bonded uplink the members keep their filters. The datapath gap (point 1 in the issue) then depends on how much traffic the master's own filter handles. The health and local-delivery flap (point 2) happens whatever the answer, because both checks require the master's filter. On a non-bonded uplink that Cilium manages, both points apply in full.galactic-cnirestart, the way the classic filter does today.privateip commentedon Dec 1, 2026
Approved fix plan.
Root cause.
attachOneAtPriorityattachesusid_ingressto uplinks only as a classic tc filter, andcheckAttachedOneandIngressAttachedTorecognise only that filter. Cilium deletes every classic filter on a device it moves to TCX, as the comment above shows.Fix, in
internal/plumbing/ebpf/attach:usid_ingressto each uplink through a TCX link at the tail of the ingress chain, pinned under the existing bpffs pin directory so it survives agalactic-cnirestart.galactic_usid_ingressfilter on that interface, so the upgrade has no gap.IngressAttachedToaccept either our TCX program or the classic filter.Tenant veths and taps keep the classic path, since Cilium does not manage them.
Tests. Unit tests cover the TCX path, the fallback, the ordering repair, and the health check through the package's override points. A privileged test attaches, deletes every classic filter on the interface the way Cilium does, and checks that
usid_ingressstays attached. It fails onmainand passes with the fix.Risk. A program after Cilium's runs only if Cilium's program passes the packet on to the next program in the chain. Today's classic filter has the same dependency, and the lab shows it carries traffic. Kernels without TCX see no change.
Verification.
task ci,task test:unit-root, and a lab run with link churn that checksstatus.localDeliverystays steady.privateip commentedon Dec 2, 2026
Three changes from the approved plan, found while implementing it:
galactic_usid_ingressfilter first, detaches the old link, attaches the new link at the tail, and removes the filter. While the old link is gone, packets pass the tcx chain and reach the classic filter, sousid_ingressstays on the path throughout./sys/fs/bpf/galactic/links/usid_ingress/<netns inode>_<interface name>, not by ifindex.galactic-gatewayknows only the interface name, and one bpffs serves every network namespace on a host.privateip commentedon Dec 2, 2026
One more change from the approved plan, in #1571: the tcx link goes at the head of the chain, ahead of Cilium, not at the tail.
tcx runs the next program only after a
TC_ACT_UNSPECverdict. Cilium v1.20.4'scil_from_netdevreturnsCTX_ACT_OK, which isTC_ACT_OK(skb.h#L26), so a program behind it never sees the packets it passes. The classicgalactic_usid_ingressfilter has the same blind spot on every device Cilium manages. Bonded uplinks kept working because their member ports, which Cilium leaves alone, carry their own filter. On a bond, then, point 1 of this issue (traffic not decapsulated) did not come from the master's filter going missing.usid_ingressreturnsTC_ACT_UNSPECfor every packet it does not handle, so Cilium still sees all other traffic. It no longer sees the outer form of the SRv6 packetsusid_ingressdecapsulates. This comes from reading the source; the PR stays a draft until root tests and a lab run confirm it on a kernel.fix(attach): Attach usid_ingress to uplinks through tcx
fix(attach): Attach usid_ingress to uplinks through tcx