mirror of
https://github.com/coredns/coredns.git
synced 2026-08-20 23:08:28 -04:00
plugin/file: run additional processing for CNAME/DNAME answers (#8337)
externalLookup, which resolves the chase for ordinary CNAME, wildcard CNAME, and DNAME answers, returned a nil additional section. So a chased SRV/MX/SVCB/HTTPS answer with an in-bailiwick target was missing the target's A/AAAA glue, unlike the direct path. Run additionalProcessing at externalLookup's return points so all three callers add the glue, and add ordinary-CNAME, wildcard-CNAME, and DNAME regression cases. Fixes #6628 Signed-off-by: Saleh <root@lr0.org>
This commit is contained in:
@@ -350,7 +350,10 @@ func (z *Zone) authority(do bool, result Result) []dns.RR {
|
||||
return z.ns(do)
|
||||
}
|
||||
|
||||
// externalLookup adds signatures and tries to resolve CNAMEs that point to external names.
|
||||
// externalLookup adds signatures and tries to resolve CNAMEs that point to
|
||||
// external names. It also runs additional-section processing on the resolved
|
||||
// answer so in-bailiwick SRV/MX/SVCB/HTTPS targets get their A/AAAA glue, like
|
||||
// the direct path.
|
||||
func (z *Zone) externalLookup(ctx context.Context, state request.Request, tr *tree.Tree, elem *tree.Elem, rrs []dns.RR) ([]dns.RR, []dns.RR, []dns.RR, Result) {
|
||||
qtype := state.QType()
|
||||
do := state.Do()
|
||||
@@ -369,7 +372,7 @@ func (z *Zone) externalLookup(ctx context.Context, state request.Request, tr *tr
|
||||
if elem == nil || (qtype == dns.TypeNS || qtype == dns.TypeSOA && targetName == z.origin) {
|
||||
lookupRRs, result := z.doLookup(ctx, state, targetName, qtype)
|
||||
rrs = append(rrs, lookupRRs...)
|
||||
return rrs, z.authority(do, result), nil, result
|
||||
return rrs, z.authority(do, result), z.additionalProcessing(rrs, do), result
|
||||
}
|
||||
|
||||
i := 0
|
||||
@@ -392,12 +395,12 @@ Redo:
|
||||
if elem == nil || (qtype == dns.TypeNS || qtype == dns.TypeSOA && targetName == z.origin) {
|
||||
lookupRRs, result := z.doLookup(ctx, state, targetName, qtype)
|
||||
rrs = append(rrs, lookupRRs...)
|
||||
return rrs, z.authority(do, result), nil, result
|
||||
return rrs, z.authority(do, result), z.additionalProcessing(rrs, do), result
|
||||
}
|
||||
|
||||
i++
|
||||
if i > 8 {
|
||||
return rrs, z.ns(do), nil, Success
|
||||
return rrs, z.ns(do), z.additionalProcessing(rrs, do), Success
|
||||
}
|
||||
|
||||
goto Redo
|
||||
@@ -414,7 +417,7 @@ Redo:
|
||||
}
|
||||
}
|
||||
|
||||
return rrs, z.ns(do), nil, Success
|
||||
return rrs, z.ns(do), z.additionalProcessing(rrs, do), Success
|
||||
}
|
||||
|
||||
// findDelegation returns the first zone cut between the zone apex and qname.
|
||||
|
||||
Reference in New Issue
Block a user