Debian Codegraph @

src/func_tests/test_timetolive.c

raw symbols SCIP
1 /* SCTP kernel Implementation
2 * (C) Copyright IBM Corp. 2001, 2003
3 * Copyright (c) 1999-2000 Cisco, Inc.
4 * Copyright (c) 1999-2001 Motorola, Inc.
5 * Copyright (c) 2001 Intel Corp.
6 * Copyright (c) 2001 Nokia, Inc.
7 *
8 * The SCTP implementation is free software;
9 * you can redistribute it and/or modify it under the terms of
10 * the GNU General Public License as published by
11 * the Free Software Foundation; either version 2, or (at your option)
12 * any later version.
13 *
14 * The SCTP implementation is distributed in the hope that it
15 * will be useful, but WITHOUT ANY WARRANTY; without even the implied
16 * ************************
17 * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
18 * See the GNU General Public License for more details.
19 *
20 * You should have received a copy of the GNU General Public License
21 * along with GNU CC; see the file COPYING. If not, write to
22 * the Free Software Foundation, 59 Temple Place - Suite 330,
23 * Boston, MA 02111-1307, USA.
24 *
25 * Please send any bug reports or fixes you make to the
26 * email address(es):
27 * lksctp developers <[email protected]>
28 *
29 * Or submit a bug report through the following website:
30 * https://github.com/sctp/lksctp-tools/
31 *
32 * Any bugs reported to us we will try to fix... any fixes shared will
33 * be incorporated into the next SCTP release.
34 *
35 * Written or modified by:
36 * Jon Grimm <[email protected]>
37 * Sridhar Samudrala <[email protected]>
38 */
39
40 /*
41 * This is a basic functional test for the SCTP kernel
42 * implementation of sndrcvinfo.sinfo_timetolive.
43 *
44 * 1) Create two sockets, the listening socket sets its RECVBUF small
45 * 2) Create a connection. Send enough data to the non-reading listener
46 * to fill the RCVBUF.
47 * 5) Set sinfo_timetolive on a message and send.
48 * 6) Disable sinfo_timetolive on a message and send.
49 * 7) Wait sinfo_timetolive.
50 * 8) Read out all the data at the receiver.
51 * 9) Make sure timed out message did not make it.
52 * 10) Make sure that the message with no timeout makes it to the receiver.
53 *
54 * Also test with SEND_FAILED notifications. Also, use a fragmented
55 * message so as to also exercise the SEND_FAILED of fragmentation
56 * code.
57 */
58
59 #include <stdio.h>
60 #include <unistd.h>
61 #include <stdlib.h>
62 #include <string.h>
63 #include <sys/types.h>
64 #include <sys/socket.h>
65 #include <sys/uio.h>
66 #include <netinet/in.h>
67 #include <errno.h>
68 #include <netinet/sctp.h>cxx . . $ `<file>/src/include/netinet/sctp.h`/
69 #include <sctputil.h>cxx . . $ `<file>/src/testlib/sctputil.h`/
70
71 char *TCIDcxx . . $ TCID. = __FILE__;
72 int TST_TOTALcxx . . $ TST_TOTAL. = 6;
73 int TST_CNTcxx . . $ TST_CNT. = 0;
74
75 /* This is the size of our RCVBUF */
76 #define SMALL_RCVBUFcxx . . $ `src/func_tests/test_timetolive.c:76:9`! 3000
77
78 /* MAX segment size */
79 #define SMALL_MAXSEGcxx . . $ `src/func_tests/test_timetolive.c:79:9`! 500
80
81 /* RWND_SLOP is the extra data that fills up the rwnd */
82 #define RWND_SLOPcxx . . $ `src/func_tests/test_timetolive.c:82:9`! 100
83 static char *fillmsgcxx . . $ fillmsg. = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!;
84 static char *ttlmsgcxx . . $ ttlmsg. = "This should time out!\n";
85 static char *nottlmsgcxx . . $ nottlmsg. = "This should NOT time out!\n";
86 static char ttlfragcxx . . $ ttlfrag.[SMALL_MAXSEGcxx . . $ `src/func_tests/test_timetolive.c:79:9`!*3] = {0};
87 static char *messagecxx . . $ message. = "Hello world\n";
88
89 int maincxx . . $ main(afcd3168fc1188a4).(int argc, char *argv[])
90 {
91 int sk1, sk2;
92 sockaddr_storage_tcxx . . $ sockaddr_storage_t# loop1;
93 sockaddr_storage_tcxx . . $ sockaddr_storage_t# loop2;
94 struct ioveccxx . . $ iovec# iov;
95 struct msghdrcxx . . $ msghdr# inmessage;
96 struct msghdrcxx . . $ msghdr# outmessage;
97 char incmsg[CMSG_SPACEcxx . . $ `<external>/8962547315054503424/socket.h:309:9`!(sizeof(sctp_cmsg_data_t))];
98 char outcmsg[CMSG_SPACEcxx . . $ `<external>/8962547315054503424/socket.h:309:9`!(sizeof(struct sctp_sndrcvinfo))];
99 struct cmsghdrcxx . . $ cmsghdr# *cmsg;
100 struct sctp_sndrcvinfocxx . . $ sctp_sndrcvinfo# *sinfo;
101 struct ioveccxx . . $ iovec# out_iov;
102 int error;
103 int pf_class;
104 uint32_tcxx . . $ uint32_t# ppid;
105 uint32_tcxx . . $ uint32_t# stream;
106 sctp_assoc_tcxx . . $ sctp_assoc_t# associd1;
107 struct sctp_assoc_changecxx . . $ sctp_assoc_change# *sac;
108 struct sctp_event_subscribecxx . . $ sctp_event_subscribe# subscribe;
109 char *big_buffer;
110 int offset;
111 struct sctp_send_failedcxx . . $ sctp_send_failed# *ssf;
112 socklen_tcxx . . $ socklen_t# len; /* Really becomes 2xlen when set. */
113 int orig_len;
114 struct sctp_statuscxx . . $ sctp_status# gstatus;
115
116 /* Rather than fflush() throughout the code, set stdout to
117 * be unbuffered.
118 */
119 setvbufcxx . . $ setvbuf(4da3ba8c983f31bc).(stdoutcxx . . $ `<external>/232824719582829767/stdio.h:158:9`!, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!, _IONBFcxx . . $ `<external>/232824719582829767/stdio.h:100:9`!, 0);
120
121 /* Set some basic values which depend on the address family. */
122 #if TEST_V6
123 pf_class = PF_INET6;
124
125 loop1.v6.sin6_family = AF_INET6;
126 loop1.v6.sin6_addr = in6addr_loopbackcxx . . $ in6addr_loopback.;
127 loop1.v6.sin6_port = htons(SCTP_TESTPORT_1);
128
129 loop2.v6.sin6_family = AF_INET6;
130 loop2.v6.sin6_addr = in6addr_loopbackcxx . . $ in6addr_loopback.;
131 loop2.v6.sin6_port = htons(SCTP_TESTPORT_2);
132 #else
133 pf_class = PF_INETcxx . . $ `<external>/8962547315054503424/socket.h:45:9`!;
134
135 loop1.v4cxx . . $ $anonymous_type_f8e963888af85862_0#v4..sin_familycxx . . $ sockaddr_in#sin_family. = AF_INETcxx . . $ `<external>/8962547315054503424/socket.h:97:9`!;
136 loop1.v4cxx . . $ $anonymous_type_f8e963888af85862_0#v4..sin_addrcxx . . $ sockaddr_in#sin_addr..s_addrcxx . . $ in_addr#s_addr. = SCTP_IP_LOOPBACKcxx . . $ `src/testlib/sctputil.h:76:9`!;
137 loop1.v4cxx . . $ $anonymous_type_f8e963888af85862_0#v4..sin_portcxx . . $ sockaddr_in#sin_port. = htonscxx . . $ `<external>/9581057695539925927/in.h:431:12`!(SCTP_TESTPORT_1cxx . . $ `src/testlib/sctputil.h:71:9`!);
138
139 loop2.v4cxx . . $ $anonymous_type_f8e963888af85862_0#v4..sin_familycxx . . $ sockaddr_in#sin_family. = AF_INETcxx . . $ `<external>/8962547315054503424/socket.h:97:9`!;
140 loop2.v4cxx . . $ $anonymous_type_f8e963888af85862_0#v4..sin_addrcxx . . $ sockaddr_in#sin_addr..s_addrcxx . . $ in_addr#s_addr. = SCTP_IP_LOOPBACKcxx . . $ `src/testlib/sctputil.h:76:9`!;
141 loop2.v4cxx . . $ $anonymous_type_f8e963888af85862_0#v4..sin_portcxx . . $ sockaddr_in#sin_port. = htonscxx . . $ `<external>/9581057695539925927/in.h:431:12`!(SCTP_TESTPORT_2cxx . . $ `src/testlib/sctputil.h:73:9`!);
142 #endif /* TEST_V6 */
143
144 /* Create the two endpoints which will talk to each other. */
145 sk1 = test_socketcxx . . $ test_socket(2326284602b0bb2d).(pf_class, SOCK_SEQPACKETcxx . . $ `<external>/5956532346368192945/socket_type.h:38:9`!, IPPROTO_SCTPcxx . . $ `<external>/9581057695539925927/in.h:87:9`!);
146 sk2 = test_socketcxx . . $ test_socket(2326284602b0bb2d).(pf_class, SOCK_SEQPACKETcxx . . $ `<external>/5956532346368192945/socket_type.h:38:9`!, IPPROTO_SCTPcxx . . $ `<external>/9581057695539925927/in.h:87:9`!);
147
148 len = sizeof(int);
149 error = getsockoptcxx . . $ getsockopt(b79d9f11efef15f9).(sk2, SOL_SOCKETcxx . . $ `<external>/9030916627833342711/socket.h:9:9`!, SO_RCVBUFcxx . . $ `<external>/9030916627833342711/socket.h:18:9`!, &orig_len,
150 &len);
151 if (error)
152 tst_brkmcxx . . $ `src/testlib/sctputil.h:116:9`!(TBROK, tst_exit, "can't get rcvbuf size: %s",
153 strerror(errnocxx . . $ `<external>/17633486526465735210/errno.h:38:10`!));
154 /* Set the MAXSEG to something smallish. */
155 {
156 int val = SMALL_MAXSEGcxx . . $ `src/func_tests/test_timetolive.c:79:9`!;
157 test_setsockoptcxx . . $ test_setsockopt(57908ac6eaa2fecc).(sk1, SCTP_MAXSEGcxx . . $ `<external>/17169092326581286071/sctp.h:82:9`!, &val, sizeof(val));
158 }
159
160 memsetcxx . . $ memset(d1de1e4fb215f1c6).(&subscribe, 0, sizeof(subscribe));
161 subscribe.sctp_data_io_eventcxx . . $ sctp_event_subscribe#sctp_data_io_event. = 1;
162 subscribe.sctp_association_eventcxx . . $ sctp_event_subscribe#sctp_association_event. = 1;
163 subscribe.sctp_send_failure_eventcxx . . $ sctp_event_subscribe#sctp_send_failure_event. = 1;
164 test_setsockoptcxx . . $ test_setsockopt(57908ac6eaa2fecc).(sk1, SCTP_EVENTScxx . . $ `<external>/17169092326581286071/sctp.h:80:9`!, &subscribe, sizeof(subscribe));
165 test_setsockoptcxx . . $ test_setsockopt(57908ac6eaa2fecc).(sk2, SCTP_EVENTScxx . . $ `<external>/17169092326581286071/sctp.h:80:9`!, &subscribe, sizeof(subscribe));
166
167 /* Bind these sockets to the test ports. */
168 test_bindcxx . . $ test_bind(18e507052d945257).(sk1, &loop1.sacxx . . $ $anonymous_type_f8e963888af85862_0#sa., sizeof(loop1));
169 test_bindcxx . . $ test_bind(18e507052d945257).(sk2, &loop2.sacxx . . $ $anonymous_type_f8e963888af85862_0#sa., sizeof(loop2));
170
171 /*
172 * This code sets the associations RWND very small so we can
173 * fill it. It does this by manipulating the rcvbuf as follows:
174 * 1) Reduce the rcvbuf size on the socket
175 * 2) create an association so that we advertise rcvbuf/2 as
176 * our initial rwnd
177 */
178 len = SMALL_RCVBUFcxx . . $ `src/func_tests/test_timetolive.c:76:9`!;
179 error = setsockoptcxx . . $ setsockopt(506cc1d0fc70fdf1).(sk2, SOL_SOCKETcxx . . $ `<external>/9030916627833342711/socket.h:9:9`!, SO_RCVBUFcxx . . $ `<external>/9030916627833342711/socket.h:18:9`!, &len,
180 sizeof(len));
181 if (error)
182 tst_brkmcxx . . $ `src/testlib/sctputil.h:116:9`!(TBROK, tst_exit, "setsockopt(SO_RCVBUF): %s",
183 strerror(errnocxx . . $ `<external>/17633486526465735210/errno.h:38:10`!));
184
185 /* Mark sk2 as being able to accept new associations. */
186 test_listencxx . . $ test_listen(9b79fb6aee4c0440).(sk2, 1);
187
188 /* Send the first message. This will create the association. */
189 outmessage.msg_namecxx . . $ msghdr#msg_name. = &loop2;
190 outmessage.msg_namelencxx . . $ msghdr#msg_namelen. = sizeof(loop2);
191 outmessage.msg_iovcxx . . $ msghdr#msg_iov. = &out_iov;
192 outmessage.msg_iovlencxx . . $ msghdr#msg_iovlen. = 1;
193 outmessage.msg_controlcxx . . $ msghdr#msg_control. = outcmsg;
194 outmessage.msg_controllencxx . . $ msghdr#msg_controllen. = sizeof(outcmsg);
195 outmessage.msg_flagscxx . . $ msghdr#msg_flags. = 0;
196 cmsg = CMSG_FIRSTHDRcxx . . $ `<external>/8962547315054503424/socket.h:304:9`!(&outmessage);
197 cmsg->cmsg_levelcxx . . $ cmsghdr#cmsg_level. = IPPROTO_SCTPcxx . . $ `<external>/9581057695539925927/in.h:87:9`!;
198 cmsg->cmsg_typecxx . . $ cmsghdr#cmsg_type. = SCTP_SNDRCVcxx . . $ `<external>/17169092326581286071/sctp.h:333:9`!;
199 cmsg->cmsg_lencxx . . $ cmsghdr#cmsg_len. = CMSG_LENcxx . . $ `<external>/8962547315054503424/socket.h:311:9`!(sizeof(struct sctp_sndrcvinfo));
200 outmessage.msg_controllencxx . . $ msghdr#msg_controllen. = cmsg->cmsg_lencxx . . $ cmsghdr#cmsg_len.;
201 sinfo = (struct sctp_sndrcvinfocxx . . $ sctp_sndrcvinfo# *)CMSG_DATAcxx . . $ `<external>/8962547315054503424/socket.h:299:10`!(cmsg);
202 memsetcxx . . $ memset(d1de1e4fb215f1c6).(sinfo, 0x00, sizeof(struct sctp_sndrcvinfocxx . . $ sctp_sndrcvinfo#));
203 ppid = randcxx . . $ rand(b126dc7c1de90089).(); /* Choose an arbitrary value. */
204 stream = 1;
205 sinfo->sinfo_ppidcxx . . $ sctp_sndrcvinfo#sinfo_ppid. = ppid;
206 sinfo->sinfo_streamcxx . . $ sctp_sndrcvinfo#sinfo_stream. = stream;
207 outmessage.msg_iovcxx . . $ msghdr#msg_iov.->iov_basecxx . . $ iovec#iov_base. = messagecxx . . $ message.;
208 outmessage.msg_iovcxx . . $ msghdr#msg_iov.->iov_lencxx . . $ iovec#iov_len. = strlencxx . . $ strlen(751346f8406fd082).(messagecxx . . $ message.) + 1;
209 test_sendmsgcxx . . $ test_sendmsg(c45a39c477f473e).(sk1, &outmessage, 0, strlencxx . . $ strlen(751346f8406fd082).(messagecxx . . $ message.)+1);
210
211 /* Initialize inmessage for all receives. */
212 big_buffer = test_malloccxx . . $ test_malloc(bfcfa4d6b7f7ef64).(REALLY_BIGcxx . . $ `src/testlib/sctputil.h:65:9`!);
213 memsetcxx . . $ memset(d1de1e4fb215f1c6).(&inmessage, 0, sizeof(inmessage));
214 iov.iov_basecxx . . $ iovec#iov_base. = big_buffer;
215 iov.iov_lencxx . . $ iovec#iov_len. = REALLY_BIGcxx . . $ `src/testlib/sctputil.h:65:9`!;
216 inmessage.msg_iovcxx . . $ msghdr#msg_iov. = &iov;
217 inmessage.msg_iovlencxx . . $ msghdr#msg_iovlen. = 1;
218 inmessage.msg_controlcxx . . $ msghdr#msg_control. = incmsg;
219
220 /* Get the communication up message on sk2. */
221 inmessage.msg_controllencxx . . $ msghdr#msg_controllen. = sizeof(incmsg);
222 error = test_recvmsgcxx . . $ test_recvmsg(2284ea468be03a33).(sk2, &inmessage, MSG_WAITALLcxx . . $ `<external>/8962547315054503424/socket.h:230:9`!);
223 test_check_msg_notificationcxx . . $ test_check_msg_notification(bda0d4705bf9b0d0).(&inmessage, error,
224 sizeof(struct sctp_assoc_changecxx . . $ sctp_assoc_change#),
225 SCTP_ASSOC_CHANGEcxx . . $ `<external>/17169092326581286071/sctp.h:666:9`!, SCTP_COMM_UPcxx . . $ SCTP_COMM_UP.);
226 #if 0
227 sac = (struct sctp_assoc_change *)iov.iov_base;
228 associd2 = sac->sac_assoc_id;
229 #endif
230
231 /* Get the communication up message on sk1. */
232 inmessage.msg_controllencxx . . $ msghdr#msg_controllen. = sizeof(incmsg);
233 error = test_recvmsgcxx . . $ test_recvmsg(2284ea468be03a33).(sk1, &inmessage, MSG_WAITALLcxx . . $ `<external>/8962547315054503424/socket.h:230:9`!);
234 test_check_msg_notificationcxx . . $ test_check_msg_notification(bda0d4705bf9b0d0).(&inmessage, error,
235 sizeof(struct sctp_assoc_changecxx . . $ sctp_assoc_change#),
236 SCTP_ASSOC_CHANGEcxx . . $ `<external>/17169092326581286071/sctp.h:666:9`!, SCTP_COMM_UPcxx . . $ SCTP_COMM_UP.);
237 sac = (struct sctp_assoc_changecxx . . $ sctp_assoc_change# *)iov.iov_basecxx . . $ iovec#iov_base.;
238 associd1 = sac->sac_assoc_idcxx . . $ sctp_assoc_change#sac_assoc_id.;
239
240 /* Get the first data message which was sent. */
241 inmessage.msg_controllencxx . . $ msghdr#msg_controllen. = sizeof(incmsg);
242 error = test_recvmsgcxx . . $ test_recvmsg(2284ea468be03a33).(sk2, &inmessage, MSG_WAITALLcxx . . $ `<external>/8962547315054503424/socket.h:230:9`!);
243 test_check_msg_datacxx . . $ test_check_msg_data(87a4c472fd2f0d28).(&inmessage, error, strlencxx . . $ strlen(751346f8406fd082).(messagecxx . . $ message.) + 1,
244 MSG_EORcxx . . $ `<external>/8962547315054503424/socket.h:228:9`!, stream, ppid);
245
246 /* Figure out how big to make our fillmsg */
247 len = sizeof(struct sctp_statuscxx . . $ sctp_status#);
248 memsetcxx . . $ memset(d1de1e4fb215f1c6).(&gstatus,0,sizeof(struct sctp_statuscxx . . $ sctp_status#));
249 gstatus.sstat_assoc_idcxx . . $ sctp_status#sstat_assoc_id. = associd1;
250 error = getsockoptcxx . . $ getsockopt(b79d9f11efef15f9).(sk1, IPPROTO_SCTPcxx . . $ `<external>/9581057695539925927/in.h:87:9`!, SCTP_STATUScxx . . $ `<external>/17169092326581286071/sctp.h:83:9`!, &gstatus, &len);
251
252 if (error)
253 tst_brkmcxx . . $ `src/testlib/sctputil.h:116:9`!(TBROK, tst_exit, "can't get rwnd size: %s",
254 strerror(errnocxx . . $ `<external>/17633486526465735210/errno.h:38:10`!));
255 tst_resmcxx . . $ `src/testlib/sctputil.h:123:9`!(TINFO, "Creating fillmsg of size %d",
256 gstatus.sstat_rwnd+RWND_SLOPcxx . . $ `src/func_tests/test_timetolive.c:82:9`!);
257 fillmsgcxx . . $ fillmsg. = test_malloccxx . . $ test_malloc(bfcfa4d6b7f7ef64).(gstatus.sstat_rwndcxx . . $ sctp_status#sstat_rwnd.+RWND_SLOPcxx . . $ `src/func_tests/test_timetolive.c:82:9`!);
258
259 /* Send a fillmsg */
260 outmessage.msg_controllencxx . . $ msghdr#msg_controllen. = sizeof(outcmsg);
261 outmessage.msg_flagscxx . . $ msghdr#msg_flags. = 0;
262 cmsg = CMSG_FIRSTHDRcxx . . $ `<external>/8962547315054503424/socket.h:304:9`!(&outmessage);
263 cmsg->cmsg_levelcxx . . $ cmsghdr#cmsg_level. = IPPROTO_SCTPcxx . . $ `<external>/9581057695539925927/in.h:87:9`!;
264 cmsg->cmsg_typecxx . . $ cmsghdr#cmsg_type. = SCTP_SNDRCVcxx . . $ `<external>/17169092326581286071/sctp.h:333:9`!;
265 cmsg->cmsg_lencxx . . $ cmsghdr#cmsg_len. = CMSG_LENcxx . . $ `<external>/8962547315054503424/socket.h:311:9`!(sizeof(struct sctp_sndrcvinfo));
266 outmessage.msg_controllencxx . . $ msghdr#msg_controllen. = cmsg->cmsg_lencxx . . $ cmsghdr#cmsg_len.;
267 sinfo = (struct sctp_sndrcvinfocxx . . $ sctp_sndrcvinfo# *)CMSG_DATAcxx . . $ `<external>/8962547315054503424/socket.h:299:10`!(cmsg);
268 memsetcxx . . $ memset(d1de1e4fb215f1c6).(sinfo, 0x00, sizeof(struct sctp_sndrcvinfocxx . . $ sctp_sndrcvinfo#));
269 ppid++;
270 stream++;
271 sinfo->sinfo_ppidcxx . . $ sctp_sndrcvinfo#sinfo_ppid. = ppid;
272 sinfo->sinfo_streamcxx . . $ sctp_sndrcvinfo#sinfo_stream. = stream;
273 memsetcxx . . $ memset(d1de1e4fb215f1c6).(fillmsgcxx . . $ fillmsg., 'X', gstatus.sstat_rwndcxx . . $ sctp_status#sstat_rwnd.+RWND_SLOPcxx . . $ `src/func_tests/test_timetolive.c:82:9`!);
274 fillmsgcxx . . $ fillmsg.[gstatus.sstat_rwndcxx . . $ sctp_status#sstat_rwnd.+RWND_SLOPcxx . . $ `src/func_tests/test_timetolive.c:82:9`!-1] = '\0';
275 outmessage.msg_iovcxx . . $ msghdr#msg_iov.->iov_basecxx . . $ iovec#iov_base. = fillmsgcxx . . $ fillmsg.;
276 outmessage.msg_iovcxx . . $ msghdr#msg_iov.->iov_lencxx . . $ iovec#iov_len. = gstatus.sstat_rwndcxx . . $ sctp_status#sstat_rwnd.+RWND_SLOPcxx . . $ `src/func_tests/test_timetolive.c:82:9`!;
277 outmessage.msg_namecxx . . $ msghdr#msg_name. = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!;
278 outmessage.msg_namelencxx . . $ msghdr#msg_namelen. = 0;
279 sinfo->sinfo_assoc_idcxx . . $ sctp_sndrcvinfo#sinfo_assoc_id. = associd1;
280 sinfo->sinfo_timetolivecxx . . $ sctp_sndrcvinfo#sinfo_timetolive. = 0;
281 test_sendmsgcxx . . $ test_sendmsg(c45a39c477f473e).(sk1, &outmessage, MSG_NOSIGNALcxx . . $ `<external>/8962547315054503424/socket.h:242:9`!,
282 gstatus.sstat_rwndcxx . . $ sctp_status#sstat_rwnd.+RWND_SLOPcxx . . $ `src/func_tests/test_timetolive.c:82:9`!);
283
284 /* Now send the message with timeout. */
285 sinfo->sinfo_ppidcxx . . $ sctp_sndrcvinfo#sinfo_ppid. = ppid;
286 sinfo->sinfo_streamcxx . . $ sctp_sndrcvinfo#sinfo_stream. = stream;
287 outmessage.msg_iovcxx . . $ msghdr#msg_iov.->iov_basecxx . . $ iovec#iov_base. = ttlmsgcxx . . $ ttlmsg.;
288 outmessage.msg_iovcxx . . $ msghdr#msg_iov.->iov_lencxx . . $ iovec#iov_len. = strlencxx . . $ strlen(751346f8406fd082).(ttlmsgcxx . . $ ttlmsg.) + 1;
289 outmessage.msg_namecxx . . $ msghdr#msg_name. = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!;
290 outmessage.msg_namelencxx . . $ msghdr#msg_namelen. = 0;
291 sinfo->sinfo_assoc_idcxx . . $ sctp_sndrcvinfo#sinfo_assoc_id. = associd1;
292 sinfo->sinfo_timetolivecxx . . $ sctp_sndrcvinfo#sinfo_timetolive. = 2000;
293 test_sendmsgcxx . . $ test_sendmsg(c45a39c477f473e).(sk1, &outmessage, MSG_NOSIGNALcxx . . $ `<external>/8962547315054503424/socket.h:242:9`!, strlencxx . . $ strlen(751346f8406fd082).(ttlmsgcxx . . $ ttlmsg.) + 1);
294
295 tst_resmcxx . . $ `src/testlib/sctputil.h:123:9`!(TPASS, "Send a message with timeout");
296
297 /* Next send a message with no timeout. */
298 sinfo->sinfo_ppidcxx . . $ sctp_sndrcvinfo#sinfo_ppid. = ppid;
299 sinfo->sinfo_streamcxx . . $ sctp_sndrcvinfo#sinfo_stream. = stream;
300 outmessage.msg_iovcxx . . $ msghdr#msg_iov.->iov_basecxx . . $ iovec#iov_base. = nottlmsgcxx . . $ nottlmsg.;
301 outmessage.msg_iovcxx . . $ msghdr#msg_iov.->iov_lencxx . . $ iovec#iov_len. = strlencxx . . $ strlen(751346f8406fd082).(nottlmsgcxx . . $ nottlmsg.) + 1;
302 outmessage.msg_namecxx . . $ msghdr#msg_name. = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!;
303 outmessage.msg_namelencxx . . $ msghdr#msg_namelen. = 0;
304 sinfo->sinfo_assoc_idcxx . . $ sctp_sndrcvinfo#sinfo_assoc_id. = associd1;
305 sinfo->sinfo_timetolivecxx . . $ sctp_sndrcvinfo#sinfo_timetolive. = 0;
306 test_sendmsgcxx . . $ test_sendmsg(c45a39c477f473e).(sk1, &outmessage, MSG_NOSIGNALcxx . . $ `<external>/8962547315054503424/socket.h:242:9`!, strlencxx . . $ strlen(751346f8406fd082).(nottlmsgcxx . . $ nottlmsg.)+1);
307
308 tst_resmcxx . . $ `src/testlib/sctputil.h:123:9`!(TPASS, "Send a message with no timeout");
309
310 /* And finally a fragmented message that will time out. */
311 sinfo->sinfo_ppidcxx . . $ sctp_sndrcvinfo#sinfo_ppid. = ppid;
312 sinfo->sinfo_streamcxx . . $ sctp_sndrcvinfo#sinfo_stream. = stream;
313 memsetcxx . . $ memset(d1de1e4fb215f1c6).(ttlfragcxx . . $ ttlfrag., 48, sizeof(ttlfragcxx . . $ ttlfrag.)); /* 48 is the ascii of '0' */
314 ttlfragcxx . . $ ttlfrag.[sizeof(ttlfragcxx . . $ ttlfrag.)-1] = '\0';
315 outmessage.msg_iovcxx . . $ msghdr#msg_iov.->iov_basecxx . . $ iovec#iov_base. = ttlfragcxx . . $ ttlfrag.;
316 outmessage.msg_iovcxx . . $ msghdr#msg_iov.->iov_lencxx . . $ iovec#iov_len. = sizeof(ttlfragcxx . . $ ttlfrag.);
317 outmessage.msg_namecxx . . $ msghdr#msg_name. = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!;
318 outmessage.msg_namelencxx . . $ msghdr#msg_namelen. = 0;
319 sinfo->sinfo_assoc_idcxx . . $ sctp_sndrcvinfo#sinfo_assoc_id. = associd1;
320 sinfo->sinfo_timetolivecxx . . $ sctp_sndrcvinfo#sinfo_timetolive. = 2000;
321 test_sendmsgcxx . . $ test_sendmsg(c45a39c477f473e).(sk1, &outmessage, MSG_NOSIGNALcxx . . $ `<external>/8962547315054503424/socket.h:242:9`!, sizeof(ttlfragcxx . . $ ttlfrag.));
322
323 tst_resmcxx . . $ `src/testlib/sctputil.h:123:9`!(TPASS, "Send a fragmented message with timeout");
324
325 /* Sleep waiting for the message to time out. */
326 tst_resmcxx . . $ `src/testlib/sctputil.h:123:9`!(TINFO, " ** SLEEPING for 3 seconds **");
327 sleepcxx . . $ sleep(2141b656ce2cc063).(3);
328
329 /* Read the fillmsg snuck in between the ttl'd messages. */
330 do {
331 inmessage.msg_controllencxx . . $ msghdr#msg_controllen. = sizeof(incmsg);
332 error = test_recvmsgcxx . . $ test_recvmsg(2284ea468be03a33).(sk2, &inmessage, MSG_WAITALLcxx . . $ `<external>/8962547315054503424/socket.h:230:9`!);
333 } while (!(inmessage.msg_flagscxx . . $ msghdr#msg_flags. & MSG_EORcxx . . $ `<external>/8962547315054503424/socket.h:228:9`!));
334
335 /* Now get the message that did NOT time out. */
336 inmessage.msg_controllencxx . . $ msghdr#msg_controllen. = sizeof(incmsg);
337 error = test_recvmsgcxx . . $ test_recvmsg(2284ea468be03a33).(sk2, &inmessage, MSG_WAITALLcxx . . $ `<external>/8962547315054503424/socket.h:230:9`!);
338 test_check_msg_datacxx . . $ test_check_msg_data(87a4c472fd2f0d28).(&inmessage, error, strlencxx . . $ strlen(751346f8406fd082).(nottlmsgcxx . . $ nottlmsg.) + 1,
339 MSG_EORcxx . . $ `<external>/8962547315054503424/socket.h:228:9`!, stream, ppid);
340 if (0 != strncmpcxx . . $ strncmp(fd278af2f295fa2e).(iov.iov_basecxx . . $ iovec#iov_base., nottlmsgcxx . . $ nottlmsg., strlencxx . . $ strlen(751346f8406fd082).(nottlmsgcxx . . $ nottlmsg.)+1))
341 tst_brkmcxx . . $ `src/testlib/sctputil.h:116:9`!(TBROK, tst_exit, "Received Wrong Message !!!");
342
343 tst_resmcxx . . $ `src/testlib/sctputil.h:123:9`!(TPASS, "Receive message with no timeout");
344
345 /* Get the SEND_FAILED notification for the message that DID
346 * time out.
347 */
348 inmessage.msg_controllencxx . . $ msghdr#msg_controllen. = sizeof(incmsg);
349 error = test_recvmsgcxx . . $ test_recvmsg(2284ea468be03a33).(sk1, &inmessage, MSG_WAITALLcxx . . $ `<external>/8962547315054503424/socket.h:230:9`!);
350 test_check_msg_notificationcxx . . $ test_check_msg_notification(bda0d4705bf9b0d0).(&inmessage, error,
351 sizeof(struct sctp_send_failedcxx . . $ sctp_send_failed#) +
352 strlencxx . . $ strlen(751346f8406fd082).(ttlmsgcxx . . $ ttlmsg.) + 1,
353 SCTP_SEND_FAILEDcxx . . $ `<external>/17169092326581286071/sctp.h:670:9`!, 0);
354 ssf = (struct sctp_send_failedcxx . . $ sctp_send_failed# *)iov.iov_basecxx . . $ iovec#iov_base.;
355 if (0 != strncmpcxx . . $ strncmp(fd278af2f295fa2e).(ttlmsgcxx . . $ ttlmsg., (char *)ssf->ssf_datacxx . . $ sctp_send_failed#ssf_data., strlencxx . . $ strlen(751346f8406fd082).(ttlmsgcxx . . $ ttlmsg.) + 1))
356 tst_brkmcxx . . $ `src/testlib/sctputil.h:116:9`!(TBROK, tst_exit, "SEND_FAILED data mismatch");
357
358 tst_resmcxx . . $ `src/testlib/sctputil.h:123:9`!(TPASS, "Receive SEND_FAILED for message with timeout");
359
360 /* Get the SEND_FAILED notification for the fragmented message that
361 * DID time out.
362 */
363 offset = 0;
364 do {
365 inmessage.msg_controllencxx . . $ msghdr#msg_controllen. = sizeof(incmsg);
366 error = test_recvmsgcxx . . $ test_recvmsg(2284ea468be03a33).(sk1, &inmessage, MSG_WAITALLcxx . . $ `<external>/8962547315054503424/socket.h:230:9`!);
367 test_check_msg_notificationcxx . . $ test_check_msg_notification(bda0d4705bf9b0d0).(&inmessage, error,
368 sizeof(struct sctp_send_failedcxx . . $ sctp_send_failed#) +
369 SMALL_MAXSEGcxx . . $ `src/func_tests/test_timetolive.c:79:9`!,
370 SCTP_SEND_FAILEDcxx . . $ `<external>/17169092326581286071/sctp.h:670:9`!, 0);
371 ssf = (struct sctp_send_failedcxx . . $ sctp_send_failed# *)iov.iov_basecxx . . $ iovec#iov_base.;
372 if (0 != strncmpcxx . . $ strncmp(fd278af2f295fa2e).(&ttlfragcxx . . $ ttlfrag.[offset], (char *)ssf->ssf_datacxx . . $ sctp_send_failed#ssf_data.,
373 SMALL_MAXSEGcxx . . $ `src/func_tests/test_timetolive.c:79:9`!))
374 tst_brkmcxx . . $ `src/testlib/sctputil.h:116:9`!(TBROK, tst_exit, "SEND_FAILED data mismatch");
375 offset += SMALL_MAXSEGcxx . . $ `src/func_tests/test_timetolive.c:79:9`!;
376 } while (!(ssf->ssf_infocxx . . $ sctp_send_failed#ssf_info..sinfo_flagscxx . . $ sctp_sndrcvinfo#sinfo_flags. & 0x01)); /* LAST_FRAG */
377
378 tst_resmcxx . . $ `src/testlib/sctputil.h:123:9`!(TPASS, "Receive SEND_FAILED for fragmented message with "
379 "timeout");
380
381 /* Shut down the link. */
382 closecxx . . $ close(7864480464b09eea).(sk1);
383
384 /* Get the shutdown complete notification. */
385 inmessage.msg_controllencxx . . $ msghdr#msg_controllen. = sizeof(incmsg);
386 error = test_recvmsgcxx . . $ test_recvmsg(2284ea468be03a33).(sk2, &inmessage, MSG_WAITALLcxx . . $ `<external>/8962547315054503424/socket.h:230:9`!);
387 test_check_msg_notificationcxx . . $ test_check_msg_notification(bda0d4705bf9b0d0).(&inmessage, error,
388 sizeof(struct sctp_assoc_changecxx . . $ sctp_assoc_change#),
389 SCTP_ASSOC_CHANGEcxx . . $ `<external>/17169092326581286071/sctp.h:666:9`!, SCTP_SHUTDOWN_COMPcxx . . $ SCTP_SHUTDOWN_COMP.);
390
391 closecxx . . $ close(7864480464b09eea).(sk2);
392
393 freecxx . . $ free(5d22bdacc48458e8).(big_buffer);
394 freecxx . . $ free(5d22bdacc48458e8).(fillmsgcxx . . $ fillmsg.);
395 /* Indicate successful completion. */
396 return 0;
397 }