mirror of
https://github.com/coredns/coredns.git
synced 2025-10-27 08:14:18 -04:00
plugin/etcd: propagate recursion flag properly (#2254)
When fetching records via the etcd plugin, the recursion flag was never set properly according to if the caller requested an exact record match or not. This cause problems especially in CNAME lookups, where recursion took place and a random RR was returned instead of the one that was specifically added for this key. Even when there is no service attached on the given path, it is still wrong to return a random one from the recursion. Fixing by using the `exact` flag to decide if recursion should be done.
This commit is contained in:
committed by
Miek Gieben
parent
1ef0a02b46
commit
cfbfa5c00e
@@ -57,6 +57,7 @@ var servicesCname = []*msg.Service{
|
||||
{Host: "cname5.region2.skydns.test", Key: "cname4.region2.skydns.test."},
|
||||
{Host: "cname6.region2.skydns.test", Key: "cname5.region2.skydns.test."},
|
||||
{Host: "endpoint.region2.skydns.test", Key: "cname6.region2.skydns.test."},
|
||||
{Host: "mainendpoint.region2.skydns.test", Key: "region2.skydns.test."},
|
||||
{Host: "10.240.0.1", Key: "endpoint.region2.skydns.test."},
|
||||
}
|
||||
|
||||
@@ -76,4 +77,10 @@ var dnsTestCasesCname = []test.Case{
|
||||
test.A("endpoint.region2.skydns.test. 300 IN A 10.240.0.1"),
|
||||
},
|
||||
},
|
||||
{
|
||||
Qname: "region2.skydns.test.", Qtype: dns.TypeCNAME,
|
||||
Answer: []dns.RR{
|
||||
test.CNAME("region2.skydns.test. 300 IN CNAME mainendpoint.region2.skydns.test."),
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
@@ -75,7 +75,7 @@ func (e *Etcd) Records(state request.Request, exact bool) ([]msg.Service, error)
|
||||
name := state.Name()
|
||||
|
||||
path, star := msg.PathWithWildcard(name, e.PathPrefix)
|
||||
r, err := e.get(path, true)
|
||||
r, err := e.get(path, !exact)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user