Fix: the priority of fake-ip-filter

This commit is contained in:
gVisor bot 2020-10-09 00:04:24 +08:00
parent d5ac0df372
commit 0da177c3af

View file

@ -102,6 +102,11 @@ func withFakeIP(fakePool *fakeip.Pool) middleware {
return func(r *D.Msg) (*D.Msg, error) {
q := r.Question[0]
host := strings.TrimRight(q.Name, ".")
if fakePool.LookupHost(host) {
return next(r)
}
if q.Qtype == D.TypeAAAA {
msg := &D.Msg{}
msg.Answer = []D.RR{}
@ -115,11 +120,6 @@ func withFakeIP(fakePool *fakeip.Pool) middleware {
return next(r)
}
host := strings.TrimRight(q.Name, ".")
if fakePool.LookupHost(host) {
return next(r)
}
rr := &D.A{}
rr.Hdr = D.RR_Header{Name: q.Name, Rrtype: D.TypeA, Class: D.ClassINET, Ttl: dnsDefaultTTL}
ip := fakePool.Lookup(host)