diff options
author | 2022-07-07 17:07:04 -0400 | |
---|---|---|
committer | 2022-07-07 17:07:04 -0400 | |
commit | 83adb8fa229f88cfccd56dc89faee55ee4dcd500 (patch) | |
tree | 87ae288a1eb04968827339aeb8af8fd08567ae88 /plugin/file/lookup.go | |
parent | e80d696502863f2e35099e6e366bb00418c28d80 (diff) | |
download | coredns-83adb8fa229f88cfccd56dc89faee55ee4dcd500.tar.gz coredns-83adb8fa229f88cfccd56dc89faee55ee4dcd500.tar.zst coredns-83adb8fa229f88cfccd56dc89faee55ee4dcd500.zip |
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>
Diffstat (limited to 'plugin/file/lookup.go')
-rw-r--r-- | plugin/file/lookup.go | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/plugin/file/lookup.go b/plugin/file/lookup.go index 08eed7d61..a999a2a79 100644 --- a/plugin/file/lookup.go +++ b/plugin/file/lookup.go @@ -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 { |