Closed nunu6689 closed 8 months ago
It seems to be the same as #1508 I tried with tproxy as dns-in it gave the same malformed error. Previously tproxy acted similar with direct as dns-in.
It seems due to the wrong buffer size for compression in sing-dns? And consider enable compression by default. https://github.com/AdguardTeam/dnsproxy/blob/68d417bfdc10e87e5d268aca3bd055e9fd88d206/proxy/dnscontext.go#L127
I don't know if it's even correct, but it works:
diff --git a/client_truncate.go b/client_truncate.go
index a0b4afd..5b8e80a 100644
--- a/client_truncate.go
+++ b/client_truncate.go
@@ -14,7 +14,8 @@ func TruncateDNSMessage(request *dns.Msg, response *dns.Msg, frontHeadroom int)
}
}
response.Truncate(maxLen)
- buffer := buf.NewSize(frontHeadroom + 1 + maxLen)
+ response.Compress = true
+ buffer := buf.NewSize(frontHeadroom + response.Len() + maxLen)
buffer.Resize(frontHeadroom, 0)
rawMessage, err := response.PackBuffer(buffer.FreeBytes())
if err != nil {
Aight I tested v1.9.0-beta.16 it seems to be fixed. Thanks.
Operating system
Linux
System version
openwrt 23.05.2
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
Direct inbound as dns-in unable to respond DNS properly over UDP when the respond is long. 512?
It gave malformed reply packet. dnsmasq also unable to parse it.
Using TCP is fine. Version 1.8.7 also working fine though it gave truncated message and fallback to TCP. Tun also seems working fine with v1.9.0-beta.5
On router tun is too resource hungry. It choke the traffic when there's many connections. So I'd like to reduce the use of tun. Currently I use redir, tun for UDP only and direct for DNS in.
Reproduction
config.json :
Logs
Integrity requirements