Skip to content

Commit

Permalink
if Pack'ing fails the Write fails. Return SERVFAIL.
Browse files Browse the repository at this point in the history
  • Loading branch information
abh committed Sep 4, 2012
1 parent 51f859b commit a311f70
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions serve.go
Original file line number Diff line number Diff line change
Expand Up @@ -95,9 +95,12 @@ func serve(w dns.ResponseWriter, req *dns.Msg, z *Zone) {

logPrintln(m)

// Ideally you would check the return code here, and perform SERVFAIL in case of
// an error.
w.Write(m)
err := w.Write(m)
if err != nil {
// if Pack'ing fails the Write fails. Return SERVFAIL.
log.Println("Error writing packet", m)
dns.Failed(w, req)
}
return
}

Expand Down

0 comments on commit a311f70

Please sign in to comment.