From 3a7ad5d47d5f3bb32800d956c098c3d49c343453 Mon Sep 17 00:00:00 2001 From: gVisor bot Date: Wed, 29 Apr 2020 11:21:37 +0800 Subject: [PATCH] Fix: dns return empty success for AAAA & recursion in fake ip mode (#663) --- dns/middleware.go | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/dns/middleware.go b/dns/middleware.go index 90d5a7fe..4d97e65d 100644 --- a/dns/middleware.go +++ b/dns/middleware.go @@ -18,7 +18,14 @@ func withFakeIP(fakePool *fakeip.Pool) middleware { q := r.Question[0] if q.Qtype == D.TypeAAAA { - D.HandleFailed(w, r) + msg := &D.Msg{} + msg.Answer = []D.RR{} + + msg.SetRcode(r, D.RcodeSuccess) + msg.Authoritative = true + msg.RecursionAvailable = true + + w.WriteMsg(msg) return } else if q.Qtype != D.TypeA { next(w, r) @@ -39,8 +46,10 @@ func withFakeIP(fakePool *fakeip.Pool) middleware { msg.Answer = []D.RR{rr} setMsgTTL(msg, 1) - msg.SetRcode(r, msg.Rcode) + msg.SetRcode(r, D.RcodeSuccess) msg.Authoritative = true + msg.RecursionAvailable = true + w.WriteMsg(msg) return }