@@ -39,8 +39,14 @@ const int sk_ip_level = SOL_IP;
39
39
const int sk_recverr = IP_RECVERR ;
40
40
#endif
41
41
42
- #define test_icmps_fail test_fail
43
- #define test_icmps_ok test_ok
42
+ /* Server is expected to fail with hard error if ::accept_icmp is set */
43
+ #ifdef TEST_ICMPS_ACCEPT
44
+ # define test_icmps_fail test_ok
45
+ # define test_icmps_ok test_fail
46
+ #else
47
+ # define test_icmps_fail test_fail
48
+ # define test_icmps_ok test_ok
49
+ #endif
44
50
45
51
static void serve_interfered (int sk )
46
52
{
@@ -84,7 +90,11 @@ static void serve_interfered(int sk)
84
90
test_fail ("Not found %s counter" , tcpao_icmps );
85
91
return ;
86
92
}
93
+ #ifdef TEST_ICMPS_ACCEPT
94
+ test_tcp_ao_counters_cmp (NULL , & ao_cnt1 , & ao_cnt2 , TEST_CNT_GOOD );
95
+ #else
87
96
test_tcp_ao_counters_cmp (NULL , & ao_cnt1 , & ao_cnt2 , TEST_CNT_GOOD | TEST_CNT_AO_DROPPED_ICMP );
97
+ #endif
88
98
if (icmp_ignored_a >= icmp_ignored_b ) {
89
99
test_icmps_fail ("%s counter didn't change: %" PRIu64 " >= %" PRIu64 ,
90
100
tcpao_icmps , icmp_ignored_a , icmp_ignored_b );
@@ -95,22 +105,23 @@ static void serve_interfered(int sk)
95
105
96
106
static void * server_fn (void * arg )
97
107
{
98
- int val , err , sk , lsk ;
108
+ int val , sk , lsk ;
99
109
bool accept_icmps = false;
100
110
101
111
lsk = test_listen_socket (this_ip_addr , test_server_port , 1 );
102
112
113
+ #ifdef TEST_ICMPS_ACCEPT
114
+ accept_icmps = true;
115
+ #endif
116
+
103
117
if (test_set_ao_flags (lsk , false, accept_icmps ))
104
118
test_error ("setsockopt(TCP_AO_INFO)" );
105
119
106
120
if (test_add_key (lsk , DEFAULT_TEST_PASSWORD , this_ip_dest , -1 , 100 , 100 ))
107
121
test_error ("setsockopt(TCP_AO_ADD_KEY)" );
108
122
synchronize_threads ();
109
123
110
- err = test_wait_fd (lsk , TEST_TIMEOUT_SEC , 0 );
111
- if (!err )
112
- test_error ("timeouted for accept()" );
113
- else if (err < 0 )
124
+ if (test_wait_fd (lsk , TEST_TIMEOUT_SEC , 0 ))
114
125
test_error ("test_wait_fd()" );
115
126
116
127
sk = accept (lsk , NULL , NULL );
0 commit comments