def test_ipv6():
 if (not cfg.selftest_host()):
  return True
 try:
  info = getipaddress.addresslookup6(cfg.selftest_host())
 except:
  logging.debug("Test IPv6: Disabling IPv6, because it looks like it's not available. Reason: %s", sys.exc_info()[0])
  return False
 try:
  (af, socktype, proto, canonname, sa) = info[0]
  sock = socket.socket(af, socktype, proto)
  sock.settimeout(2)
  sock.connect(sa[0:2])
  sock.close()
  logging.debug('Test IPv6: IPv6 test successful. Enabling IPv6')
  return True
 except socket.error:
  logging.debug('Test IPv6: Cannot reach IPv6 test host. Disabling IPv6')
  return False
 except:
  logging.debug('Test IPv6: Problem during IPv6 connect. Disabling IPv6. Reason: %s', sys.exc_info()[0])
  return False

def test_ipv6 ( ) : if ( not cfg . selftest_host ( ) ) : return True try : info = getipaddress . addresslookup6 ( cfg . selftest_host ( ) ) except : logging . debug ( "Test IPv6: Disabling IPv6, because it looks like it's not available. Reason: %s" , sys . exc_info ( ) [ 0 ] ) return False try : ( af , socktype , proto , canonname , sa ) = info [ 0 ] sock = socket . socket ( af , socktype , proto ) sock . settimeout ( 2 ) sock . connect ( sa [ 0 : 2 ] ) sock . close ( ) logging . debug ( 'Test IPv6: IPv6 test successful. Enabling IPv6' ) return True except socket . error : logging . debug ( 'Test IPv6: Cannot reach IPv6 test host. Disabling IPv6' ) return False except : logging . debug ( 'Test IPv6: Problem during IPv6 connect. Disabling IPv6. Reason: %s' , sys . exc_info ( ) [ 0 ] ) return False
check if external ipv6 addresses are reachable .