mirror of
https://github.com/coredns/coredns.git
synced 2026-10-09 03:55:21 -04:00
plugin: use Zones.Contains when any match suffices (#8505)
This commit is contained in:
@@ -35,8 +35,7 @@ func (h Hosts) ServeDNS(ctx context.Context, w dns.ResponseWriter, r *dns.Msg) (
|
||||
if zones == nil {
|
||||
zones = plugin.Zones(h.Origins)
|
||||
}
|
||||
zone := zones.Matches(qname)
|
||||
if zone == "" {
|
||||
if !zones.Contains(qname) {
|
||||
// PTR zones don't need to be specified in Origins.
|
||||
if state.QType() != dns.TypePTR {
|
||||
// if this doesn't match we need to fall through regardless of h.Fallthrough
|
||||
|
||||
@@ -202,7 +202,7 @@ func (h *Hostsfile) parse(r io.Reader) *Map {
|
||||
|
||||
for i := 1; i < len(f); i++ {
|
||||
name := plugin.Name(string(f[i])).Normalize()
|
||||
if plugin.Zones(h.Origins).Matches(name) == "" {
|
||||
if !plugin.Zones(h.Origins).Contains(name) {
|
||||
// name is not in Origins
|
||||
continue
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user