From d3fbef02bb3fcf5a64965364c2166dee78f0e638 Mon Sep 17 00:00:00 2001 From: nadoo <287492+nadoo@users.noreply.github.com> Date: Sun, 23 Jan 2022 11:09:35 +0800 Subject: [PATCH] dns: just return the request packet back when `dnsnoaaaa` enabled --- dns/client.go | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/dns/client.go b/dns/client.go index cca2239..2ded865 100644 --- a/dns/client.go +++ b/dns/client.go @@ -67,8 +67,9 @@ func (c *Client) Exchange(reqBytes []byte, clientAddr string, preferTCP bool) ([ } if c.config.NoAAAA && req.Question.QTYPE == QTypeAAAA { - req.SetMsgType(ResponseMsg) - return req.Marshal() + respBytes := valCopy(reqBytes) + respBytes[2] |= uint8(ResponseMsg) << 7 + return respBytes, nil } if req.Question.QTYPE == QTypeA || req.Question.QTYPE == QTypeAAAA {