|  | @@ -75,6 +75,10 @@ void test_connect(const char *server_host, const char *client_host, int port,
 | 
	
		
			
				|  |  |    gpr_timespec deadline;
 | 
	
		
			
				|  |  |    int got_port;
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | +  if (port == 0) {
 | 
	
		
			
				|  |  | +    port = grpc_pick_unused_port_or_die();
 | 
	
		
			
				|  |  | +  }
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  |    gpr_join_host_port(&server_hostport, server_host, port);
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |    /* Create server. */
 | 
	
	
		
			
				|  | @@ -179,7 +183,6 @@ void test_connect(const char *server_host, const char *client_host, int port,
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |  int main(int argc, char **argv) {
 | 
	
		
			
				|  |  |    int do_ipv6 = 1;
 | 
	
		
			
				|  |  | -  int fixed_port;
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |    grpc_test_init(argc, argv);
 | 
	
		
			
				|  |  |    grpc_init();
 | 
	
	
		
			
				|  | @@ -189,32 +192,28 @@ int main(int argc, char **argv) {
 | 
	
		
			
				|  |  |      do_ipv6 = 0;
 | 
	
		
			
				|  |  |    }
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | -  for (fixed_port = 0; fixed_port <= 1; fixed_port++) {
 | 
	
		
			
				|  |  | -    int port = fixed_port ? grpc_pick_unused_port_or_die() : 0;
 | 
	
		
			
				|  |  | -
 | 
	
		
			
				|  |  |      /* For coverage, test with and without dualstack sockets. */
 | 
	
		
			
				|  |  | -    for (grpc_forbid_dualstack_sockets_for_testing = 0;
 | 
	
		
			
				|  |  | -         grpc_forbid_dualstack_sockets_for_testing <= 1;
 | 
	
		
			
				|  |  | -         grpc_forbid_dualstack_sockets_for_testing++) {
 | 
	
		
			
				|  |  | -      /* :: and 0.0.0.0 are handled identically. */
 | 
	
		
			
				|  |  | -      test_connect("::", "127.0.0.1", port, 1);
 | 
	
		
			
				|  |  | -      test_connect("::", "::ffff:127.0.0.1", port, 1);
 | 
	
		
			
				|  |  | -      test_connect("::", "localhost", port, 1);
 | 
	
		
			
				|  |  | -      test_connect("0.0.0.0", "127.0.0.1", port, 1);
 | 
	
		
			
				|  |  | -      test_connect("0.0.0.0", "::ffff:127.0.0.1", port, 1);
 | 
	
		
			
				|  |  | -      test_connect("0.0.0.0", "localhost", port, 1);
 | 
	
		
			
				|  |  | -      if (do_ipv6) {
 | 
	
		
			
				|  |  | -        test_connect("::", "::1", port, 1);
 | 
	
		
			
				|  |  | -        test_connect("0.0.0.0", "::1", port, 1);
 | 
	
		
			
				|  |  | -      }
 | 
	
		
			
				|  |  | -
 | 
	
		
			
				|  |  | -      /* These only work when the families agree. */
 | 
	
		
			
				|  |  | -      test_connect("127.0.0.1", "127.0.0.1", port, 1);
 | 
	
		
			
				|  |  | -      if (do_ipv6) {
 | 
	
		
			
				|  |  | -        test_connect("::1", "::1", port, 1);
 | 
	
		
			
				|  |  | -        test_connect("::1", "127.0.0.1", port, 0);
 | 
	
		
			
				|  |  | -        test_connect("127.0.0.1", "::1", port, 0);
 | 
	
		
			
				|  |  | -      }
 | 
	
		
			
				|  |  | +  for (grpc_forbid_dualstack_sockets_for_testing = 0;
 | 
	
		
			
				|  |  | +       grpc_forbid_dualstack_sockets_for_testing <= 1;
 | 
	
		
			
				|  |  | +       grpc_forbid_dualstack_sockets_for_testing++) {
 | 
	
		
			
				|  |  | +    /* :: and 0.0.0.0 are handled identically. */
 | 
	
		
			
				|  |  | +    test_connect("::", "127.0.0.1", 0, 1);
 | 
	
		
			
				|  |  | +    test_connect("::", "::ffff:127.0.0.1", 0, 1);
 | 
	
		
			
				|  |  | +    test_connect("::", "localhost", 0, 1);
 | 
	
		
			
				|  |  | +    test_connect("0.0.0.0", "127.0.0.1", 0, 1);
 | 
	
		
			
				|  |  | +    test_connect("0.0.0.0", "::ffff:127.0.0.1", 0, 1);
 | 
	
		
			
				|  |  | +    test_connect("0.0.0.0", "localhost", 0, 1);
 | 
	
		
			
				|  |  | +    if (do_ipv6) {
 | 
	
		
			
				|  |  | +      test_connect("::", "::1", 0, 1);
 | 
	
		
			
				|  |  | +      test_connect("0.0.0.0", "::1", 0, 1);
 | 
	
		
			
				|  |  | +    }
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +    /* These only work when the families agree. */
 | 
	
		
			
				|  |  | +    test_connect("127.0.0.1", "127.0.0.1", 0, 1);
 | 
	
		
			
				|  |  | +    if (do_ipv6) {
 | 
	
		
			
				|  |  | +      test_connect("::1", "::1", 0, 1);
 | 
	
		
			
				|  |  | +      test_connect("::1", "127.0.0.1", 0, 0);
 | 
	
		
			
				|  |  | +      test_connect("127.0.0.1", "::1", 0, 0);
 | 
	
		
			
				|  |  |      }
 | 
	
		
			
				|  |  |    }
 | 
	
		
			
				|  |  |  
 |