fix crash / add logging for reverse lookup on invalid ip address string
This commit is contained in:
parent
c320578879
commit
f4bdf5b37d
@ -285,6 +285,10 @@ def rev_lookup(ipaddr):
|
|||||||
try:
|
try:
|
||||||
return socket.gethostbyaddr(ipaddr)[0]
|
return socket.gethostbyaddr(ipaddr)[0]
|
||||||
except socket.error as err:
|
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, ):
|
if err.errno in (errno.EPERM, ):
|
||||||
# EPERM == 1 == unknown host
|
# EPERM == 1 == unknown host
|
||||||
break
|
break
|
||||||
|
Loading…
x
Reference in New Issue
Block a user