-
-
Notifications
You must be signed in to change notification settings - Fork 2.5k
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
由于UDP DNS响应长度超过512B进行截取导致某些域名无法获取IP信息 #1448
Comments
最近遇到了一点问题 xiaorouji/openwrt-passwall#2960 Sing-Box DNS
dns2tcp
Xray DNS
|
引用隔壁 ChinaDNS-NG 作者的回复 zfl9/chinadns-ng#144 (comment) 拒绝连接是因为 chinadns-ng 目前还没实施 tcp 监听。用 zig 重写的 1.0/2.0 版本已经加入 tcp 支持了。 结合你引用的几个 issue 推测,有这几方面的原因:
|
所以压缩还是有必要的吧 |
I gotcha, but I reckon compressing the response takes precedence over customizing the UDP buffer size. |
应已在最新版本修复。 |
Most DNS related issues had been fixed. but DNS response still not compressed by default? The first one from dnsmasq which is also hijacked by singbox. root@sam46:~# kdig www.youtube.com
;; ->>HEADER<<- opcode: QUERY; status: NOERROR; id: 43430
;; Flags: qr rd ra; QUERY: 1; ANSWER: 17; AUTHORITY: 0; ADDITIONAL: 0
;; QUESTION SECTION:
;; www.youtube.com. IN A
;; ANSWER SECTION:
www.youtube.com. 1794 IN CNAME youtube-ui.l.google.com.
youtube-ui.l.google.com. 1794 IN A 64.233.170.93
youtube-ui.l.google.com. 1794 IN A 64.233.170.190
youtube-ui.l.google.com. 1794 IN A 142.251.175.190
youtube-ui.l.google.com. 1794 IN A 142.251.175.91
youtube-ui.l.google.com. 1794 IN A 142.251.175.136
youtube-ui.l.google.com. 1794 IN A 142.251.175.93
youtube-ui.l.google.com. 1794 IN A 74.125.24.190
youtube-ui.l.google.com. 1794 IN A 74.125.24.93
youtube-ui.l.google.com. 1794 IN A 74.125.24.136
youtube-ui.l.google.com. 1794 IN A 74.125.130.136
youtube-ui.l.google.com. 1794 IN A 74.125.68.136
youtube-ui.l.google.com. 1794 IN A 74.125.68.190
youtube-ui.l.google.com. 1794 IN A 74.125.68.93
youtube-ui.l.google.com. 1794 IN A 74.125.68.91
youtube-ui.l.google.com. 1794 IN A 64.233.170.91
youtube-ui.l.google.com. 1794 IN A 64.233.170.136
;; Received 326 B
;; Time 2024-02-29 17:41:50 WITA
;; From 127.0.0.1@53(UDP) in 0.6 ms
root@sam46:~# kdig www.youtube.com @1.1.1.1
;; ->>HEADER<<- opcode: QUERY; status: NOERROR; id: 23934
;; Flags: qr rd ra; QUERY: 1; ANSWER: 17; AUTHORITY: 0; ADDITIONAL: 0
;; QUESTION SECTION:
;; www.youtube.com. IN A
;; ANSWER SECTION:
www.youtube.com. 300 IN CNAME youtube-ui.l.google.com.
youtube-ui.l.google.com. 300 IN A 64.233.170.91
youtube-ui.l.google.com. 300 IN A 64.233.170.136
youtube-ui.l.google.com. 300 IN A 64.233.170.93
youtube-ui.l.google.com. 300 IN A 64.233.170.190
youtube-ui.l.google.com. 300 IN A 142.251.175.190
youtube-ui.l.google.com. 300 IN A 142.251.175.91
youtube-ui.l.google.com. 300 IN A 142.251.175.136
youtube-ui.l.google.com. 300 IN A 142.251.175.93
youtube-ui.l.google.com. 300 IN A 74.125.24.190
youtube-ui.l.google.com. 300 IN A 74.125.24.93
youtube-ui.l.google.com. 300 IN A 74.125.24.136
youtube-ui.l.google.com. 300 IN A 74.125.130.136
youtube-ui.l.google.com. 300 IN A 74.125.68.136
youtube-ui.l.google.com. 300 IN A 74.125.68.190
youtube-ui.l.google.com. 300 IN A 74.125.68.93
youtube-ui.l.google.com. 300 IN A 74.125.68.91
;; Received 709 B
;; Time 2024-02-29 17:41:57 WITA
;; From 1.1.1.1@53(UDP) in 150.9 ms |
Looking at popular DNS solution like blocky and adguardhome it force enable compression. diff --git a/client_truncate.go b/client_truncate.go
index a0b4afd..90cf3dd 100644
--- a/client_truncate.go
+++ b/client_truncate.go
@@ -14,6 +14,7 @@ func TruncateDNSMessage(request *dns.Msg, response *dns.Msg, frontHeadroom int)
}
}
response.Truncate(maxLen)
+ response.Compress = true
buffer := buf.NewSize(frontHeadroom + 1 + maxLen)
buffer.Resize(frontHeadroom, 0)
rawMessage, err := response.PackBuffer(buffer.FreeBytes()) https://github.com/0xERR0R/blocky/blob/efc14d25ca57dbc0652d4e9784ba2e61646caeaa/server/server.go#L652 https://github.com/AdguardTeam/dnsproxy/blob/68d417bfdc10e87e5d268aca3bd055e9fd88d206/proxy/dnscontext.go#L128 |
这种情况不是应该用TCP重传吗?为啥要改UDP响应? |
This issue is stale because it has been open 60 days with no activity. Remove stale label or comment or this will be closed in 5 days |
Operating system
Linux
System version
openwrt 23.05
Installation type
Original sing-box Command Line
If you are using a graphical client, please provide the version of the client.
No response
Version
Description
在 17aebc5 对 cn-beijing-data.aliyundrive.net 这类响应超出 512B 的域名进行修复后,又出现 api.aliyundrive.com 连续AAAA记录,最后一个A类记录IP信息,由于sing-box DNS响应没有进行压缩,导致这类地址被截断后拿不到ip信息。我猜测压缩会影响处理性能,但又觉得能正确处理更重要些,是否可以在超出限制的情况下尝试压缩再去截取那。
Reproduction
如上
Logs
No response
Integrity requirements
The text was updated successfully, but these errors were encountered: