Merge pull request #428 from ThomasWaldmann/fix-herror
fix crash / add logging for reverse lookup on invalid ip address string
This commit is contained in:
commit
4581f90f2d
@ -285,6 +285,10 @@ def rev_lookup(ipaddr):
|
||||
try:
|
||||
return socket.gethostbyaddr(ipaddr)[0]
|
||||
except socket.error as err:
|
||||
if err.errno in (-5, 4):
|
||||
# -5 / 4 == no address associated with hostname (invalid ip?)
|
||||
logger.warning("errno -5 when trying to reverse lookup %r" % ipaddr)
|
||||
break
|
||||
if err.errno in (errno.EPERM, ):
|
||||
# EPERM == 1 == unknown host
|
||||
break
|
||||
|
Loading…
x
Reference in New Issue
Block a user