mirror of
https://github.com/AdguardTeam/AdGuardHome.git
synced 2024-12-15 11:22:49 +03:00
Pull request: dnsforward: fix nxdomain for internal aaaa reqs
Updates #2393. Squashed commit of the following: commit 5ea4d3c2f217ed800da79c3d87184d8e0956e56c Author: Ainar Garipov <A.Garipov@AdGuard.COM> Date: Thu Mar 25 17:01:08 2021 +0300 dnsforward: fix nxdomain for internal aaaa reqs
This commit is contained in:
parent
88d924658e
commit
3764c1dfe4
@ -192,7 +192,11 @@ func (s *Server) onDHCPLeaseChanged(flags int) {
|
|||||||
func (s *Server) processInternalHosts(dctx *dnsContext) (rc resultCode) {
|
func (s *Server) processInternalHosts(dctx *dnsContext) (rc resultCode) {
|
||||||
req := dctx.proxyCtx.Req
|
req := dctx.proxyCtx.Req
|
||||||
q := req.Question[0]
|
q := req.Question[0]
|
||||||
if q.Qtype != dns.TypeA {
|
|
||||||
|
// Go on processing the AAAA request despite the fact that we don't
|
||||||
|
// support it yet. The expected behavior here is to respond with an
|
||||||
|
// empty asnwer and not NXDOMAIN.
|
||||||
|
if q.Qtype != dns.TypeA && q.Qtype != dns.TypeAAAA {
|
||||||
return resultCodeSuccess
|
return resultCodeSuccess
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -52,6 +52,14 @@ func TestServer_ProcessInternalHosts(t *testing.T) {
|
|||||||
wantIP: nil,
|
wantIP: nil,
|
||||||
qtyp: dns.TypeA,
|
qtyp: dns.TypeA,
|
||||||
wantRes: resultCodeSuccess,
|
wantRes: resultCodeSuccess,
|
||||||
|
}, {
|
||||||
|
name: "success_internal_aaaa",
|
||||||
|
host: "example.lan",
|
||||||
|
suffix: defaultAutohostSuffix,
|
||||||
|
wantErrMsg: "",
|
||||||
|
wantIP: nil,
|
||||||
|
qtyp: dns.TypeAAAA,
|
||||||
|
wantRes: resultCodeSuccess,
|
||||||
}}
|
}}
|
||||||
|
|
||||||
for _, tc := range testCases {
|
for _, tc := range testCases {
|
||||||
@ -92,7 +100,14 @@ func TestServer_ProcessInternalHosts(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
pctx := dctx.proxyCtx
|
pctx := dctx.proxyCtx
|
||||||
if tc.wantIP == nil {
|
if tc.qtyp == dns.TypeAAAA {
|
||||||
|
// TODO(a.garipov): Remove this special handling
|
||||||
|
// when we fully support AAAA.
|
||||||
|
require.NotNil(t, pctx.Res)
|
||||||
|
|
||||||
|
ans := pctx.Res.Answer
|
||||||
|
require.Len(t, ans, 0)
|
||||||
|
} else if tc.wantIP == nil {
|
||||||
assert.Nil(t, pctx.Res)
|
assert.Nil(t, pctx.Res)
|
||||||
} else {
|
} else {
|
||||||
require.NotNil(t, pctx.Res)
|
require.NotNil(t, pctx.Res)
|
||||||
|
Loading…
Reference in New Issue
Block a user