Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fakeip 导致 udp 收不到回包 #2619

Open
4 of 5 tasks
plusls opened this issue Feb 21, 2025 · 1 comment
Open
4 of 5 tasks

fakeip 导致 udp 收不到回包 #2619

plusls opened this issue Feb 21, 2025 · 1 comment

Comments

@plusls
Copy link

plusls commented Feb 21, 2025

操作系统

Windows

系统版本

windows 11

安装类型

sing-box 原始命令行程序

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

No response

版本

注: 不确定这个 bug 是从哪个版本开始引入的

sing-box version 1.12.0-alpha.9

Environment: go1.24.0 windows/amd64
Tags: with_gvisor,with_quic,with_dhcp,with_wireguard,with_ech,with_utls,with_reality_server,with_acme,with_clash_api,with_tailscale
Revision: 63a0b5e2ced03a8b5e98b939c8b97fdc63dcd14f
CGO: disabled

描述

在使用 tun 时若是开启 fakeip, 会导致 udp 收不到回包

具体现象:

  1. 本机给服务器 A 发送 "aaaa", 服务器可以正常接受
  2. 本机给服务器 A 发送 "bbbb", 服务器可以正常接受
  3. 服务器A 给本机发送 "cccc", 本机无法接收到
  4. 本机给服务器 A 发送 "dddd", 服务器无法接收到

对于 mixed stack 还有如下额外现象:
在上述的第3步后,本机给服务器发送数据包的端口发生了改变

如图所示:发送端口从 50294 变成了 50295

Image

对于下面的配置文件,若是将 fakeip 的 rule 去掉, 则能正常工作

重现方式

udp 无法收到回包的配置:

{
    "dns": {
        "servers": [
            {
                "type": "tls",
                "server": "223.5.5.5",
                "tag": "dns-direct",
                "detour": "direct-out"
            },
            {
                "type": "fakeip",
                "tag": "dns-fake",
                "inet4_range": "198.18.0.0/15",
                "inet6_range": "fc00::/18"
            }
        ],
        "rules": [
            {
                "query_type": [
                    "A",
                    "AAAA"
                ],
                "server": "dns-fake"
            }
        ],
        "final": "dns-direct"
    },
    "inbounds": [
        {
            "type": "tun",
            "tag": "tun-in",
            "endpoint_independent_nat": true,
            "mtu": 9000,
            "address": "172.20.0.1/30",
            "auto_route": true,
            "stack": "mixed"
        }
    ],
    "outbounds": [
        {
            "tag": "direct-out",
            "type": "direct"
        }
    ],
    "route": {
        "auto_detect_interface": true,
        "rules": [
            {
                "action": "sniff"
            },
            {
                "protocol": "dns",
                "action": "hijack-dns"
            },
            {
                "action": "resolve"
            }
        ]
    }
}

日志

支持我们

完整性要求

  • 我保证阅读了文档,了解所有我编写的配置文件项的含义,而不是大量堆砌看似有用的选项或默认值。
  • 我保证提供了可以在本地重现该问题的服务器、客户端配置文件与流程,而不是一个脱敏的复杂客户端配置文件。
  • 我保证提供了可用于重现我报告的错误的最简配置,而不是依赖远程服务器、TUN、图形界面客户端或者其他闭源软件。
  • 我保证提供了完整的配置文件与日志,而不是出于对自身智力的自信而仅提供了部分认为有用的部分。
@plusls
Copy link
Author

plusls commented Feb 21, 2025

整理了一下测试结果:

sing-box version 1.12.0-alpha.3
mixed: 不能收也不能发
system: work

sing-box version 1.12.0-alpha.4
mixed: 能发不能收
system: work

sing-box version 1.12.0-alpha.5
mixed: 能发不能收
system: 能发不能收

更高版本的就没测了

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant