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

DNS规则中若存在多个地址筛选规则,则会出现死循环无法正确解析DNS #2438

Open
4 of 5 tasks
ericsyj opened this issue Jan 5, 2025 · 0 comments
Open
4 of 5 tasks
Labels
bug Something isn't working

Comments

@ericsyj
Copy link

ericsyj commented Jan 5, 2025

操作系统

Android

系统版本

Android 14

安装类型

sing-box for Android 图形客户端程序

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

1.11.0-beta.20

版本

No response

描述

DNS规则中若存在多个地址筛选规则,则会出现死循环产生大量日志,最终可能导致崩溃。

重现方式

使用以下配置可复现:

{
    "log": {
        "disabled": false,
        "level": "trace",
        "timestamp": true
    },
    "dns": {
        "servers": [
            {
                "tag": "localdns",
                "address": "local",
                "detour": "direct"
            },
            {
                "tag": "fakedns",
                "address": "fakeip"
            }
        ],
        "rules": [
            {
                "ip_cidr": "3.3.3.3/32",
                "rule_set_ip_cidr_accept_empty": true,
                "server": "localdns"
            },
            {
                "ip_cidr": "3.3.3.3/32",
                "rule_set_ip_cidr_accept_empty": true,
                "server": "localdns"
            },
            {
                "inbound": null,
                "invert": true,
                "server": "fakedns"
            }
        ],
        "fakeip": {
            "enabled": true,
            "inet4_range": "198.18.0.0/16",
            "inet6_range": "fc00::/18"
        }
    },
    "inbounds": [
        {
            "type": "tun",
            "tag": "tun-in",
            "address": [
                "172.19.0.1/30",
                "fdfe:dcba:9876::1/126"
            ],
            "route_exclude_address": [
                "10.0.0.0/8",
                "192.168.0.0/16",
                "fe80::/10"
            ],
            "auto_route": true,
            "strict_route": true
        }
    ],
    "outbounds": [
        {
            "type": "direct",
            "tag": "direct"
        }
    ],
    "route": {
        "auto_detect_interface": true,
        "rules": [
            {
                "port": 53,
                "action": "hijack-dns"
            }
        ]
    },
    "experimental": {
        "cache_file": {
            "enabled": true,
            "store_rdrc": true,
            "rdrc_timeout": "1h"
        }
    }
}

使用Termux通过命令dig +noedns a www.baidu.com查询dns,预期结果应该是返回fakeip,但实际进入死循环,无法返回结果。在1.11.0-beta.19也可复现,但1.10.6稳定版无法复现,暂不知道问题引入版本,经测试在windows平台命令行工具和安卓图形客户端均有此问题。

日志

