@@ -1746,6 +1746,48 @@ static void test_stream_transport_uaf_server(const struct test_opts *opts)
1746
1746
control_expectln ("DONE" );
1747
1747
}
1748
1748
1749
+ static void test_stream_connect_retry_client (const struct test_opts * opts )
1750
+ {
1751
+ int fd ;
1752
+
1753
+ fd = socket (AF_VSOCK , SOCK_STREAM , 0 );
1754
+ if (fd < 0 ) {
1755
+ perror ("socket" );
1756
+ exit (EXIT_FAILURE );
1757
+ }
1758
+
1759
+ if (!vsock_connect_fd (fd , opts -> peer_cid , opts -> peer_port )) {
1760
+ fprintf (stderr , "Unexpected connect() #1 success\n" );
1761
+ exit (EXIT_FAILURE );
1762
+ }
1763
+
1764
+ control_writeln ("LISTEN" );
1765
+ control_expectln ("LISTENING" );
1766
+
1767
+ if (vsock_connect_fd (fd , opts -> peer_cid , opts -> peer_port )) {
1768
+ perror ("connect() #2" );
1769
+ exit (EXIT_FAILURE );
1770
+ }
1771
+
1772
+ close (fd );
1773
+ }
1774
+
1775
+ static void test_stream_connect_retry_server (const struct test_opts * opts )
1776
+ {
1777
+ int fd ;
1778
+
1779
+ control_expectln ("LISTEN" );
1780
+
1781
+ fd = vsock_stream_accept (VMADDR_CID_ANY , opts -> peer_port , NULL );
1782
+ if (fd < 0 ) {
1783
+ perror ("accept" );
1784
+ exit (EXIT_FAILURE );
1785
+ }
1786
+
1787
+ vsock_wait_remote_close (fd );
1788
+ close (fd );
1789
+ }
1790
+
1749
1791
static struct test_case test_cases [] = {
1750
1792
{
1751
1793
.name = "SOCK_STREAM connection reset" ,
@@ -1896,6 +1938,11 @@ static struct test_case test_cases[] = {
1896
1938
.run_client = test_stream_transport_uaf_client ,
1897
1939
.run_server = test_stream_transport_uaf_server ,
1898
1940
},
1941
+ {
1942
+ .name = "SOCK_STREAM retry failed connect()" ,
1943
+ .run_client = test_stream_connect_retry_client ,
1944
+ .run_server = test_stream_connect_retry_server ,
1945
+ },
1899
1946
{},
1900
1947
};
1901
1948
0 commit comments