Skip to content

Commit

Permalink
Merge pull request #428 from ThomasWaldmann/fix-herror
Browse files Browse the repository at this point in the history
fix crash / add logging for reverse lookup on invalid ip address string
  • Loading branch information
ThomasWaldmann authored Apr 14, 2019
2 parents c320578 + f4bdf5b commit 4581f90
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/nsupdate/main/dnstools.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 4581f90

Please sign in to comment.