aboutsummaryrefslogtreecommitdiff
path: root/plugin/file/lookup.go
diff options
context:
space:
mode:
authorGravatar Chris O'Haver <cohaver@infoblox.com> 2022-07-07 17:07:04 -0400
committerGravatar GitHub <noreply@github.com> 2022-07-07 17:07:04 -0400
commit83adb8fa229f88cfccd56dc89faee55ee4dcd500 (patch)
tree87ae288a1eb04968827339aeb8af8fd08567ae88 /plugin/file/lookup.go
parente80d696502863f2e35099e6e366bb00418c28d80 (diff)
downloadcoredns-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.go7
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 {