52	[debug]	[2193605407 6ms] dns: response rejected for www.baidu.com. IN A: response rejected: cached (cached)
51	[debug]	[2193605407 6ms] router: match[1] => route(localdns)
50	[debug]	[2193605407 6ms] router: match[1] ip_cidr=3.3.3.3/32 => route(localdns)
49	[debug]	[2193605407 6ms] dns: response rejected for www.baidu.com. IN A: response rejected: cached (cached)
48	[debug]	[2193605407 6ms] router: match[1] => route(localdns)
47	[debug]	[2193605407 5ms] router: match[1] ip_cidr=3.3.3.3/32 => route(localdns)
46	[debug]	[2193605407 5ms] dns: response rejected for www.baidu.com. IN A: response rejected: cached (cached)
45	[debug]	[2193605407 5ms] router: match[1] => route(localdns)
44	[debug]	[2193605407 5ms] router: match[1] ip_cidr=3.3.3.3/32 => route(localdns)
43	[debug]	[2193605407 5ms] dns: response rejected for www.baidu.com. IN A: response rejected: cached (cached)
42	[debug]	[2193605407 5ms] router: match[1] => route(localdns)
41	[debug]	[2193605407 5ms] router: match[1] ip_cidr=3.3.3.3/32 => route(localdns)
40	[debug]	[2193605407 5ms] dns: response rejected for www.baidu.com. IN A: response rejected: cached (cached)
39	[debug]	[2193605407 5ms] router: match[1] => route(localdns)
38	[debug]	[2193605407 5ms] router: match[1] ip_cidr=3.3.3.3/32 => route(localdns)
37	[debug]	[2193605407 4ms] dns: response rejected for www.baidu.com. IN A: response rejected: cached (cached)
36	[debug]	[2193605407 4ms] router: match[1] => route(localdns)
35	[debug]	[2193605407 4ms] router: match[1] ip_cidr=3.3.3.3/32 => route(localdns)
34	[debug]	[2193605407 4ms] dns: response rejected for www.baidu.com. IN A: response rejected: cached (cached)
33	[debug]	[2193605407 4ms] router: match[1] => route(localdns)
32	[debug]	[2193605407 4ms] router: match[1] ip_cidr=3.3.3.3/32 => route(localdns)
31	[debug]	[2193605407 4ms] dns: response rejected for www.baidu.com. IN A: response rejected: cached (cached)
30	[debug]	[2193605407 4ms] router: match[1] => route(localdns)
29	[debug]	[2193605407 4ms] router: match[1] ip_cidr=3.3.3.3/32 => route(localdns)
28	[debug]	[2193605407 4ms] dns: response rejected for www.baidu.com. IN A: response rejected: cached (cached)
27	[debug]	[2193605407 3ms] router: match[1] => route(localdns)
26	[debug]	[2193605407 3ms] router: match[1] ip_cidr=3.3.3.3/32 => route(localdns)
25	[debug]	[2193605407 3ms] dns: response rejected for www.baidu.com. IN A: response rejected: cached (cached)
24	[debug]	[2193605407 3ms] router: match[1] => route(localdns)
23	[debug]	[2193605407 3ms] router: match[1] ip_cidr=3.3.3.3/32 => route(localdns)
22	[debug]	[2193605407 3ms] dns: response rejected for www.baidu.com. IN A: response rejected: cached (cached)
21	[debug]	[2193605407 3ms] router: match[1] => route(localdns)
20	[debug]	[2193605407 3ms] router: match[1] ip_cidr=3.3.3.3/32 => route(localdns)
19	[debug]	[2193605407 3ms] dns: response rejected for www.baidu.com. IN A: response rejected: cached (cached)
18	[debug]	[2193605407 3ms] router: match[1] => route(localdns)
17	[debug]	[2193605407 3ms] router: match[1] ip_cidr=3.3.3.3/32 => route(localdns)
16	[debug]	[2193605407 3ms] dns: response rejected for www.baidu.com. IN A: response rejected: cached (cached)
15	[debug]	[2193605407 2ms] router: match[1] => route(localdns)
14	[debug]	[2193605407 2ms] router: match[1] ip_cidr=3.3.3.3/32 => route(localdns)
13	[debug]	[2193605407 2ms] dns: response rejected for www.baidu.com. IN A: response rejected: cached (cached)
12	[debug]	[2193605407 2ms] router: match[1] => route(localdns)
11	[debug]	[2193605407 2ms] router: match[1] ip_cidr=3.3.3.3/32 => route(localdns)
10	[debug]	[2193605407 2ms] dns: response rejected for www.baidu.com. IN A: response rejected: cached (cached)
9	[debug]	[2193605407 2ms] router: match[1] => route(localdns)
8	[debug]	[2193605407 2ms] router: match[1] ip_cidr=3.3.3.3/32 => route(localdns)
7	[debug]	[2193605407 2ms] dns: response rejected for www.baidu.com. IN A: response rejected: cached (cached)
6	[debug]	[2193605407 1ms] router: match[0] => route(localdns)
5	[debug]	[2193605407 1ms] router: match[0] ip_cidr=3.3.3.3/32 => route(localdns)
4	[debug]	[2193605407 1ms] dns: exchange www.baidu.com. IN A
3	[debug]	[2193605407 1ms] router: match[0] port=53 => hijack-dns
2	[info]	[2193605407 1ms] inbound/tun[tun-in]: inbound packet connection to 8.8.8.8:53
1	[info]	[2193605407 0ms] inbound/tun[tun-in]: inbound packet connection from 172.19.0.1:41853

支持我们

完整性要求

  • 我保证阅读了文档,了解所有我编写的配置文件项的含义,而不是大量堆砌看似有用的选项或默认值。
  • 我保证提供了可以在本地重现该问题的服务器、客户端配置文件与流程,而不是一个脱敏的复杂客户端配置文件。
  • 我保证提供了可用于重现我报告的错误的最简配置,而不是依赖远程服务器、TUN、图形界面客户端或者其他闭源软件。
  • 我保证提供了完整的配置文件与日志,而不是出于对自身智力的自信而仅提供了部分认为有用的部分。
@nekohasekai nekohasekai added the bug Something isn't working label Jan 7, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants