Skip to content

Commit

Permalink
Fix handling not found record case
Browse files Browse the repository at this point in the history
  • Loading branch information
wadahiro committed Mar 1, 2018
1 parent 9ee9408 commit d61e2f5
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 17 deletions.
28 changes: 14 additions & 14 deletions amazondns.go
Original file line number Diff line number Diff line change
Expand Up @@ -105,27 +105,27 @@ L:
}

func handleNotFound(zone *Zone, name string, m *dns.Msg) {
// Set authority
m.Ns = []dns.RR{zone.soa}

if name == zone.soa.Header().Name {
m.Rcode = dns.RcodeSuccess
return
}
for _, ns := range zone.ns {
if name == ns.Header().Name {
if m.Rcode == dns.RcodeNameError {
if name == zone.soa.Header().Name {
m.Rcode = dns.RcodeSuccess
return
}
}
for _, nsa := range zone.nsa {
if name == nsa.Header().Name {
m.Rcode = dns.RcodeSuccess
return
for _, ns := range zone.ns {
if name == ns.Header().Name {
m.Rcode = dns.RcodeSuccess
return
}
}
for _, nsa := range zone.nsa {
if name == nsa.Header().Name {
m.Rcode = dns.RcodeSuccess
return
}
}
}

// Error
m.Rcode = dns.RcodeNameError
}

func resolveCNAME(reqName string, res *dns.Msg) {
Expand Down
6 changes: 3 additions & 3 deletions build.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/bin/sh

VERSION=0.2
VERSION=0.2.1
TAG=b1ce9ed6e5b6178fbfa73d3764d25a6e1f20fc82
CADDY_TAG=37b291f82c2083a378b698577640389686b0baf4

Expand Down Expand Up @@ -44,7 +44,7 @@ else
go build

cp coredns /go/src/github.com/wadahiro/coredns-amazondns/
tar cvzf coredns-amazondns-$VERSION.tar.gz coredns
mv coredns-*.tar.gz /go/src/github.com/wadahiro/coredns-amazondns/
tar cvzf coredns-amazondns_${VERSION}_linux-amd64.tgz coredns
mv coredns-*.tgz /go/src/github.com/wadahiro/coredns-amazondns/
fi

0 comments on commit d61e2f5

Please sign in to comment.