aboutsummaryrefslogtreecommitdiff
path: root/qa/rpc-tests/test_framework
diff options
context:
space:
mode:
authorWladimir J. van der Laan <laanwj@gmail.com>2016-02-09 12:37:05 +0100
committerMarcoFalke <falke.marco@gmail.com>2016-04-27 12:29:56 +0200
commit9ca957bcd401de69c4c03904b9ee8b8b41052905 (patch)
tree41fa7f0eef928791a4eac56b18750eed9ec8c214 /qa/rpc-tests/test_framework
parent89ae85484c8b8eb6400cdaa84461c369854f6667 (diff)
downloadbitcoin-9ca957bcd401de69c4c03904b9ee8b8b41052905.tar.xz
tests: Make proxy_test work on travis servers without IPv6
Github-Pull: #7489 Rebased-From: 7539f1aae3b41279dc5d49e09f448a78a071e114
Diffstat (limited to 'qa/rpc-tests/test_framework')
-rw-r--r--qa/rpc-tests/test_framework/netutil.py15
1 files changed, 15 insertions, 0 deletions
diff --git a/qa/rpc-tests/test_framework/netutil.py b/qa/rpc-tests/test_framework/netutil.py
index c76de93429..52a7ab7489 100644
--- a/qa/rpc-tests/test_framework/netutil.py
+++ b/qa/rpc-tests/test_framework/netutil.py
@@ -138,3 +138,18 @@ def addr_to_hex(addr):
else:
raise ValueError('Could not parse address %s' % addr)
return hexlify(bytearray(addr)).decode('ascii')
+
+def test_ipv6_local():
+ '''
+ Check for (local) IPv6 support.
+ '''
+ import socket
+ # By using SOCK_DGRAM this will not actually make a connection, but it will
+ # fail if there is no route to IPv6 localhost.
+ have_ipv6 = True
+ try:
+ s = socket.socket(socket.AF_INET6, socket.SOCK_DGRAM)
+ s.connect(('::1', 0))
+ except socket.error:
+ have_ipv6 = False
+ return have_ipv6