Skip to content

Commit

Permalink
More review feedback
Browse files Browse the repository at this point in the history
  • Loading branch information
Tom Wilkie committed Aug 20, 2015
1 parent 1897624 commit 6824487
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 6 deletions.
6 changes: 2 additions & 4 deletions nameserver/dns.go
Expand Up @@ -292,10 +292,8 @@ func (h *handler) truncateResponse(request, response *dns.Msg) {
}

func (h *handler) responseTooBig(request, response *dns.Msg) bool {
if len(response.Answer) <= 1 || h.maxResponseSize <= 0 {
return false
}
return response.Len() > h.getMaxResponseSize(request)
return h.maxResponseSize > 0 && len(response.Answer) > 1 &&
response.Len() > h.getMaxResponseSize(request)
}

func (h *handler) getMaxResponseSize(req *dns.Msg) int {
Expand Down
3 changes: 1 addition & 2 deletions test/295_dns_large_response_test.sh
Expand Up @@ -19,8 +19,7 @@ weave_on $HOST1 dns-add $IPS $CID -h $NAME
assert_raises "exec_on $HOST1 c0 dig MX $NAME | grep -q 'status: NXDOMAIN'"

check() {
M=$(exec_on $HOST1 c0 dig +short $@ $NAME A | grep -v ';;' | wc -l)
assert_raises "test $M -eq $N"
assert "exec_on $HOST1 c0 dig +short $@ $NAME A | grep -v ';;' | wc -l" $N
}

check
Expand Down

0 comments on commit 6824487

Please sign in to comment.