#4588·sing-box

auto_redirect fails on Linux 5.4: TCP reject in prerouting_prematch is unsupported

Author: Lips7Created Sep 27, 2026Updated Sep 28, 2026
Labelsbug

Operating system

Linux

System version

GL.iNet GL-BE6500,官方固件(OpenWrt 23.05-SNAPSHOT),Linux 5.4.213,arm64,nftables 1.0.8。

Installation type

Original sing-box Command Line

If you are using a graphical client, please provide the version of the client.

No response

Version

bash
sing-box version 1.14.2

Environment: go1.26.8 linux/arm64
Tags: with_gvisor,with_quic,with_dhcp,with_wireguard,with_utls,with_acme,with_clash_api,with_tailscale,with_ccm,with_ocm,with_cloudflared,with_naive_outbound,with_usbip,with_openvpn,with_openconnect,badlinkname,tfogo_checklinkname0,with_musl
Revision: af6e64c3b69e6132ebaee0e1a3d24e93903f6709
CGO: enabled

Description

启用 auto_redirect 后,sing-box 1.14.2 在创建 nftables 规则时启动失败。nfnetlink_queue 和 nft_queue 模块均已安装并加载。

strace 定位到 prerouting_prematch 中的 TCP reset reject 规则。使用 nft -c 对照:同一规则在 PREROUTING 报 Not supported,在 INPUT 能通过。Linux 5.4 的 nft_reject_validate 不允许 PREROUTING;上游从 Linux 5.9 起支持。

请确认旧内核是否仍在支持范围内。如果支持,希望增加能力检测和兼容处理;如果不支持,希望文档明确这一依赖。

Reproduction

以下配置在隔离网络命名空间中已复现,不需要代理服务器、订阅或公网访问。保存为 config.json:

json
{
  "log": { "level": "debug", "timestamp": true },
  "inbounds": [{
    "type": "tun",
    "tag": "test-tun",
    "interface_name": "testtun0",
    "address": ["100.64.0.1/30", "fdfe:dcba:9876::1/126"],
    "auto_route": true,
    "auto_redirect": true,
    "stack": "system"
  }],
  "outbounds": [{ "type": "direct", "tag": "DIRECT" }],
  "route": { "final": "DIRECT", "default_interface": "lo" }
}

以 root 执行:

ip netns add sb-repro
trap 'ip netns del sb-repro' EXIT
ip -n sb-repro link set lo up
ip netns exec sb-repro sing-box run -c "$(pwd)/config.json"

Logs

bash
+0000 2026-09-27 16:01:13 WARN inbound/tun[test-tun]: enable offload: set udp offload: TUNSETOFFLOAD: invalid argument
+0000 2026-09-27 16:01:13 INFO inbound/tun[test-tun]: started at testtun0
+0000 2026-09-27 16:01:13 ERROR network: missing default interface
FATAL[0000] start service: post-start inbound/tun[test-tun]: auto-redirect: setup nftables: flush nftables: conn.Receive: netlink receive: operation not supported
netlink receive: operation not supported
netlink receive: operation not supported
netlink receive: operation not supported
netlink receive: operation not supported
netlink receive: operation not supported
netlink receive: operation not supported
netlink receive: operation not supported
netlink receive: operation not supported
netlink receive: operation not supported
netlink receive: operation not supported
netlink receive: operation not supported
netlink receive: operation not supported
netlink receive: operation not supported
netlink receive: operation not supported

Supporter

Integrity requirements

  • I confirm that I have read the documentation, understand the meaning of all the configuration items I wrote, and did not pile up seemingly useful options or default values.
  • I confirm that I have provided the server and client configuration files and process that can be reproduced locally, instead of a complicated client configuration file that has been stripped of sensitive data.
  • I confirm that I have provided the simplest configuration that can be used to reproduce the error I reported, instead of depending on remote servers, TUN, graphical interface clients, or other closed-source software.
  • I confirm that I have provided the complete configuration files and logs, rather than just providing parts I think are useful out of confidence in my own intelligence.