@@ -460,6 +460,26 @@ def get_domain() -> str:
460
460
return str (role )
461
461
462
462
463
+ def flush_ipv6_addr_by_interface () -> None :
464
+ interface_name = get_host_interface_name ()
465
+ print (f'flush ipv6 addr : { interface_name } ' )
466
+ command_show_addr = f'ip -6 addr show dev { interface_name } '
467
+ command_show_route = f'ip -6 route show dev { interface_name } '
468
+ addr_before = subprocess .getoutput (command_show_addr )
469
+ route_before = subprocess .getoutput (command_show_route )
470
+ print (f'Before flush, IPv6 addresses: \n { addr_before } ' )
471
+ print (f'Before flush, IPv6 routes: \n { route_before } ' )
472
+ subprocess .run (['ip' , 'link' , 'set' , interface_name , 'down' ])
473
+ subprocess .run (['ip' , '-6' , 'addr' , 'flush' , 'dev' , interface_name ])
474
+ subprocess .run (['ip' , '-6' , 'route' , 'flush' , 'dev' , interface_name ])
475
+ subprocess .run (['ip' , 'link' , 'set' , interface_name , 'up' ])
476
+ time .sleep (5 )
477
+ addr_after = subprocess .getoutput (command_show_addr )
478
+ route_after = subprocess .getoutput (command_show_route )
479
+ print (f'After flush, IPv6 addresses: \n { addr_after } ' )
480
+ print (f'After flush, IPv6 routes: \n { route_after } ' )
481
+
482
+
463
483
class tcp_parameter :
464
484
465
485
def __init__ (self , tcp_type :str = '' , addr :str = '::' , port :int = 12345 , listen_flag :bool = False , recv_flag :bool = False , timeout :float = 15.0 , tcp_bytes :bytes = b'' ):
0 commit comments