fix: truncated UDP response in system dns

https://github.com/MetaCubeX/mihomo/issues/2031
This commit is contained in:
wwqgtxx 2025-05-12 12:34:22 +08:00
parent 2116640886
commit 6e35cf9399

View File

@ -77,7 +77,7 @@ func (c *client) ExchangeContext(ctx context.Context, m *D.Msg) (*D.Msg, error)
msg, _, err := c.Client.ExchangeWithConn(m, dConn)
// Resolvers MUST resend queries over TCP if they receive a truncated UDP response (with TC=1 set)!
if msg != nil && msg.Truncated && c.Client.Net == "" {
if msg != nil && msg.Truncated && network == "udp" {
tcpClient := *c.Client // copy a client
tcpClient.Net = "tcp"
network = "tcp"