File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -2184,8 +2184,7 @@ namespace ccf
21842184 // numeric, but at least the final component (TLD) must not be
21852185 // all-numeric. So this distinguishes "1.2.3.4" (an IP address) from
21862186 // "1.2.3.c4m" (a DNS name). "1.2.3." is invalid for either, and will
2187- // throw. Attempts to handle IPv6 by also splitting on ':', but this is
2188- // untested.
2187+ // throw. Handles IPv6 by splitting on ':' after splitting on '.'.
21892188 const auto final_component =
21902189 ccf::nonstd::split (ccf::nonstd::split (hostname, " ." ).back (), " :" )
21912190 .back ();
@@ -2216,6 +2215,11 @@ namespace ccf
22162215 for (const auto & [_, interface] : config.network .rpc_interfaces )
22172216 {
22182217 auto host = split_net_address (interface.published_address ).first ;
2218+ // Strip brackets from IPv6 addresses (e.g. "[::1]" -> "::1")
2219+ if (host.size () >= 2 && host.front () == ' [' && host.back () == ' ]' )
2220+ {
2221+ host = host.substr (1 , host.size () - 2 );
2222+ }
22192223 sans.push_back ({host, is_ip (host)});
22202224 }
22212225 return sans;
Original file line number Diff line number Diff line change 11# Copyright (c) Microsoft Corporation. All rights reserved.
22# Licensed under the Apache 2.0 License.
33import infra .network
4+ import infra .interfaces
45from ccf .ledger import NodeStatus
56import http
67import random
8+ import socket
79import suite .test_requirements as reqs
810
911
@@ -341,6 +343,15 @@ def run(args):
341343
342344
343345def run_ipv6 (args ):
346+ # Check if IPv6 loopback is available before attempting to start nodes.
347+ # Some CI environments disable IPv6, in which case this test is skipped.
348+ try :
349+ with socket .socket (socket .AF_INET6 , socket .SOCK_STREAM ) as s :
350+ s .bind (("::1" , 0 ))
351+ except (OSError , socket .error ):
352+ LOG .warning ("IPv6 loopback (::1) is not available, skipping IPv6 test" )
353+ return
354+
344355 # Set each RPC interface host to the IPv6 loopback address directly,
345356 # so the setting is isolated to this test (no environment variable).
346357 # Ports are dynamically assigned, so sharing ::1 across nodes is fine.
You can’t perform that action at this time.
0 commit comments