Skip to content

Commit

Permalink
Merge branch 'master' into minimal
Browse files Browse the repository at this point in the history
  • Loading branch information
Jan Broer committed Apr 5, 2016
2 parents 9c0cd62 + f28077c commit e105be2
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 12 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ DNS queries are resolved in the style of the GNU libc resolver:
| --rcache, -r | Capacity of the response cache (‘0‘ to disable cache) | 0 | $DNSMASQ_RCACHE |
| --rcache-ttl | TTL for entries in the response cache | 60 | $DNSMASQ_RCACHE_TTL |
| --no-rec | Disable recursion | False | $DNSMASQ_NOREC |
| --fwd-ndots | Minimum number of dots a name must have before the query is allowed to be forwarded to upstream nameservers | 1 | $DNSMASQ_FWD_NDOTS |
| --fwd-ndots | Minimum number of dots a name must have before the query is allowed to be forwarded to upstream nameservers | 0 | $DNSMASQ_FWD_NDOTS |
| --ndots | Number of dots a name must have before an initial absolute query will be made (defaults to /etc/resolv.conf value) | 1 | $DNSMASQ_NDOTS |
| --round-robin | Enable round robin of A/AAAA records | False | $DNSMASQ_RR |
| --systemd | Bind to socket(s) activated by Systemd (ignores --listen) | False | $DNSMASQ_SYSTEMD |
Expand Down
2 changes: 1 addition & 1 deletion main.go
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ func main() {
},
cli.IntFlag{
Name: "fwd-ndots",
Value: 1,
Value: 0,
Usage: "Minimum number of dots a name must have before the query is forwarded",
EnvVar: "DNSMASQ_FWD_NDOTS",
},
Expand Down
13 changes: 3 additions & 10 deletions server/forwarding.go
Original file line number Diff line number Diff line change
Expand Up @@ -126,21 +126,14 @@ func (s *server) ServeDNSForward(w dns.ResponseWriter, req *dns.Msg) *dns.Msg {
}

if didSearch && err2 == nil {
var rcode int
if didAbsolute {
rcode = res2.Rcode
} else {
// Name was too short to forward as-is
rcode = dns.RcodeRefused
}
log.Debugf("Sent reply: qname '%s', rcode %s", name, dns.RcodeToString[rcode])
log.Debugf("Sent reply: qname '%s', rcode %s", name, dns.RcodeToString[res2.Rcode])
m := new(dns.Msg)
m.SetRcode(req, rcode)
m.SetRcode(req, res2.Rcode)
w.WriteMsg(m)
return m
}

// If we got here, we encountered an error while forwarding
// If we got here, we encountered an error while forwarding (which we already logged)
log.Debugf("Sent reply: qname '%s', rcode SRVFAIL", name)
m := new(dns.Msg)
m.SetRcode(req, dns.RcodeServerFailure)
Expand Down

0 comments on commit e105be2

Please sign in to comment.