Skip to content

Commit

Permalink
Handle empty dns answer (#1344)
Browse files Browse the repository at this point in the history
Signed-off-by: Artem Glazychev <artem.glazychev@xored.com>

Signed-off-by: Artem Glazychev <artem.glazychev@xored.com>
  • Loading branch information
glazychev-art authored Aug 31, 2022
1 parent dacfc98 commit ed5cc97
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
3 changes: 3 additions & 0 deletions pkg/tools/dnsutils/cache/handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,9 @@ func (h *dnsCacheHandler) updateTTL() {
}

func validateMsg(m *dns.Msg) bool {
if len(m.Answer) == 0 {
return false
}
for _, answer := range m.Answer {
if answer.Header().Ttl <= 0 {
return false
Expand Down
2 changes: 1 addition & 1 deletion pkg/tools/dnsutils/fanout/handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ func (h *fanoutHandler) waitResponse(ctx context.Context, respCh <-chan *dns.Msg
}
continue
}
if resp.Rcode == dns.RcodeSuccess {
if resp.Rcode == dns.RcodeSuccess && len(resp.Answer) != 0 {
return resp
}
if respCount == 0 {
Expand Down

0 comments on commit ed5cc97

Please sign in to comment.