Skip to content

Commit

Permalink
Make sure NXDOMAIN replies have the 'aa' bit set
Browse files Browse the repository at this point in the history
  • Loading branch information
abh committed Aug 25, 2012
1 parent 2ea40a4 commit 45c00a7
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions serve.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,14 +40,17 @@ func serve(w dns.ResponseWriter, req *dns.Msg, z *Zone) {

m := new(dns.Msg)
m.SetReply(req)
ednsFromRequest(req, m)

m.MsgHdr.Authoritative = true
m.Authoritative = true

// TODO(ask): Function to find appropriate label with records based on the country/continent
labels := z.findLabels(label, *country, qtype)
if labels == nil {
// return NXDOMAIN
m.SetRcode(req, dns.RcodeNameError)
ednsFromRequest(req, m)
m.Authoritative = true

w.Write(m)
return
}
Expand Down Expand Up @@ -75,7 +78,6 @@ func serve(w dns.ResponseWriter, req *dns.Msg, z *Zone) {

fmt.Println("Writing reply")

ednsFromRequest(req, m)
w.Write(m)
return
}
Expand Down

0 comments on commit 45c00a7

Please sign in to comment.