Merge branch '1.5'
This commit is contained in:
commit
6022ad467a
2 files changed
+10
-5
No files matched your search
+8
-2
@@ -134,7 +134,7 @@ func (d *DNSServer) createMux(client *dns.Client, defaultMaxResponseSize int) *d
|
|||||||
|
|
||||||
func (h *handler) handleLocal(w dns.ResponseWriter, req *dns.Msg) {
|
func (h *handler) handleLocal(w dns.ResponseWriter, req *dns.Msg) {
|
||||||
h.ns.debugf("local request: %+v", *req)
|
h.ns.debugf("local request: %+v", *req)
|
||||||
if len(req.Question) != 1 || req.Question[0].Qtype != dns.TypeA {
|
if len(req.Question) != 1 {
|
||||||
h.nameError(w, req)
|
h.nameError(w, req)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
@@ -149,6 +149,12 @@ func (h *handler) handleLocal(w dns.ResponseWriter, req *dns.Msg) {
|
|||||||
h.nameError(w, req)
|
h.nameError(w, req)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
// Per RFC4074, if we have an A but another type was requested,
|
||||||
|
// return 'no error' with empty answer section
|
||||||
|
if req.Question[0].Qtype != dns.TypeA {
|
||||||
|
h.respond(w, h.makeResponse(req, nil))
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
header := dns.RR_Header{
|
header := dns.RR_Header{
|
||||||
Name: req.Question[0].Name,
|
Name: req.Question[0].Name,
|
||||||
@@ -204,7 +210,7 @@ func (h *handler) handleRecursive(w dns.ResponseWriter, req *dns.Msg) {
|
|||||||
h.ns.debugf("recursive request: %+v", *req)
|
h.ns.debugf("recursive request: %+v", *req)
|
||||||
|
|
||||||
// Resolve unqualified names locally
|
// Resolve unqualified names locally
|
||||||
if len(req.Question) == 1 && req.Question[0].Qtype == dns.TypeA {
|
if len(req.Question) == 1 {
|
||||||
hostname := dns.Fqdn(req.Question[0].Name)
|
hostname := dns.Fqdn(req.Question[0].Name)
|
||||||
if strings.Count(hostname, ".") == 1 {
|
if strings.Count(hostname, ".") == 1 {
|
||||||
h.handleLocal(w, req)
|
h.handleLocal(w, req)
|
||||||
|
|||||||
@@ -7,9 +7,8 @@ start_suite "Negative DNS queries"
|
|||||||
weave_on $HOST1 launch
|
weave_on $HOST1 launch
|
||||||
start_container_with_dns $HOST1 --name c1
|
start_container_with_dns $HOST1 --name c1
|
||||||
|
|
||||||
# unsupported query types, unknown names, and unknown domains should
|
# unsupported query types, unknown names, and unknown domains
|
||||||
# all trigger NXDOMAIN
|
assert_raises "exec_on $HOST1 c1 dig MX c1.weave.local | grep -q 'status: NOERROR'"
|
||||||
assert_raises "exec_on $HOST1 c1 dig MX c1.weave.local | grep -q 'status: NXDOMAIN'"
|
|
||||||
assert_raises "exec_on $HOST1 c1 dig A xx.weave.local | grep -q 'status: NXDOMAIN'"
|
assert_raises "exec_on $HOST1 c1 dig A xx.weave.local | grep -q 'status: NXDOMAIN'"
|
||||||
assert_raises "exec_on $HOST1 c1 dig A xx.invalid | grep -q 'status: NXDOMAIN'"
|
assert_raises "exec_on $HOST1 c1 dig A xx.invalid | grep -q 'status: NXDOMAIN'"
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user