SagerNet / sing-box

The universal proxy platform
https://sing-box.sagernet.org/
Other
19.58k stars 2.33k forks source link

inbound为tun且outbound为direct时,ipv6访问错误 #2224

Open freakinyy opened 4 hours ago

freakinyy commented 4 hours ago

操作系统

Windows

系统版本

Windows 11 专业版 23H2

安装类型

sing-box 原始命令行程序

如果您使用图形客户端程序,请提供该程序版本。

No response

版本

sing-box version 1.10.1

Environment: go1.23.2 windows/amd64
Tags: with_gvisor,with_quic,with_dhcp,with_wireguard,with_ech,with_utls,with_reality_server,with_acme,with_clash_api
Revision: b80ec55ba0aafc60774e19c409e55ced50ddaab3
CGO: disabled

描述

inbound为tun,且outbound为direct时,客户端执行一定时间后(大约10~15秒),访问ipv6远程网站错误,在sing-box运行前以及运行后的大约10秒内则正常。

访问局域网ipv6 http则正常,本地iperf3测试正常。

socks模式正常,只发现tun模式有问题,故只使用tun模式测试。

除了1.10.1,1.8.0、1.9.0、1.9.7、1.11.0-alpha.1均存在此问题。 安卓多个版本未发现此问题问题。

不知是否与#2116相关。

重现方式

本地配置文件如下,无服务器端配置文件。

{
    "log": {
        "disabled": false,
        "level": "debug",
        "output": "",
        "timestamp": true
    },
    "dns": {
        "servers": [
            {
                "tag": "dns-local",
                "address": "udp://223.5.5.5",
                "detour": "out-direct"
            }
        ],
        "rules": [
            {
                "outbound": "any",
                "server": "dns-local"
            }
        ],
        "final": "dns-local"
    },
    "route": {
        "rules": [
            {
                "protocol": "dns",
                "outbound": "out-dns"
            }
        ],
        "final": "out-direct",
        "auto_detect_interface": true
    },
    "inbounds": [
        {
            "type": "tun",
            "tag": "in-tun",
            "address": [
                "172.19.0.1/30",
                "fdfe:dcba:9876::1/126"
            ],
            "auto_route": true,
            "strict_route": true,
            "stack": "system",
            "sniff": true
        }
    ],
    "outbounds": [
        {
            "type": "dns",
            "tag": "out-dns"
        },
        {
            "type": "direct",
            "tag": "out-direct"
        }
    ]
}

执行: .\sing-box-1.10.1.exe run -c .\test.json 立刻curl百度的ipv6地址,或者任意ipv6 url,例如: curl [240e:ff:e020:9ae:0:ff:b014:8e8b]:80 得到正常回复。等待10~15秒,再执行则出错: curl: (56) Recv failure: Connection was reset

日志

因windows平台tun模式日志太多且涉及隐私,故提供从curl开始到得到错误的日志:
+0800 2024-10-27 22:31:14 INFO [1801058653 0ms] inbound/tun[in-tun]: inbound connection from [fdfe:dcba:9876::1]:11581
+0800 2024-10-27 22:31:14 INFO [1801058653 0ms] inbound/tun[in-tun]: inbound connection to [240e:ff:e020:9ae:0:ff:b014:8e8b]:80
+0800 2024-10-27 22:31:14 DEBUG [1801058653 0ms] router: sniffed protocol: http, domain: 240e:ff:e020:9ae:0:ff:b014:8e8b
+0800 2024-10-27 22:31:14 INFO [1801058653 0ms] outbound/direct[out-direct]: outbound connection to [240e:ff:e020:9ae:0:ff:b014:8e8b]:80
+0800 2024-10-27 22:31:18 DEBUG [2939930479 10.1s] inbound/tun[in-tun]: connection closed: context canceled
+0800 2024-10-27 22:31:18 DEBUG [3696830364 10.1s] inbound/tun[in-tun]: connection closed: context canceled
+0800 2024-10-27 22:31:19 DEBUG [1801058653 5.0s] inbound/tun[in-tun]: connection closed: dial tcp [240e:ff:e020:9ae:0:ff:b014:8e8b]:80: i/o timeout

支持我们

完整性要求

dyhkwong commented 2 hours ago

无法复现。另外我不认为仅由 curl 和本地配置组成的测试环境提供完整 log 会有什么隐私问题。