Skip to content

Commit 2ca71d5

Browse files
committed
Add cases that require IPv6 server reflexive to work
1 parent 491d224 commit 2ca71d5

1 file changed

Lines changed: 10 additions & 4 deletions

File tree

tests/test_p2p.py

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
g_spew_level = None
2424
g_p2p_rendezvous_level = None
2525
g_stun_ip = "127.0.100.1"
26+
g_stun_ipv6 = "fd7f:0:100::1"
2627
g_stun_port = 3478
2728
g_setup_mock_ips = False
2829
g_cleanup_mock_ips = False
@@ -152,7 +153,7 @@ def StartClientInThread( role, local, remote, extra_args=[] ):
152153
"--log", local + ".verbose.log"
153154
]
154155

155-
cmdline += [ '--stun-server', "%s:%d" % (g_stun_ip, g_stun_port) ]
156+
cmdline += [ '--stun-server', "%s:%d,[%s]:%d" % (g_stun_ip, g_stun_port, g_stun_ipv6, g_stun_port) ]
156157
cmdline += extra_args
157158
if g_spew_level is not None:
158159
cmdline.append( '--spewlevel=' + g_spew_level )
@@ -194,6 +195,7 @@ def StartClientInThread( role, local, remote, extra_args=[] ):
194195
g_stun_ip,
195196
_SRV_GW, _CLI_GW, _SRV_GW2, _CLI_GW2,
196197
_SRV_INT, _CLI_INT, _SRV_INT2, _CLI_INT2, _DEAD_INT, _CLI_SAME_LAN,
198+
g_stun_ipv6,
197199
_SRV_GW_V6, _CLI_GW_V6, _SRV_INT_V6, _CLI_INT_V6,
198200
]
199201

@@ -380,8 +382,11 @@ def _slow_nat( internal, gateway, nat_type, latency_ms ):
380382
[ '--mock-adapter', _CLI_GW_V6 ],
381383
'udp', 1 ),
382384

383-
# NOTE: IPv6 NAT cases require STUN to discover server-reflexive candidates.
384-
# The STUN server does not yet support IPv6, so those tests are deferred.
385+
# IPv6 full-cone NAT
386+
( 'IPv6 full-cone NAT',
387+
_nat( _SRV_INT_V6, _SRV_GW_V6, 'full-cone' ),
388+
_nat( _CLI_INT_V6, _CLI_GW_V6, 'full-cone' ),
389+
'udp', 1 ),
385390
]
386391

387392
def ClientServerTest( server_extra_args=[], client_extra_args=[], expected_route=None, ice_impl=1 ):
@@ -428,7 +433,8 @@ def ClientServerTest( server_extra_args=[], client_extra_args=[], expected_route
428433
print( "Can't find stun_server.py" )
429434
sys.exit(1)
430435

431-
stun = StartProcessInThread( "stun", [ sys.executable, stun_server_script, '--host', g_stun_ip, '--port', str(g_stun_port) ],
436+
stun = StartProcessInThread( "stun", [ sys.executable, stun_server_script,
437+
'--host', g_stun_ip, '--host6', g_stun_ipv6, '--port', str(g_stun_port) ],
432438
ready_message="STUN server listening on", ready_event=g_stun_ready )
433439

434440
if not g_stun_ready.wait( timeout=g_server_startup_timeout ):

0 commit comments

Comments
 (0)