If IP blocklists are enabled, block anything that isn't IPv4

I know of no public IPv6 blocklists.
This commit is contained in:
Matt Joiner 2015-04-01 17:36:51 +11:00
parent 6b81d57ca2
commit 97c235440c
1 changed files with 4 additions and 4 deletions

View File

@ -623,13 +623,13 @@ func (cl *Client) ipBlockRange(ip net.IP) (r *iplist.Range) {
if cl.ipBlockList == nil {
return
}
ip = ip.To4()
if ip == nil {
log.Printf("saw non-IPv4 address")
ip4 := ip.To4()
if ip4 == nil {
log.Printf("blocking non-IPv4 address: %s", ip)
r = &ipv6BlockRange
return
}
r = cl.ipBlockList.Lookup(ip)
r = cl.ipBlockList.Lookup(ip4)
return
}