mirror of
https://github.com/coredns/coredns.git
synced 2025-10-27 16:24:19 -04:00
plugin/file/cache: Add metadata for wildcard record responses (#5308)
For responses synthesized by known wildcard records, publish metadata containing the wildcard record name Signed-off-by: Chris O'Haver <cohaver@infoblox.com>
This commit is contained in:
@@ -6,6 +6,7 @@ import (
|
||||
"github.com/coredns/coredns/core/dnsserver"
|
||||
"github.com/coredns/coredns/plugin/file/rrutil"
|
||||
"github.com/coredns/coredns/plugin/file/tree"
|
||||
"github.com/coredns/coredns/plugin/metadata"
|
||||
"github.com/coredns/coredns/request"
|
||||
|
||||
"github.com/miekg/dns"
|
||||
@@ -214,7 +215,10 @@ func (z *Zone) Lookup(ctx context.Context, state request.Request, qname string)
|
||||
|
||||
// Found wildcard.
|
||||
if wildElem != nil {
|
||||
auth := ap.ns(do)
|
||||
// set metadata value for the wildcard record that synthesized the result
|
||||
metadata.SetValueFunc(ctx, "zone/wildcard", func() string {
|
||||
return wildElem.Name()
|
||||
})
|
||||
|
||||
if rrs := wildElem.TypeForWildcard(dns.TypeCNAME, qname); len(rrs) > 0 && qtype != dns.TypeCNAME {
|
||||
ctx = context.WithValue(ctx, dnsserver.LoopKey{}, loop+1)
|
||||
@@ -233,6 +237,7 @@ func (z *Zone) Lookup(ctx context.Context, state request.Request, qname string)
|
||||
return nil, ret, nil, NoData
|
||||
}
|
||||
|
||||
auth := ap.ns(do)
|
||||
if do {
|
||||
// An NSEC is needed to say no longer name exists under this wildcard.
|
||||
if deny, found := tr.Prev(qname); found {
|
||||
|
||||
Reference in New Issue
Block a user