Skip to content

Commit

Permalink
Pull request #1238: dnsforward: fix panic
Browse files Browse the repository at this point in the history
Updates #3318.

Squashed commit of the following:

commit eebaa3a
Author: Ainar Garipov <[email protected]>
Date:   Tue Jul 6 14:59:00 2021 +0300

    dnsforward: imp code

commit 7591a3b
Author: Ainar Garipov <[email protected]>
Date:   Tue Jul 6 14:55:33 2021 +0300

    dnsforward: fix panic
  • Loading branch information
ainar-g committed Jul 6, 2021
1 parent 4b5a66e commit 1571609
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions internal/dnsforward/dns.go
Original file line number Diff line number Diff line change
Expand Up @@ -379,15 +379,17 @@ func (s *Server) ipToHost(ip net.IP) (host string, ok bool) {

var v interface{}
v, ok = s.tableIPToHost.Get(ip)
if !ok {
return "", false
}

var typOK bool
if host, typOK = v.(string); !typOK {
if host, ok = v.(string); !ok {
log.Error("dns: bad type %T in tableIPToHost for %s", v, ip)

return "", false
}

return host, ok
return host, true
}

// Respond to PTR requests if the target IP is leased by our DHCP server and the
Expand Down

0 comments on commit 1571609

Please sign in to comment.