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
Gateway drops new TCP flows for 30 s after its node rejoins the fabric #1085
A gateway node that rejoins the fabric drops most new TCP flows to a VIP for up to about 30 seconds after the fabric routes the VIP to it again. The edge XDP program (internal/plumbing/ebpf/edgeprog/edgedsr.c) treats BPF_FIB_LKUP_RET_NO_NEIGH like any other FIB failure: it counts fib_no_neigh and returns XDP_DROP. Nothing then prompts the kernel to resolve the missing neighbor, so the gateway keeps dropping until the kernel learns the neighbor some other way.
task verify:gateway-node-loss in the containerlab lab fails on this, reproducibly.
Steps to reproduce
Deploy the lab from main with task deploy.
Run task verify:gateway-node-loss. It takes one gateway node's fabric links down, checks the VIP through the site's other gateway node, brings the links back, waits until the transit router routes the VIP through the returning node and LACP settles, then checks the VIP through it.
What happens
The check through the returning node answers 1 or 3 of 8 TCP flows, while all 8 UDP flows succeed, and the task fails. The returning node's galactic_edge_drops_total{reason="fib_no_neigh"} rises, as does its TCP rule-drop counter for the VIP. A check repeated about 30 seconds later answers 8 of 8, and so does every check afterwards.
Expected
A gateway node serves every flow the fabric sends it from the moment it advertises the VIP again. When a FIB lookup returns NO_NEIGH, the packet should either reach the kernel so it resolves the neighbor, as usid_ingress does for the same case, or the gateway should resolve its next hops before it advertises.
Notes
The same counter has been seen rising on gateway restarts, which may also explain occasional lost VIP requests in verify:gateway-restart.
The NO_NEIGH drop this issue names is real, but it is not what loses most of the flows. In the lab it costs one packet per rejoin, and #1101 hands that packet to the kernel instead. With #1101 deployed, the node-loss check still answers 3 of 8 TCP flows in 6 of 9 runs, with no gateway drop counter moving.
The main cause is a gap between the two directions after the links come back. The transit router starts hashing VIP flows to the returning gateway node within a second, before its BGP table holds the node's path again. The node's own route back to the clients returns 3 to 33 seconds later. Until it does, the reply path's FIB lookup resolves the client through the node's default route, which in the lab is the management interface. The XDP redirect to that interface fails inside the kernel after the program has returned, so no gateway counter records the loss.
UDP only looked healthy because the check runs its UDP flows after the TCP ones, by which time the route is back.
Still open:
Why the transit router's forwarding regains the node's next hop before BGP re-learns its path, and whether production upstreams behave the same way.
The gateway cannot see these drops at all. A redirect to an interface the XDP program does not run on should at least be counted.
The main cause, a withdrawn ECMP next hop reinstalled before BGP is up, is fixed by draft fix(fabric-router): Stop zebra reinstalling withdrawn next hops #1114 (FRR zebra patch). It still merges cleanly into main, its CI is green, and it targets the FRR 10.7.1 that main pins. The arm64 image build is the only item left in its test plan.
edge_return still drops a reply whose next hop has no neighbor entry (edgedsr.cedge_return_v6/edge_return_v4, count_fib_drop then XDP_DROP). Handing that reply to the kernel, the way fix(gateway): Let the kernel resolve an unresolved next hop #1101 does on the forward path, would not help. The kernel has no conntrack entry for a DSR reply, so it marks the reply INVALID and KUBE-FORWARD drops it before neighbor resolution starts. This is the reason edge_return exists (see its header comment).
A redirect that fails inside the kernel after the program returns is still invisible. leave_via counts only a refused bpf_redirect call, and nothing observes xdp:xdp_redirect_err. This is how the lab's replies to the management interface were lost without any gateway counter moving.
I have not re-run verify:gateway-node-loss this time. The only running lab belongs to other work, and the check takes fabric links down. The run results above in this thread still stand.
Plan for the part with no fix yet: making redirect transmit failures visible.
Root cause.leave_via in internal/plumbing/ebpf/edgeprog/edgedsr.c counts redirect_failed only when the bpf_redirect call itself is refused. A redirect can still fail in the kernel after the program has returned:
If the target device has no ndo_xdp_xmit, the kernel fires xdp:xdp_redirect_err.
If the target is a veth whose peer runs no XDP program, the frames are dropped at flush and the kernel fires xdp:xdp_bulk_tx with drops > 0.
Nothing in galactic observes either tracepoint.
Fix.
A small BPF tracepoint program counts both events, keyed by target ifindex and errno.
galactic-gateway attaches it with the edge datapath and keeps running without it if the attach fails.
edgemetrics exports it as galactic_edge_redirect_xmit_drops_total{ifname,reason}.
docs/gateway/packet-paths.md documents it.
I chose this over checking in the hot path whether each egress interface can transmit XDP frames. That check would need userspace to track every interface's XDP features, and a veth's answer changes with its peer.
Tests. A root-gated test sends a VIP reply through edge_return to a veth whose peer has no XDP program and asserts that the counter counts the dropped frame. The test fails on main. A collector unit test covers the metric.
Risk. The change adds observability only, with no change to any packet verdict. xdp_bulk_tx has no program ID, so its count covers every XDP program on the node that redirects, and the ifname label separates them.
Not covered.edge_return still drops a reply whose next hop has no neighbor entry. As noted above, a kernel handoff would not help there. The issue also stays open until #1114 lands.
Implementation changes to the plan above, found while building and testing the fix:
Raw tracepoints instead of tracepoints. A tracepoint attach looks up the event through tracefs, which the gateway pod does not mount, so it would always fail there. The programs attach to xdp_redirect_err and xdp_bulk_tx as raw tracepoints, by name, and read the target ifindex through a CO-RE relocation against the kernel's BTF. On a kernel whose xdp_redirect_err arguments differ, the error is still counted, under ifindex 0.
The veth example was wrong. On Linux 7.3, a native XDP redirect into a veth whose peer runs no XDP program was delivered. The case the counter covers is a target whose driver has no ndo_xdp_xmit, which reports redirect_eopnotsupp. The docs and help text no longer name veth.
Test setup. The regression test sends a VIP reply through edge_return to a dummy interface. The reply arrives over a veth, because XDP on a veth runs from NAPI and flushes redirects as a NIC driver does, while a tap's write path never flushes them. On main, edge_return claims the reply, counts no drop, and the frame never leaves the dummy. With the fix, the counter records it under redirect_eopnotsupp.
Labels and attribution. The labels are interface and reason. Neither tracepoint can be tied to the gateway's programs: under the dispatcher, xdp_redirect_err reports the dispatcher's program ID. So both stages count every XDP program on the node.
Activity
fix(gateway): Hand packets to the kernel when the next hop is unresolved
fix(gateway): Let the kernel resolve an unresolved next hop
privateip commentedon Oct 26, 2026
The NO_NEIGH drop this issue names is real, but it is not what loses most of the flows. In the lab it costs one packet per rejoin, and #1101 hands that packet to the kernel instead. With #1101 deployed, the node-loss check still answers 3 of 8 TCP flows in 6 of 9 runs, with no gateway drop counter moving.
The main cause is a gap between the two directions after the links come back. The transit router starts hashing VIP flows to the returning gateway node within a second, before its BGP table holds the node's path again. The node's own route back to the clients returns 3 to 33 seconds later. Until it does, the reply path's FIB lookup resolves the client through the node's default route, which in the lab is the management interface. The XDP redirect to that interface fails inside the kernel after the program has returned, so no gateway counter records the loss.
UDP only looked healthy because the check runs its UDP flows after the TCP ones, by which time the route is back.
Still open:
fix(gateway): Let the kernel resolve an unresolved next hop
fix(fabric-router): Stop zebra reinstalling withdrawn next hops
privateip commentedon Nov 17, 2026
Re-checked against
mainat 974132e. The issue is still valid, and part of it is fixed.Fixed on
mainedge_lbhand a NO_NEIGH packet to the kernel and count it inneigh_fallbacks, so the drop named in the summary no longer happens on the forward path.Still open
main, its CI is green, and it targets the FRR 10.7.1 thatmainpins. The arm64 image build is the only item left in its test plan.edge_returnstill drops a reply whose next hop has no neighbor entry (edgedsr.cedge_return_v6/edge_return_v4,count_fib_dropthenXDP_DROP). Handing that reply to the kernel, the way fix(gateway): Let the kernel resolve an unresolved next hop #1101 does on the forward path, would not help. The kernel has no conntrack entry for a DSR reply, so it marks the replyINVALIDandKUBE-FORWARDdrops it before neighbor resolution starts. This is the reasonedge_returnexists (see its header comment).leave_viacounts only a refusedbpf_redirectcall, and nothing observesxdp:xdp_redirect_err. This is how the lab's replies to the management interface were lost without any gateway counter moving.I have not re-run
verify:gateway-node-lossthis time. The only running lab belongs to other work, and the check takes fabric links down. The run results above in this thread still stand.privateip commentedon Nov 17, 2026
Plan for the part with no fix yet: making redirect transmit failures visible.
Root cause.
leave_viaininternal/plumbing/ebpf/edgeprog/edgedsr.ccountsredirect_failedonly when thebpf_redirectcall itself is refused. A redirect can still fail in the kernel after the program has returned:ndo_xdp_xmit, the kernel firesxdp:xdp_redirect_err.xdp:xdp_bulk_txwithdrops > 0.Nothing in galactic observes either tracepoint.
Fix.
galactic-gatewayattaches it with the edge datapath and keeps running without it if the attach fails.edgemetricsexports it asgalactic_edge_redirect_xmit_drops_total{ifname,reason}.docs/gateway/packet-paths.mddocuments it.I chose this over checking in the hot path whether each egress interface can transmit XDP frames. That check would need userspace to track every interface's XDP features, and a veth's answer changes with its peer.
Tests. A root-gated test sends a VIP reply through
edge_returnto a veth whose peer has no XDP program and asserts that the counter counts the dropped frame. The test fails onmain. A collector unit test covers the metric.Risk. The change adds observability only, with no change to any packet verdict.
xdp_bulk_txhas no program ID, so its count covers every XDP program on the node that redirects, and theifnamelabel separates them.Not covered.
edge_returnstill drops a reply whose next hop has no neighbor entry. As noted above, a kernel handoff would not help there. The issue also stays open until #1114 lands.privateip commentedon Nov 17, 2026
Implementation changes to the plan above, found while building and testing the fix:
xdp_redirect_errandxdp_bulk_txas raw tracepoints, by name, and read the target ifindex through a CO-RE relocation against the kernel's BTF. On a kernel whosexdp_redirect_errarguments differ, the error is still counted, under ifindex 0.ndo_xdp_xmit, which reportsredirect_eopnotsupp. The docs and help text no longer name veth.edge_returnto a dummy interface. The reply arrives over a veth, because XDP on a veth runs from NAPI and flushes redirects as a NIC driver does, while a tap's write path never flushes them. Onmain,edge_returnclaims the reply, counts no drop, and the frame never leaves the dummy. With the fix, the counter records it underredirect_eopnotsupp.interfaceandreason. Neither tracepoint can be tied to the gateway's programs: under the dispatcher,xdp_redirect_errreports the dispatcher's program ID. So both stages count every XDP program on the node.fix(gateway): Skip redirect drop counter on old kernels