DanielLavrushin:b4 的 nftables 代理集重建可能短暂丢失部分新连接
DanielLavrushin 报告,在 b4 main f09aa4455 上,nftables 代理集重建测试单独运行 5 次均失败:典型测试中,设备发起的 10506 条新连接有 132 条未到代理监听器,约 1.3%;路由器本机连接不受影响,也没有从普通出口泄漏。相同 iptables 测试通过,不重建时无丢失。作者尚未二分定位,建议检查 11 月 13 日至 19 日之间的改动和 nftables 替换顺序。
作者原文@DanielLavrushin
TestNetnsARebuiltProxySetKeepsTakingItsConnectionsNft(src/tables/routing_netns_proxy_rule_test.go, part ofmake test-netns) fails on main. While a proxy set is rebuilt, which is what a config save does, some new connections from a LAN device never reach the proxy listener on the nftables backend.Measured
On main
f09aa4455, on a quiet development machine (load about 1 on 24 cores), the test run on its own:
- Fails 5 of 5 runs.
- A typical run:
while the set was rebuilt 8 time(s): 0 packet(s) for the address it proxies left by the ordinary uplink, 132 of 10506 new connections from a device and 0 of 487 from the router never reached its listener.- Without a rebuild, the same traffic loses nothing (
with no rebuild running: ... lost=0).- The iptables twin,
TestNetnsARebuiltProxySetKeepsTakingItsConnections, passes.So the loss is about 1.3% of new device connections opened during the rebuild window, nftables only. The router's own connections are not affected, and nothing leaks through the ordinary uplink.
History
The same test passed 10 of 10 on a quiet machine on 2026-11-13 and has failed on its own on main since 2026-11-19, so a change between those dates is a likely cause. Not bisected.
Impact
On routers whose firewall runs on nftables (OpenWrt with fw4, for example), each rebuild of a proxy set briefly breaks a small share of the new device connections opened during it. Most apps retry, so this is minor in use, but it is what the test was written to prevent (#572).
Suggested direction
- Bisect main between 2026-11-13 and 2026-11-19 with this test alone (
B4_NETNS_TEST=1,-test.run '^TestNetnsARebuiltProxySetKeepsTakingItsConnectionsNft$').- Compare the nftables rebuild sequence with the iptables one: the iptables twin passes, so the gap is likely in how the nft proxy chains or sets are replaced.