diff options
author | Casey Deccio <casey@deccio.net> | 2017-04-14 08:15:40 +0300 |
---|---|---|
committer | Casey Deccio <casey@deccio.net> | 2017-06-15 23:40:18 +0300 |
commit | 0b0fd690ee1c43cb106d6b731b5dd63fa9d37e47 (patch) | |
tree | a964a5e8cdf4845c28076bbfa86c8761df185801 | |
parent | 8b0c434660fbf6471df1bb15b203def886aaa808 (diff) |
Include EAFNOSUPPORT
-rw-r--r-- | dnsviz/query.py | 18 |
1 files changed, 11 insertions, 7 deletions
diff --git a/dnsviz/query.py b/dnsviz/query.py index 9f1305b..84cdfea 100644 --- a/dnsviz/query.py +++ b/dnsviz/query.py @@ -771,8 +771,9 @@ class DNSQueryHandler: # Explicitly specifying a client IP that cannot connect to a # given destination (e.g., because it is of the wrong address # scope) will result in a regular network failure with - # EHOSTUNREACH, as there is no scope comparison in this code.) - if retry_action.cause == RETRY_CAUSE_NETWORK_ERROR and retry_action.cause_arg in (errno.EHOSTUNREACH, errno.ENETUNREACH) and client is None: + # EHOSTUNREACH or ENETUNREACH, as there is no scope comparison + # in this code.) + if retry_action.cause == RETRY_CAUSE_NETWORK_ERROR and retry_action.cause_arg in (errno.EHOSTUNREACH, errno.ENETUNREACH, errno.EAFNOSUPPORT) and client is None: raise AcceptResponse # if this error was our fault, don't add it to the history @@ -1430,11 +1431,14 @@ class ExecutableDNSQuery(DNSQuery): raise PortBindError('Unable to bind to local port %d (%s)' % (qh.params['sport'], errno.errorcode[errno1])) else: raise PortBindError('Unable to bind to local port (%s)' % (errno.errorcode[errno1])) - elif qtm.src is None and errno1 not in (errno.EHOSTUNREACH, errno.ENETUNREACH): - # If source is None it didn't bind properly. If errno1 - # is also EHOSTUNREACH, it is because there was no - # proper IPv4 or IPv6 connectivity (which is handled - # elsewhere); otherwise, it was something unknown, so + elif qtm.src is None and errno1 not in (errno.EHOSTUNREACH, errno.ENETUNREACH, errno.EAFNOSUPPORT): + # If source is None it didn't bind properly. If the + # errno1 value after bind() is EHOSTUNREACH or + # ENETUNREACH, it is because there was no proper IPv4 + # or IPv6 connectivity (which is handled elsewhere). + # If socket() failed and resulted in an errno value of + # EAFNOSUPPORT, then likewise there is not IPv6 + # support. In other cases, it was something unknown, so # raise an error. raise BindError('Unable to bind to local address (%s)' % (errno.errorcode.get(errno1, "unknown"))) |