Filter names on SVCB and HTTPS records in addition to CNAME

This commit is contained in:
Frank Denis 2020-12-01 16:00:18 +01:00
parent 5c1e3f0b15
commit 24a9539d08
1 changed files with 12 additions and 2 deletions

View File

@ -181,10 +181,20 @@ func (plugin *PluginBlockNameResponse) Eval(pluginsState *PluginsState, msg *dns
answers := msg.Answer
for _, answer := range answers {
header := answer.Header()
if header.Class != dns.ClassINET || header.Rrtype != dns.TypeCNAME {
var target string
var err error
if header.Class != dns.ClassINET {
continue
}
if header.Rrtype == dns.TypeCNAME {
target, err = NormalizeQName(answer.(*dns.CNAME).Target)
} else if header.Rrtype == dns.TypeSVCB && answer.(*dns.SVCB).Priority == 0 {
target, err = NormalizeQName(answer.(*dns.SVCB).Target)
} else if header.Rrtype == dns.TypeSVCB && answer.(*dns.HTTPS).Priority == 0 {
target, err = NormalizeQName(answer.(*dns.HTTPS).Target)
} else {
continue
}
target, err := NormalizeQName(answer.(*dns.CNAME).Target)
if err != nil {
return err
}