Debian Codegraph @

usrsctplib/netinet/sctp_output.c

raw symbols ◀ ▶ SCIP
1 Debian patch touch this file
1 /*-
2 * SPDX-License-Identifier: BSD-3-Clause
3 *
4 * Copyright (c) 2001-2008, by Cisco Systems, Inc. All rights reserved.
5 * Copyright (c) 2008-2012, by Randall Stewart. All rights reserved.
6 * Copyright (c) 2008-2012, by Michael Tuexen. All rights reserved.
7 *
8 * Redistribution and use in source and binary forms, with or without
9 * modification, are permitted provided that the following conditions are met:
10 *
11 * a) Redistributions of source code must retain the above copyright notice,
12 * this list of conditions and the following disclaimer.
13 *
14 * b) Redistributions in binary form must reproduce the above copyright
15 * notice, this list of conditions and the following disclaimer in
16 * the documentation and/or other materials provided with the distribution.
17 *
18 * c) Neither the name of Cisco Systems, Inc. nor the names of its
19 * contributors may be used to endorse or promote products derived
20 * from this software without specific prior written permission.
21 *
22 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
23 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
24 * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
25 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
26 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
27 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
28 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
29 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
30 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
31 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
32 * THE POSSIBILITY OF SUCH DAMAGE.
33 */
34
35 #if defined(__FreeBSD__) && !defined(__Userspace__cxx . . $ `<built-in>:442:9`!)
36 #include <sys/cdefs.h>
37 __FBSDID("$FreeBSD$");
38 #endif
39
40 #include <netinet/sctp_os.h>cxx . . $ `<file>/usrsctplib/netinet/sctp_os.h`/
41 #if defined(__FreeBSD__) && !defined(__Userspace__cxx . . $ `<built-in>:442:9`!)
42 #include <sys/proc.h>
43 #endif
44 #include <netinet/sctp_var.h>cxx . . $ `<file>/usrsctplib/netinet/sctp_var.h`/
45 #include <netinet/sctp_sysctl.h>cxx . . $ `<file>/usrsctplib/netinet/sctp_sysctl.h`/
46 #include <netinet/sctp_header.h>cxx . . $ `<file>/usrsctplib/netinet/sctp_header.h`/
47 #include <netinet/sctp_pcb.h>cxx . . $ `<file>/usrsctplib/netinet/sctp_pcb.h`/
48 #include <netinet/sctputil.h>cxx . . $ `<file>/usrsctplib/netinet/sctputil.h`/
49 #include <netinet/sctp_output.h>cxx . . $ `<file>/usrsctplib/netinet/sctp_output.h`/
50 #include <netinet/sctp_uio.h>cxx . . $ `<file>/usrsctplib/netinet/sctp_uio.h`/
51 #include <netinet/sctputil.h>cxx . . $ `<file>/usrsctplib/netinet/sctputil.h`/
52 #include <netinet/sctp_auth.h>cxx . . $ `<file>/usrsctplib/netinet/sctp_auth.h`/
53 #include <netinet/sctp_timer.h>cxx . . $ `<file>/usrsctplib/netinet/sctp_timer.h`/
54 #include <netinet/sctp_asconf.h>cxx . . $ `<file>/usrsctplib/netinet/sctp_asconf.h`/
55 #include <netinet/sctp_indata.h>cxx . . $ `<file>/usrsctplib/netinet/sctp_indata.h`/
56 #include <netinet/sctp_bsd_addr.h>cxx . . $ `<file>/usrsctplib/netinet/sctp_bsd_addr.h`/
57 #include <netinet/sctp_input.h>cxx . . $ `<file>/usrsctplib/netinet/sctp_input.h`/
58 #include <netinet/sctp_crc32.h>cxx . . $ `<file>/usrsctplib/netinet/sctp_crc32.h`/
59 #if defined(__FreeBSD__) && !defined(__Userspace__cxx . . $ `<built-in>:442:9`!)
60 #include <netinet/sctp_kdtrace.h>
61 #endif
62 #if defined(__linux__cxx . . $ `<built-in>:397:9`!)
63 #define __FAVOR_BSDcxx . . $ `usrsctplib/netinet/sctp_output.c:63:9`! /* (on Ubuntu at least) enables UDP header field names like BSD in RFC 768 */
64 #endif
65 #if defined(INETcxx . . $ `<built-in>:431:9`!) || defined(INET6cxx . . $ `<built-in>:432:9`!)
66 #if !defined(_WIN32)
67 #include <netinet/udp.h>
68 #endif
69 #endif
70 #if !defined(__Userspace__cxx . . $ `<built-in>:442:9`!)
71 #if defined(__APPLE__)
72 #include <netinet/in.h>
73 #endif
74 #if defined(__FreeBSD__) && !defined(__Userspace__)
75 #include <netinet/udp_var.h>
76 #include <machine/in_cksum.h>
77 #endif
78 #endif
79 #if defined(__Userspace__cxx . . $ `<built-in>:442:9`!) && defined(INET6cxx . . $ `<built-in>:432:9`!)
80 #include <netinet6/sctp6_var.h>cxx . . $ `<file>/usrsctplib/netinet6/sctp6_var.h`/
81 #endif
82 #if defined(__APPLE__) && !defined(__Userspace__cxx . . $ `<built-in>:442:9`!)
83 #if !(defined(APPLE_LEOPARD) || defined(APPLE_SNOWLEOPARD))
84 #define SCTP_MAX_LINKHDR 16
85 #endif
86 #endif
87
88 #define SCTP_MAX_GAPS_INARRAYcxx . . $ `usrsctplib/netinet/sctp_output.c:88:9`! 4
89 struct sack_trackcxx . . $ sack_track# {
90 uint8_tcxx . . $ uint8_t# right_edgecxx . . $ sack_track#right_edge.; /* mergable on the right edge */
91 uint8_tcxx . . $ uint8_t# left_edgecxx . . $ sack_track#left_edge.; /* mergable on the left edge */
92 uint8_tcxx . . $ uint8_t# num_entriescxx . . $ sack_track#num_entries.;
93 uint8_tcxx . . $ uint8_t# sparecxx . . $ sack_track#spare.;
94 struct sctp_gap_ack_blockcxx . . $ sctp_gap_ack_block# gapscxx . . $ sack_track#gaps.[SCTP_MAX_GAPS_INARRAYcxx . . $ `usrsctplib/netinet/sctp_output.c:88:9`!];
95 };
96
97 const struct sack_trackcxx . . $ sack_track# sack_arraycxx . . $ sack_array.[256] = {
98 {0, 0, 0, 0, /* 0x00 */
99 {{0, 0},
100 {0, 0},
101 {0, 0},
102 {0, 0}
103 }
104 },
105 {1, 0, 1, 0, /* 0x01 */
106 {{0, 0},
107 {0, 0},
108 {0, 0},
109 {0, 0}
110 }
111 },
112 {0, 0, 1, 0, /* 0x02 */
113 {{1, 1},
114 {0, 0},
115 {0, 0},
116 {0, 0}
117 }
118 },
119 {1, 0, 1, 0, /* 0x03 */
120 {{0, 1},
121 {0, 0},
122 {0, 0},
123 {0, 0}
124 }
125 },
126 {0, 0, 1, 0, /* 0x04 */
127 {{2, 2},
128 {0, 0},
129 {0, 0},
130 {0, 0}
131 }
132 },
133 {1, 0, 2, 0, /* 0x05 */
134 {{0, 0},
135 {2, 2},
136 {0, 0},
137 {0, 0}
138 }
139 },
140 {0, 0, 1, 0, /* 0x06 */
141 {{1, 2},
142 {0, 0},
143 {0, 0},
144 {0, 0}
145 }
146 },
147 {1, 0, 1, 0, /* 0x07 */
148 {{0, 2},
149 {0, 0},
150 {0, 0},
151 {0, 0}
152 }
153 },
154 {0, 0, 1, 0, /* 0x08 */
155 {{3, 3},
156 {0, 0},
157 {0, 0},
158 {0, 0}
159 }
160 },
161 {1, 0, 2, 0, /* 0x09 */
162 {{0, 0},
163 {3, 3},
164 {0, 0},
165 {0, 0}
166 }
167 },
168 {0, 0, 2, 0, /* 0x0a */
169 {{1, 1},
170 {3, 3},
171 {0, 0},
172 {0, 0}
173 }
174 },
175 {1, 0, 2, 0, /* 0x0b */
176 {{0, 1},
177 {3, 3},
178 {0, 0},
179 {0, 0}
180 }
181 },
182 {0, 0, 1, 0, /* 0x0c */
183 {{2, 3},
184 {0, 0},
185 {0, 0},
186 {0, 0}
187 }
188 },
189 {1, 0, 2, 0, /* 0x0d */
190 {{0, 0},
191 {2, 3},
192 {0, 0},
193 {0, 0}
194 }
195 },
196 {0, 0, 1, 0, /* 0x0e */
197 {{1, 3},
198 {0, 0},
199 {0, 0},
200 {0, 0}
201 }
202 },
203 {1, 0, 1, 0, /* 0x0f */
204 {{0, 3},
205 {0, 0},
206 {0, 0},
207 {0, 0}
208 }
209 },
210 {0, 0, 1, 0, /* 0x10 */
211 {{4, 4},
212 {0, 0},
213 {0, 0},
214 {0, 0}
215 }
216 },
217 {1, 0, 2, 0, /* 0x11 */
218 {{0, 0},
219 {4, 4},
220 {0, 0},
221 {0, 0}
222 }
223 },
224 {0, 0, 2, 0, /* 0x12 */
225 {{1, 1},
226 {4, 4},
227 {0, 0},
228 {0, 0}
229 }
230 },
231 {1, 0, 2, 0, /* 0x13 */
232 {{0, 1},
233 {4, 4},
234 {0, 0},
235 {0, 0}
236 }
237 },
238 {0, 0, 2, 0, /* 0x14 */
239 {{2, 2},
240 {4, 4},
241 {0, 0},
242 {0, 0}
243 }
244 },
245 {1, 0, 3, 0, /* 0x15 */
246 {{0, 0},
247 {2, 2},
248 {4, 4},
249 {0, 0}
250 }
251 },
252 {0, 0, 2, 0, /* 0x16 */
253 {{1, 2},
254 {4, 4},
255 {0, 0},
256 {0, 0}
257 }
258 },
259 {1, 0, 2, 0, /* 0x17 */
260 {{0, 2},
261 {4, 4},
262 {0, 0},
263 {0, 0}
264 }
265 },
266 {0, 0, 1, 0, /* 0x18 */
267 {{3, 4},
268 {0, 0},
269 {0, 0},
270 {0, 0}
271 }
272 },
273 {1, 0, 2, 0, /* 0x19 */
274 {{0, 0},
275 {3, 4},
276 {0, 0},
277 {0, 0}
278 }
279 },
280 {0, 0, 2, 0, /* 0x1a */
281 {{1, 1},
282 {3, 4},
283 {0, 0},
284 {0, 0}
285 }
286 },
287 {1, 0, 2, 0, /* 0x1b */
288 {{0, 1},
289 {3, 4},
290 {0, 0},
291 {0, 0}
292 }
293 },
294 {0, 0, 1, 0, /* 0x1c */
295 {{2, 4},
296 {0, 0},
297 {0, 0},
298 {0, 0}
299 }
300 },
301 {1, 0, 2, 0, /* 0x1d */
302 {{0, 0},
303 {2, 4},
304 {0, 0},
305 {0, 0}
306 }
307 },
308 {0, 0, 1, 0, /* 0x1e */
309 {{1, 4},
310 {0, 0},
311 {0, 0},
312 {0, 0}
313 }
314 },
315 {1, 0, 1, 0, /* 0x1f */
316 {{0, 4},
317 {0, 0},
318 {0, 0},
319 {0, 0}
320 }
321 },
322 {0, 0, 1, 0, /* 0x20 */
323 {{5, 5},
324 {0, 0},
325 {0, 0},
326 {0, 0}
327 }
328 },
329 {1, 0, 2, 0, /* 0x21 */
330 {{0, 0},
331 {5, 5},
332 {0, 0},
333 {0, 0}
334 }
335 },
336 {0, 0, 2, 0, /* 0x22 */
337 {{1, 1},
338 {5, 5},
339 {0, 0},
340 {0, 0}
341 }
342 },
343 {1, 0, 2, 0, /* 0x23 */
344 {{0, 1},
345 {5, 5},
346 {0, 0},
347 {0, 0}
348 }
349 },
350 {0, 0, 2, 0, /* 0x24 */
351 {{2, 2},
352 {5, 5},
353 {0, 0},
354 {0, 0}
355 }
356 },
357 {1, 0, 3, 0, /* 0x25 */
358 {{0, 0},
359 {2, 2},
360 {5, 5},
361 {0, 0}
362 }
363 },
364 {0, 0, 2, 0, /* 0x26 */
365 {{1, 2},
366 {5, 5},
367 {0, 0},
368 {0, 0}
369 }
370 },
371 {1, 0, 2, 0, /* 0x27 */
372 {{0, 2},
373 {5, 5},
374 {0, 0},
375 {0, 0}
376 }
377 },
378 {0, 0, 2, 0, /* 0x28 */
379 {{3, 3},
380 {5, 5},
381 {0, 0},
382 {0, 0}
383 }
384 },
385 {1, 0, 3, 0, /* 0x29 */
386 {{0, 0},
387 {3, 3},
388 {5, 5},
389 {0, 0}
390 }
391 },
392 {0, 0, 3, 0, /* 0x2a */
393 {{1, 1},
394 {3, 3},
395 {5, 5},
396 {0, 0}
397 }
398 },
399 {1, 0, 3, 0, /* 0x2b */
400 {{0, 1},
401 {3, 3},
402 {5, 5},
403 {0, 0}
404 }
405 },
406 {0, 0, 2, 0, /* 0x2c */
407 {{2, 3},
408 {5, 5},
409 {0, 0},
410 {0, 0}
411 }
412 },
413 {1, 0, 3, 0, /* 0x2d */
414 {{0, 0},
415 {2, 3},
416 {5, 5},
417 {0, 0}
418 }
419 },
420 {0, 0, 2, 0, /* 0x2e */
421 {{1, 3},
422 {5, 5},
423 {0, 0},
424 {0, 0}
425 }
426 },
427 {1, 0, 2, 0, /* 0x2f */
428 {{0, 3},
429 {5, 5},
430 {0, 0},
431 {0, 0}
432 }
433 },
434 {0, 0, 1, 0, /* 0x30 */
435 {{4, 5},
436 {0, 0},
437 {0, 0},
438 {0, 0}
439 }
440 },
441 {1, 0, 2, 0, /* 0x31 */
442 {{0, 0},
443 {4, 5},
444 {0, 0},
445 {0, 0}
446 }
447 },
448 {0, 0, 2, 0, /* 0x32 */
449 {{1, 1},
450 {4, 5},
451 {0, 0},
452 {0, 0}
453 }
454 },
455 {1, 0, 2, 0, /* 0x33 */
456 {{0, 1},
457 {4, 5},
458 {0, 0},
459 {0, 0}
460 }
461 },
462 {0, 0, 2, 0, /* 0x34 */
463 {{2, 2},
464 {4, 5},
465 {0, 0},
466 {0, 0}
467 }
468 },
469 {1, 0, 3, 0, /* 0x35 */
470 {{0, 0},
471 {2, 2},
472 {4, 5},
473 {0, 0}
474 }
475 },
476 {0, 0, 2, 0, /* 0x36 */
477 {{1, 2},
478 {4, 5},
479 {0, 0},
480 {0, 0}
481 }
482 },
483 {1, 0, 2, 0, /* 0x37 */
484 {{0, 2},
485 {4, 5},
486 {0, 0},
487 {0, 0}
488 }
489 },
490 {0, 0, 1, 0, /* 0x38 */
491 {{3, 5},
492 {0, 0},
493 {0, 0},
494 {0, 0}
495 }
496 },
497 {1, 0, 2, 0, /* 0x39 */
498 {{0, 0},
499 {3, 5},
500 {0, 0},
501 {0, 0}
502 }
503 },
504 {0, 0, 2, 0, /* 0x3a */
505 {{1, 1},
506 {3, 5},
507 {0, 0},
508 {0, 0}
509 }
510 },
511 {1, 0, 2, 0, /* 0x3b */
512 {{0, 1},
513 {3, 5},
514 {0, 0},
515 {0, 0}
516 }
517 },
518 {0, 0, 1, 0, /* 0x3c */
519 {{2, 5},
520 {0, 0},
521 {0, 0},
522 {0, 0}
523 }
524 },
525 {1, 0, 2, 0, /* 0x3d */
526 {{0, 0},
527 {2, 5},
528 {0, 0},
529 {0, 0}
530 }
531 },
532 {0, 0, 1, 0, /* 0x3e */
533 {{1, 5},
534 {0, 0},
535 {0, 0},
536 {0, 0}
537 }
538 },
539 {1, 0, 1, 0, /* 0x3f */
540 {{0, 5},
541 {0, 0},
542 {0, 0},
543 {0, 0}
544 }
545 },
546 {0, 0, 1, 0, /* 0x40 */
547 {{6, 6},
548 {0, 0},
549 {0, 0},
550 {0, 0}
551 }
552 },
553 {1, 0, 2, 0, /* 0x41 */
554 {{0, 0},
555 {6, 6},
556 {0, 0},
557 {0, 0}
558 }
559 },
560 {0, 0, 2, 0, /* 0x42 */
561 {{1, 1},
562 {6, 6},
563 {0, 0},
564 {0, 0}
565 }
566 },
567 {1, 0, 2, 0, /* 0x43 */
568 {{0, 1},
569 {6, 6},
570 {0, 0},
571 {0, 0}
572 }
573 },
574 {0, 0, 2, 0, /* 0x44 */
575 {{2, 2},
576 {6, 6},
577 {0, 0},
578 {0, 0}
579 }
580 },
581 {1, 0, 3, 0, /* 0x45 */
582 {{0, 0},
583 {2, 2},
584 {6, 6},
585 {0, 0}
586 }
587 },
588 {0, 0, 2, 0, /* 0x46 */
589 {{1, 2},
590 {6, 6},
591 {0, 0},
592 {0, 0}
593 }
594 },
595 {1, 0, 2, 0, /* 0x47 */
596 {{0, 2},
597 {6, 6},
598 {0, 0},
599 {0, 0}
600 }
601 },
602 {0, 0, 2, 0, /* 0x48 */
603 {{3, 3},
604 {6, 6},
605 {0, 0},
606 {0, 0}
607 }
608 },
609 {1, 0, 3, 0, /* 0x49 */
610 {{0, 0},
611 {3, 3},
612 {6, 6},
613 {0, 0}
614 }
615 },
616 {0, 0, 3, 0, /* 0x4a */
617 {{1, 1},
618 {3, 3},
619 {6, 6},
620 {0, 0}
621 }
622 },
623 {1, 0, 3, 0, /* 0x4b */
624 {{0, 1},
625 {3, 3},
626 {6, 6},
627 {0, 0}
628 }
629 },
630 {0, 0, 2, 0, /* 0x4c */
631 {{2, 3},
632 {6, 6},
633 {0, 0},
634 {0, 0}
635 }
636 },
637 {1, 0, 3, 0, /* 0x4d */
638 {{0, 0},
639 {2, 3},
640 {6, 6},
641 {0, 0}
642 }
643 },
644 {0, 0, 2, 0, /* 0x4e */
645 {{1, 3},
646 {6, 6},
647 {0, 0},
648 {0, 0}
649 }
650 },
651 {1, 0, 2, 0, /* 0x4f */
652 {{0, 3},
653 {6, 6},
654 {0, 0},
655 {0, 0}
656 }
657 },
658 {0, 0, 2, 0, /* 0x50 */
659 {{4, 4},
660 {6, 6},
661 {0, 0},
662 {0, 0}
663 }
664 },
665 {1, 0, 3, 0, /* 0x51 */
666 {{0, 0},
667 {4, 4},
668 {6, 6},
669 {0, 0}
670 }
671 },
672 {0, 0, 3, 0, /* 0x52 */
673 {{1, 1},
674 {4, 4},
675 {6, 6},
676 {0, 0}
677 }
678 },
679 {1, 0, 3, 0, /* 0x53 */
680 {{0, 1},
681 {4, 4},
682 {6, 6},
683 {0, 0}
684 }
685 },
686 {0, 0, 3, 0, /* 0x54 */
687 {{2, 2},
688 {4, 4},
689 {6, 6},
690 {0, 0}
691 }
692 },
693 {1, 0, 4, 0, /* 0x55 */
694 {{0, 0},
695 {2, 2},
696 {4, 4},
697 {6, 6}
698 }
699 },
700 {0, 0, 3, 0, /* 0x56 */
701 {{1, 2},
702 {4, 4},
703 {6, 6},
704 {0, 0}
705 }
706 },
707 {1, 0, 3, 0, /* 0x57 */
708 {{0, 2},
709 {4, 4},
710 {6, 6},
711 {0, 0}
712 }
713 },
714 {0, 0, 2, 0, /* 0x58 */
715 {{3, 4},
716 {6, 6},
717 {0, 0},
718 {0, 0}
719 }
720 },
721 {1, 0, 3, 0, /* 0x59 */
722 {{0, 0},
723 {3, 4},
724 {6, 6},
725 {0, 0}
726 }
727 },
728 {0, 0, 3, 0, /* 0x5a */
729 {{1, 1},
730 {3, 4},
731 {6, 6},
732 {0, 0}
733 }
734 },
735 {1, 0, 3, 0, /* 0x5b */
736 {{0, 1},
737 {3, 4},
738 {6, 6},
739 {0, 0}
740 }
741 },
742 {0, 0, 2, 0, /* 0x5c */
743 {{2, 4},
744 {6, 6},
745 {0, 0},
746 {0, 0}
747 }
748 },
749 {1, 0, 3, 0, /* 0x5d */
750 {{0, 0},
751 {2, 4},
752 {6, 6},
753 {0, 0}
754 }
755 },
756 {0, 0, 2, 0, /* 0x5e */
757 {{1, 4},
758 {6, 6},
759 {0, 0},
760 {0, 0}
761 }
762 },
763 {1, 0, 2, 0, /* 0x5f */
764 {{0, 4},
765 {6, 6},
766 {0, 0},
767 {0, 0}
768 }
769 },
770 {0, 0, 1, 0, /* 0x60 */
771 {{5, 6},
772 {0, 0},
773 {0, 0},
774 {0, 0}
775 }
776 },
777 {1, 0, 2, 0, /* 0x61 */
778 {{0, 0},
779 {5, 6},
780 {0, 0},
781 {0, 0}
782 }
783 },
784 {0, 0, 2, 0, /* 0x62 */
785 {{1, 1},
786 {5, 6},
787 {0, 0},
788 {0, 0}
789 }
790 },
791 {1, 0, 2, 0, /* 0x63 */
792 {{0, 1},
793 {5, 6},
794 {0, 0},
795 {0, 0}
796 }
797 },
798 {0, 0, 2, 0, /* 0x64 */
799 {{2, 2},
800 {5, 6},
801 {0, 0},
802 {0, 0}
803 }
804 },
805 {1, 0, 3, 0, /* 0x65 */
806 {{0, 0},
807 {2, 2},
808 {5, 6},
809 {0, 0}
810 }
811 },
812 {0, 0, 2, 0, /* 0x66 */
813 {{1, 2},
814 {5, 6},
815 {0, 0},
816 {0, 0}
817 }
818 },
819 {1, 0, 2, 0, /* 0x67 */
820 {{0, 2},
821 {5, 6},
822 {0, 0},
823 {0, 0}
824 }
825 },
826 {0, 0, 2, 0, /* 0x68 */
827 {{3, 3},
828 {5, 6},
829 {0, 0},
830 {0, 0}
831 }
832 },
833 {1, 0, 3, 0, /* 0x69 */
834 {{0, 0},
835 {3, 3},
836 {5, 6},
837 {0, 0}
838 }
839 },
840 {0, 0, 3, 0, /* 0x6a */
841 {{1, 1},
842 {3, 3},
843 {5, 6},
844 {0, 0}
845 }
846 },
847 {1, 0, 3, 0, /* 0x6b */
848 {{0, 1},
849 {3, 3},
850 {5, 6},
851 {0, 0}
852 }
853 },
854 {0, 0, 2, 0, /* 0x6c */
855 {{2, 3},
856 {5, 6},
857 {0, 0},
858 {0, 0}
859 }
860 },
861 {1, 0, 3, 0, /* 0x6d */
862 {{0, 0},
863 {2, 3},
864 {5, 6},
865 {0, 0}
866 }
867 },
868 {0, 0, 2, 0, /* 0x6e */
869 {{1, 3},
870 {5, 6},
871 {0, 0},
872 {0, 0}
873 }
874 },
875 {1, 0, 2, 0, /* 0x6f */
876 {{0, 3},
877 {5, 6},
878 {0, 0},
879 {0, 0}
880 }
881 },
882 {0, 0, 1, 0, /* 0x70 */
883 {{4, 6},
884 {0, 0},
885 {0, 0},
886 {0, 0}
887 }
888 },
889 {1, 0, 2, 0, /* 0x71 */
890 {{0, 0},
891 {4, 6},
892 {0, 0},
893 {0, 0}
894 }
895 },
896 {0, 0, 2, 0, /* 0x72 */
897 {{1, 1},
898 {4, 6},
899 {0, 0},
900 {0, 0}
901 }
902 },
903 {1, 0, 2, 0, /* 0x73 */
904 {{0, 1},
905 {4, 6},
906 {0, 0},
907 {0, 0}
908 }
909 },
910 {0, 0, 2, 0, /* 0x74 */
911 {{2, 2},
912 {4, 6},
913 {0, 0},
914 {0, 0}
915 }
916 },
917 {1, 0, 3, 0, /* 0x75 */
918 {{0, 0},
919 {2, 2},
920 {4, 6},
921 {0, 0}
922 }
923 },
924 {0, 0, 2, 0, /* 0x76 */
925 {{1, 2},
926 {4, 6},
927 {0, 0},
928 {0, 0}
929 }
930 },
931 {1, 0, 2, 0, /* 0x77 */
932 {{0, 2},
933 {4, 6},
934 {0, 0},
935 {0, 0}
936 }
937 },
938 {0, 0, 1, 0, /* 0x78 */
939 {{3, 6},
940 {0, 0},
941 {0, 0},
942 {0, 0}
943 }
944 },
945 {1, 0, 2, 0, /* 0x79 */
946 {{0, 0},
947 {3, 6},
948 {0, 0},
949 {0, 0}
950 }
951 },
952 {0, 0, 2, 0, /* 0x7a */
953 {{1, 1},
954 {3, 6},
955 {0, 0},
956 {0, 0}
957 }
958 },
959 {1, 0, 2, 0, /* 0x7b */
960 {{0, 1},
961 {3, 6},
962 {0, 0},
963 {0, 0}
964 }
965 },
966 {0, 0, 1, 0, /* 0x7c */
967 {{2, 6},
968 {0, 0},
969 {0, 0},
970 {0, 0}
971 }
972 },
973 {1, 0, 2, 0, /* 0x7d */
974 {{0, 0},
975 {2, 6},
976 {0, 0},
977 {0, 0}
978 }
979 },
980 {0, 0, 1, 0, /* 0x7e */
981 {{1, 6},
982 {0, 0},
983 {0, 0},
984 {0, 0}
985 }
986 },
987 {1, 0, 1, 0, /* 0x7f */
988 {{0, 6},
989 {0, 0},
990 {0, 0},
991 {0, 0}
992 }
993 },
994 {0, 1, 1, 0, /* 0x80 */
995 {{7, 7},
996 {0, 0},
997 {0, 0},
998 {0, 0}
999 }
1000 },
1001 {1, 1, 2, 0, /* 0x81 */
1002 {{0, 0},
1003 {7, 7},
1004 {0, 0},
1005 {0, 0}
1006 }
1007 },
1008 {0, 1, 2, 0, /* 0x82 */
1009 {{1, 1},
1010 {7, 7},
1011 {0, 0},
1012 {0, 0}
1013 }
1014 },
1015 {1, 1, 2, 0, /* 0x83 */
1016 {{0, 1},
1017 {7, 7},
1018 {0, 0},
1019 {0, 0}
1020 }
1021 },
1022 {0, 1, 2, 0, /* 0x84 */
1023 {{2, 2},
1024 {7, 7},
1025 {0, 0},
1026 {0, 0}
1027 }
1028 },
1029 {1, 1, 3, 0, /* 0x85 */
1030 {{0, 0},
1031 {2, 2},
1032 {7, 7},
1033 {0, 0}
1034 }
1035 },
1036 {0, 1, 2, 0, /* 0x86 */
1037 {{1, 2},
1038 {7, 7},
1039 {0, 0},
1040 {0, 0}
1041 }
1042 },
1043 {1, 1, 2, 0, /* 0x87 */
1044 {{0, 2},
1045 {7, 7},
1046 {0, 0},
1047 {0, 0}
1048 }
1049 },
1050 {0, 1, 2, 0, /* 0x88 */
1051 {{3, 3},
1052 {7, 7},
1053 {0, 0},
1054 {0, 0}
1055 }
1056 },
1057 {1, 1, 3, 0, /* 0x89 */
1058 {{0, 0},
1059 {3, 3},
1060 {7, 7},
1061 {0, 0}
1062 }
1063 },
1064 {0, 1, 3, 0, /* 0x8a */
1065 {{1, 1},
1066 {3, 3},
1067 {7, 7},
1068 {0, 0}
1069 }
1070 },
1071 {1, 1, 3, 0, /* 0x8b */
1072 {{0, 1},
1073 {3, 3},
1074 {7, 7},
1075 {0, 0}
1076 }
1077 },
1078 {0, 1, 2, 0, /* 0x8c */
1079 {{2, 3},
1080 {7, 7},
1081 {0, 0},
1082 {0, 0}
1083 }
1084 },
1085 {1, 1, 3, 0, /* 0x8d */
1086 {{0, 0},
1087 {2, 3},
1088 {7, 7},
1089 {0, 0}
1090 }
1091 },
1092 {0, 1, 2, 0, /* 0x8e */
1093 {{1, 3},
1094 {7, 7},
1095 {0, 0},
1096 {0, 0}
1097 }
1098 },
1099 {1, 1, 2, 0, /* 0x8f */
1100 {{0, 3},
1101 {7, 7},
1102 {0, 0},
1103 {0, 0}
1104 }
1105 },
1106 {0, 1, 2, 0, /* 0x90 */
1107 {{4, 4},
1108 {7, 7},
1109 {0, 0},
1110 {0, 0}
1111 }
1112 },
1113 {1, 1, 3, 0, /* 0x91 */
1114 {{0, 0},
1115 {4, 4},
1116 {7, 7},
1117 {0, 0}
1118 }
1119 },
1120 {0, 1, 3, 0, /* 0x92 */
1121 {{1, 1},
1122 {4, 4},
1123 {7, 7},
1124 {0, 0}
1125 }
1126 },
1127 {1, 1, 3, 0, /* 0x93 */
1128 {{0, 1},
1129 {4, 4},
1130 {7, 7},
1131 {0, 0}
1132 }
1133 },
1134 {0, 1, 3, 0, /* 0x94 */
1135 {{2, 2},
1136 {4, 4},
1137 {7, 7},
1138 {0, 0}
1139 }
1140 },
1141 {1, 1, 4, 0, /* 0x95 */
1142 {{0, 0},
1143 {2, 2},
1144 {4, 4},
1145 {7, 7}
1146 }
1147 },
1148 {0, 1, 3, 0, /* 0x96 */
1149 {{1, 2},
1150 {4, 4},
1151 {7, 7},
1152 {0, 0}
1153 }
1154 },
1155 {1, 1, 3, 0, /* 0x97 */
1156 {{0, 2},
1157 {4, 4},
1158 {7, 7},
1159 {0, 0}
1160 }
1161 },
1162 {0, 1, 2, 0, /* 0x98 */
1163 {{3, 4},
1164 {7, 7},
1165 {0, 0},
1166 {0, 0}
1167 }
1168 },
1169 {1, 1, 3, 0, /* 0x99 */
1170 {{0, 0},
1171 {3, 4},
1172 {7, 7},
1173 {0, 0}
1174 }
1175 },
1176 {0, 1, 3, 0, /* 0x9a */
1177 {{1, 1},
1178 {3, 4},
1179 {7, 7},
1180 {0, 0}
1181 }
1182 },
1183 {1, 1, 3, 0, /* 0x9b */
1184 {{0, 1},
1185 {3, 4},
1186 {7, 7},
1187 {0, 0}
1188 }
1189 },
1190 {0, 1, 2, 0, /* 0x9c */
1191 {{2, 4},
1192 {7, 7},
1193 {0, 0},
1194 {0, 0}
1195 }
1196 },
1197 {1, 1, 3, 0, /* 0x9d */
1198 {{0, 0},
1199 {2, 4},
1200 {7, 7},
1201 {0, 0}
1202 }
1203 },
1204 {0, 1, 2, 0, /* 0x9e */
1205 {{1, 4},
1206 {7, 7},
1207 {0, 0},
1208 {0, 0}
1209 }
1210 },
1211 {1, 1, 2, 0, /* 0x9f */
1212 {{0, 4},
1213 {7, 7},
1214 {0, 0},
1215 {0, 0}
1216 }
1217 },
1218 {0, 1, 2, 0, /* 0xa0 */
1219 {{5, 5},
1220 {7, 7},
1221 {0, 0},
1222 {0, 0}
1223 }
1224 },
1225 {1, 1, 3, 0, /* 0xa1 */
1226 {{0, 0},
1227 {5, 5},
1228 {7, 7},
1229 {0, 0}
1230 }
1231 },
1232 {0, 1, 3, 0, /* 0xa2 */
1233 {{1, 1},
1234 {5, 5},
1235 {7, 7},
1236 {0, 0}
1237 }
1238 },
1239 {1, 1, 3, 0, /* 0xa3 */
1240 {{0, 1},
1241 {5, 5},
1242 {7, 7},
1243 {0, 0}
1244 }
1245 },
1246 {0, 1, 3, 0, /* 0xa4 */
1247 {{2, 2},
1248 {5, 5},
1249 {7, 7},
1250 {0, 0}
1251 }
1252 },
1253 {1, 1, 4, 0, /* 0xa5 */
1254 {{0, 0},
1255 {2, 2},
1256 {5, 5},
1257 {7, 7}
1258 }
1259 },
1260 {0, 1, 3, 0, /* 0xa6 */
1261 {{1, 2},
1262 {5, 5},
1263 {7, 7},
1264 {0, 0}
1265 }
1266 },
1267 {1, 1, 3, 0, /* 0xa7 */
1268 {{0, 2},
1269 {5, 5},
1270 {7, 7},
1271 {0, 0}
1272 }
1273 },
1274 {0, 1, 3, 0, /* 0xa8 */
1275 {{3, 3},
1276 {5, 5},
1277 {7, 7},
1278 {0, 0}
1279 }
1280 },
1281 {1, 1, 4, 0, /* 0xa9 */
1282 {{0, 0},
1283 {3, 3},
1284 {5, 5},
1285 {7, 7}
1286 }
1287 },
1288 {0, 1, 4, 0, /* 0xaa */
1289 {{1, 1},
1290 {3, 3},
1291 {5, 5},
1292 {7, 7}
1293 }
1294 },
1295 {1, 1, 4, 0, /* 0xab */
1296 {{0, 1},
1297 {3, 3},
1298 {5, 5},
1299 {7, 7}
1300 }
1301 },
1302 {0, 1, 3, 0, /* 0xac */
1303 {{2, 3},
1304 {5, 5},
1305 {7, 7},
1306 {0, 0}
1307 }
1308 },
1309 {1, 1, 4, 0, /* 0xad */
1310 {{0, 0},
1311 {2, 3},
1312 {5, 5},
1313 {7, 7}
1314 }
1315 },
1316 {0, 1, 3, 0, /* 0xae */
1317 {{1, 3},
1318 {5, 5},
1319 {7, 7},
1320 {0, 0}
1321 }
1322 },
1323 {1, 1, 3, 0, /* 0xaf */
1324 {{0, 3},
1325 {5, 5},
1326 {7, 7},
1327 {0, 0}
1328 }
1329 },
1330 {0, 1, 2, 0, /* 0xb0 */
1331 {{4, 5},
1332 {7, 7},
1333 {0, 0},
1334 {0, 0}
1335 }
1336 },
1337 {1, 1, 3, 0, /* 0xb1 */
1338 {{0, 0},
1339 {4, 5},
1340 {7, 7},
1341 {0, 0}
1342 }
1343 },
1344 {0, 1, 3, 0, /* 0xb2 */
1345 {{1, 1},
1346 {4, 5},
1347 {7, 7},
1348 {0, 0}
1349 }
1350 },
1351 {1, 1, 3, 0, /* 0xb3 */
1352 {{0, 1},
1353 {4, 5},
1354 {7, 7},
1355 {0, 0}
1356 }
1357 },
1358 {0, 1, 3, 0, /* 0xb4 */
1359 {{2, 2},
1360 {4, 5},
1361 {7, 7},
1362 {0, 0}
1363 }
1364 },
1365 {1, 1, 4, 0, /* 0xb5 */
1366 {{0, 0},
1367 {2, 2},
1368 {4, 5},
1369 {7, 7}
1370 }
1371 },
1372 {0, 1, 3, 0, /* 0xb6 */
1373 {{1, 2},
1374 {4, 5},
1375 {7, 7},
1376 {0, 0}
1377 }
1378 },
1379 {1, 1, 3, 0, /* 0xb7 */
1380 {{0, 2},
1381 {4, 5},
1382 {7, 7},
1383 {0, 0}
1384 }
1385 },
1386 {0, 1, 2, 0, /* 0xb8 */
1387 {{3, 5},
1388 {7, 7},
1389 {0, 0},
1390 {0, 0}
1391 }
1392 },
1393 {1, 1, 3, 0, /* 0xb9 */
1394 {{0, 0},
1395 {3, 5},
1396 {7, 7},
1397 {0, 0}
1398 }
1399 },
1400 {0, 1, 3, 0, /* 0xba */
1401 {{1, 1},
1402 {3, 5},
1403 {7, 7},
1404 {0, 0}
1405 }
1406 },
1407 {1, 1, 3, 0, /* 0xbb */
1408 {{0, 1},
1409 {3, 5},
1410 {7, 7},
1411 {0, 0}
1412 }
1413 },
1414 {0, 1, 2, 0, /* 0xbc */
1415 {{2, 5},
1416 {7, 7},
1417 {0, 0},
1418 {0, 0}
1419 }
1420 },
1421 {1, 1, 3, 0, /* 0xbd */
1422 {{0, 0},
1423 {2, 5},
1424 {7, 7},
1425 {0, 0}
1426 }
1427 },
1428 {0, 1, 2, 0, /* 0xbe */
1429 {{1, 5},
1430 {7, 7},
1431 {0, 0},
1432 {0, 0}
1433 }
1434 },
1435 {1, 1, 2, 0, /* 0xbf */
1436 {{0, 5},
1437 {7, 7},
1438 {0, 0},
1439 {0, 0}
1440 }
1441 },
1442 {0, 1, 1, 0, /* 0xc0 */
1443 {{6, 7},
1444 {0, 0},
1445 {0, 0},
1446 {0, 0}
1447 }
1448 },
1449 {1, 1, 2, 0, /* 0xc1 */
1450 {{0, 0},
1451 {6, 7},
1452 {0, 0},
1453 {0, 0}
1454 }
1455 },
1456 {0, 1, 2, 0, /* 0xc2 */
1457 {{1, 1},
1458 {6, 7},
1459 {0, 0},
1460 {0, 0}
1461 }
1462 },
1463 {1, 1, 2, 0, /* 0xc3 */
1464 {{0, 1},
1465 {6, 7},
1466 {0, 0},
1467 {0, 0}
1468 }
1469 },
1470 {0, 1, 2, 0, /* 0xc4 */
1471 {{2, 2},
1472 {6, 7},
1473 {0, 0},
1474 {0, 0}
1475 }
1476 },
1477 {1, 1, 3, 0, /* 0xc5 */
1478 {{0, 0},
1479 {2, 2},
1480 {6, 7},
1481 {0, 0}
1482 }
1483 },
1484 {0, 1, 2, 0, /* 0xc6 */
1485 {{1, 2},
1486 {6, 7},
1487 {0, 0},
1488 {0, 0}
1489 }
1490 },
1491 {1, 1, 2, 0, /* 0xc7 */
1492 {{0, 2},
1493 {6, 7},
1494 {0, 0},
1495 {0, 0}
1496 }
1497 },
1498 {0, 1, 2, 0, /* 0xc8 */
1499 {{3, 3},
1500 {6, 7},
1501 {0, 0},
1502 {0, 0}
1503 }
1504 },
1505 {1, 1, 3, 0, /* 0xc9 */
1506 {{0, 0},
1507 {3, 3},
1508 {6, 7},
1509 {0, 0}
1510 }
1511 },
1512 {0, 1, 3, 0, /* 0xca */
1513 {{1, 1},
1514 {3, 3},
1515 {6, 7},
1516 {0, 0}
1517 }
1518 },
1519 {1, 1, 3, 0, /* 0xcb */
1520 {{0, 1},
1521 {3, 3},
1522 {6, 7},
1523 {0, 0}
1524 }
1525 },
1526 {0, 1, 2, 0, /* 0xcc */
1527 {{2, 3},
1528 {6, 7},
1529 {0, 0},
1530 {0, 0}
1531 }
1532 },
1533 {1, 1, 3, 0, /* 0xcd */
1534 {{0, 0},
1535 {2, 3},
1536 {6, 7},
1537 {0, 0}
1538 }
1539 },
1540 {0, 1, 2, 0, /* 0xce */
1541 {{1, 3},
1542 {6, 7},
1543 {0, 0},
1544 {0, 0}
1545 }
1546 },
1547 {1, 1, 2, 0, /* 0xcf */
1548 {{0, 3},
1549 {6, 7},
1550 {0, 0},
1551 {0, 0}
1552 }
1553 },
1554 {0, 1, 2, 0, /* 0xd0 */
1555 {{4, 4},
1556 {6, 7},
1557 {0, 0},
1558 {0, 0}
1559 }
1560 },
1561 {1, 1, 3, 0, /* 0xd1 */
1562 {{0, 0},
1563 {4, 4},
1564 {6, 7},
1565 {0, 0}
1566 }
1567 },
1568 {0, 1, 3, 0, /* 0xd2 */
1569 {{1, 1},
1570 {4, 4},
1571 {6, 7},
1572 {0, 0}
1573 }
1574 },
1575 {1, 1, 3, 0, /* 0xd3 */
1576 {{0, 1},
1577 {4, 4},
1578 {6, 7},
1579 {0, 0}
1580 }
1581 },
1582 {0, 1, 3, 0, /* 0xd4 */
1583 {{2, 2},
1584 {4, 4},
1585 {6, 7},
1586 {0, 0}
1587 }
1588 },
1589 {1, 1, 4, 0, /* 0xd5 */
1590 {{0, 0},
1591 {2, 2},
1592 {4, 4},
1593 {6, 7}
1594 }
1595 },
1596 {0, 1, 3, 0, /* 0xd6 */
1597 {{1, 2},
1598 {4, 4},
1599 {6, 7},
1600 {0, 0}
1601 }
1602 },
1603 {1, 1, 3, 0, /* 0xd7 */
1604 {{0, 2},
1605 {4, 4},
1606 {6, 7},
1607 {0, 0}
1608 }
1609 },
1610 {0, 1, 2, 0, /* 0xd8 */
1611 {{3, 4},
1612 {6, 7},
1613 {0, 0},
1614 {0, 0}
1615 }
1616 },
1617 {1, 1, 3, 0, /* 0xd9 */
1618 {{0, 0},
1619 {3, 4},
1620 {6, 7},
1621 {0, 0}
1622 }
1623 },
1624 {0, 1, 3, 0, /* 0xda */
1625 {{1, 1},
1626 {3, 4},
1627 {6, 7},
1628 {0, 0}
1629 }
1630 },
1631 {1, 1, 3, 0, /* 0xdb */
1632 {{0, 1},
1633 {3, 4},
1634 {6, 7},
1635 {0, 0}
1636 }
1637 },
1638 {0, 1, 2, 0, /* 0xdc */
1639 {{2, 4},
1640 {6, 7},
1641 {0, 0},
1642 {0, 0}
1643 }
1644 },
1645 {1, 1, 3, 0, /* 0xdd */
1646 {{0, 0},
1647 {2, 4},
1648 {6, 7},
1649 {0, 0}
1650 }
1651 },
1652 {0, 1, 2, 0, /* 0xde */
1653 {{1, 4},
1654 {6, 7},
1655 {0, 0},
1656 {0, 0}
1657 }
1658 },
1659 {1, 1, 2, 0, /* 0xdf */
1660 {{0, 4},
1661 {6, 7},
1662 {0, 0},
1663 {0, 0}
1664 }
1665 },
1666 {0, 1, 1, 0, /* 0xe0 */
1667 {{5, 7},
1668 {0, 0},
1669 {0, 0},
1670 {0, 0}
1671 }
1672 },
1673 {1, 1, 2, 0, /* 0xe1 */
1674 {{0, 0},
1675 {5, 7},
1676 {0, 0},
1677 {0, 0}
1678 }
1679 },
1680 {0, 1, 2, 0, /* 0xe2 */
1681 {{1, 1},
1682 {5, 7},
1683 {0, 0},
1684 {0, 0}
1685 }
1686 },
1687 {1, 1, 2, 0, /* 0xe3 */
1688 {{0, 1},
1689 {5, 7},
1690 {0, 0},
1691 {0, 0}
1692 }
1693 },
1694 {0, 1, 2, 0, /* 0xe4 */
1695 {{2, 2},
1696 {5, 7},
1697 {0, 0},
1698 {0, 0}
1699 }
1700 },
1701 {1, 1, 3, 0, /* 0xe5 */
1702 {{0, 0},
1703 {2, 2},
1704 {5, 7},
1705 {0, 0}
1706 }
1707 },
1708 {0, 1, 2, 0, /* 0xe6 */
1709 {{1, 2},
1710 {5, 7},
1711 {0, 0},
1712 {0, 0}
1713 }
1714 },
1715 {1, 1, 2, 0, /* 0xe7 */
1716 {{0, 2},
1717 {5, 7},
1718 {0, 0},
1719 {0, 0}
1720 }
1721 },
1722 {0, 1, 2, 0, /* 0xe8 */
1723 {{3, 3},
1724 {5, 7},
1725 {0, 0},
1726 {0, 0}
1727 }
1728 },
1729 {1, 1, 3, 0, /* 0xe9 */
1730 {{0, 0},
1731 {3, 3},
1732 {5, 7},
1733 {0, 0}
1734 }
1735 },
1736 {0, 1, 3, 0, /* 0xea */
1737 {{1, 1},
1738 {3, 3},
1739 {5, 7},
1740 {0, 0}
1741 }
1742 },
1743 {1, 1, 3, 0, /* 0xeb */
1744 {{0, 1},
1745 {3, 3},
1746 {5, 7},
1747 {0, 0}
1748 }
1749 },
1750 {0, 1, 2, 0, /* 0xec */
1751 {{2, 3},
1752 {5, 7},
1753 {0, 0},
1754 {0, 0}
1755 }
1756 },
1757 {1, 1, 3, 0, /* 0xed */
1758 {{0, 0},
1759 {2, 3},
1760 {5, 7},
1761 {0, 0}
1762 }
1763 },
1764 {0, 1, 2, 0, /* 0xee */
1765 {{1, 3},
1766 {5, 7},
1767 {0, 0},
1768 {0, 0}
1769 }
1770 },
1771 {1, 1, 2, 0, /* 0xef */
1772 {{0, 3},
1773 {5, 7},
1774 {0, 0},
1775 {0, 0}
1776 }
1777 },
1778 {0, 1, 1, 0, /* 0xf0 */
1779 {{4, 7},
1780 {0, 0},
1781 {0, 0},
1782 {0, 0}
1783 }
1784 },
1785 {1, 1, 2, 0, /* 0xf1 */
1786 {{0, 0},
1787 {4, 7},
1788 {0, 0},
1789 {0, 0}
1790 }
1791 },
1792 {0, 1, 2, 0, /* 0xf2 */
1793 {{1, 1},
1794 {4, 7},
1795 {0, 0},
1796 {0, 0}
1797 }
1798 },
1799 {1, 1, 2, 0, /* 0xf3 */
1800 {{0, 1},
1801 {4, 7},
1802 {0, 0},
1803 {0, 0}
1804 }
1805 },
1806 {0, 1, 2, 0, /* 0xf4 */
1807 {{2, 2},
1808 {4, 7},
1809 {0, 0},
1810 {0, 0}
1811 }
1812 },
1813 {1, 1, 3, 0, /* 0xf5 */
1814 {{0, 0},
1815 {2, 2},
1816 {4, 7},
1817 {0, 0}
1818 }
1819 },
1820 {0, 1, 2, 0, /* 0xf6 */
1821 {{1, 2},
1822 {4, 7},
1823 {0, 0},
1824 {0, 0}
1825 }
1826 },
1827 {1, 1, 2, 0, /* 0xf7 */
1828 {{0, 2},
1829 {4, 7},
1830 {0, 0},
1831 {0, 0}
1832 }
1833 },
1834 {0, 1, 1, 0, /* 0xf8 */
1835 {{3, 7},
1836 {0, 0},
1837 {0, 0},
1838 {0, 0}
1839 }
1840 },
1841 {1, 1, 2, 0, /* 0xf9 */
1842 {{0, 0},
1843 {3, 7},
1844 {0, 0},
1845 {0, 0}
1846 }
1847 },
1848 {0, 1, 2, 0, /* 0xfa */
1849 {{1, 1},
1850 {3, 7},
1851 {0, 0},
1852 {0, 0}
1853 }
1854 },
1855 {1, 1, 2, 0, /* 0xfb */
1856 {{0, 1},
1857 {3, 7},
1858 {0, 0},
1859 {0, 0}
1860 }
1861 },
1862 {0, 1, 1, 0, /* 0xfc */
1863 {{2, 7},
1864 {0, 0},
1865 {0, 0},
1866 {0, 0}
1867 }
1868 },
1869 {1, 1, 2, 0, /* 0xfd */
1870 {{0, 0},
1871 {2, 7},
1872 {0, 0},
1873 {0, 0}
1874 }
1875 },
1876 {0, 1, 1, 0, /* 0xfe */
1877 {{1, 7},
1878 {0, 0},
1879 {0, 0},
1880 {0, 0}
1881 }
1882 },
1883 {1, 1, 1, 0, /* 0xff */
1884 {{0, 7},
1885 {0, 0},
1886 {0, 0},
1887 {0, 0}
1888 }
1889 }
1890 };
1891
1892 int
1893 sctp_is_address_in_scopecxx . . $ sctp_is_address_in_scope(1ddcbca5a886b8b1).(struct sctp_ifacxx . . $ sctp_ifa# *ifa,
1894 struct sctp_scopingcxx . . $ sctp_scoping# *scope,
1895 int do_update)
1896 {
1897 if ((scope->loopback_scopecxx . . $ sctp_scoping#loopback_scope. == 0) &&
1898 (ifa->ifn_pcxx . . $ sctp_ifa#ifn_p.) && SCTP_IFN_IS_IFT_LOOPcxx . . $ `usrsctplib/netinet/sctp_os_userspace.h:645:9`!(ifa->ifn_p)) {
1899 /*
1900 * skip loopback if not in scope *
1901 */
1902 return (0);
1903 }
1904 switch (ifa->addresscxx . . $ sctp_ifa#address..sa.sa_familycxx . . $ sockaddr#sa_family.) {
1905 #ifdef INETcxx . . $ `<built-in>:431:9`!
1906 case AF_INETcxx . . $ `<external>/8962547315054503424/socket.h:97:9`!:
1907 if (scope->ipv4_addr_legalcxx . . $ sctp_scoping#ipv4_addr_legal.) {
1908 struct sockaddr_incxx . . $ sockaddr_in# *sin;
1909
1910 sin = &ifa->addresscxx . . $ sctp_ifa#address..sin;
1911 if (sin->sin_addrcxx . . $ sockaddr_in#sin_addr..s_addrcxx . . $ in_addr#s_addr. == 0) {
1912 /* not in scope , unspecified */
1913 return (0);
1914 }
1915 if ((scope->ipv4_local_scopecxx . . $ sctp_scoping#ipv4_local_scope. == 0) &&
1916 (IN4_ISPRIVATE_ADDRESScxx . . $ `usrsctplib/netinet/sctp_constants.h:972:9`!(&sin->sin_addr))) {
1917 /* private address not in scope */
1918 return (0);
1919 }
1920 } else {
1921 return (0);
1922 }
1923 break;
1924 #endif
1925 #ifdef INET6cxx . . $ `<built-in>:432:9`!
1926 case AF_INET6cxx . . $ `<external>/8962547315054503424/socket.h:105:9`!:
1927 if (scope->ipv6_addr_legalcxx . . $ sctp_scoping#ipv6_addr_legal.) {
1928 struct sockaddr_in6cxx . . $ sockaddr_in6# *sin6;
1929
1930 /* Must update the flags, bummer, which
1931 * means any IFA locks must now be applied HERE <->
1932 */
1933 if (do_update) {
1934 sctp_gather_internal_ifa_flagscxx . . $ sctp_gather_internal_ifa_flags(e5ce6e4bf5862a47).(ifa);
1935 }
1936 if (ifa->localifa_flagscxx . . $ sctp_ifa#localifa_flags. & SCTP_ADDR_IFA_UNUSEABLEcxx . . $ `usrsctplib/netinet/sctp_pcb.h:103:9`!) {
1937 return (0);
1938 }
1939 /* ok to use deprecated addresses? */
1940 sin6 = &ifa->addresscxx . . $ sctp_ifa#address..sin6;
1941 if (IN6_IS_ADDR_UNSPECIFIEDcxx . . $ `<external>/9581057695539925927/in.h:437:10`!(&sin6->sin6_addr)) {
1942 /* skip unspecifed addresses */
1943 return (0);
1944 }
1945 if ( /* (local_scope == 0) && */
1946 (IN6_IS_ADDR_LINKLOCALcxx . . $ `<external>/9581057695539925927/in.h:453:10`!(&sin6->sin6_addr))) {
1947 return (0);
1948 }
1949 if ((scope->site_scopecxx . . $ sctp_scoping#site_scope. == 0) &&
1950 (IN6_IS_ADDR_SITELOCALcxx . . $ `<external>/9581057695539925927/in.h:458:10`!(&sin6->sin6_addr))) {
1951 return (0);
1952 }
1953 } else {
1954 return (0);
1955 }
1956 break;
1957 #endif
1958 #if defined(__Userspace__cxx . . $ `<built-in>:442:9`!)
1959 case AF_CONNcxx . . $ `usrsctplib/netinet/sctp_os_userspace.h:995:9`!:
1960 if (!scope->conn_addr_legalcxx . . $ sctp_scoping#conn_addr_legal.) {
1961 return (0);
1962 }
1963 break;
1964 #endif
1965 default:
1966 return (0);
1967 }
1968 return (1);
1969 }
1970
1971 static struct mbufcxx . . $ mbuf# *
1972 sctp_add_addr_to_mbufcxx . . $ sctp_add_addr_to_mbuf(9d47a8c9ffb460ca).(struct mbufcxx . . $ mbuf# *m, struct sctp_ifacxx . . $ sctp_ifa# *ifa, uint16_tcxx . . $ uint16_t# *len)
1973 {
1974 #if defined(INETcxx . . $ `<built-in>:431:9`!) || defined(INET6cxx . . $ `<built-in>:432:9`!)
1975 struct sctp_paramhdrcxx . . $ sctp_paramhdr# *paramh;
1976 struct mbufcxx . . $ mbuf# *mret;
1977 uint16_tcxx . . $ uint16_t# plen;
1978 #endif
1979
1980 switch (ifa->addresscxx . . $ sctp_ifa#address..sa.sa_familycxx . . $ sockaddr#sa_family.) {
1981 #ifdef INETcxx . . $ `<built-in>:431:9`!
1982 case AF_INETcxx . . $ `<external>/8962547315054503424/socket.h:97:9`!:
1983 plen = (uint16_tcxx . . $ uint16_t#)sizeof(struct sctp_ipv4addr_paramcxx . . $ sctp_ipv4addr_param#);
1984 break;
1985 #endif
1986 #ifdef INET6cxx . . $ `<built-in>:432:9`!
1987 case AF_INET6cxx . . $ `<external>/8962547315054503424/socket.h:105:9`!:
1988 plen = (uint16_tcxx . . $ uint16_t#)sizeof(struct sctp_ipv6addr_paramcxx . . $ sctp_ipv6addr_param#);
1989 break;
1990 #endif
1991 default:
1992 return (m);
1993 }
1994 #if defined(INETcxx . . $ `<built-in>:431:9`!) || defined(INET6cxx . . $ `<built-in>:432:9`!)
1995 if (M_TRAILINGSPACEcxx . . $ `usrsctplib/user_mbuf.h:355:9`!(m) >= plen) {
1996 /* easy side we just drop it on the end */
1997 paramh = (struct sctp_paramhdrcxx . . $ sctp_paramhdr# *)(SCTP_BUF_ATcxx . . $ `usrsctplib/netinet/sctp_os_userspace.h:794:9`!(m, SCTP_BUF_LENcxx . . $ `usrsctplib/netinet/sctp_os_userspace.h:790:9`!(m)));
1998 mret = m;
1999 } else {
2000 /* Need more space */
2001 mret = m;
2002 while (SCTP_BUF_NEXTcxx . . $ `usrsctplib/netinet/sctp_os_userspace.h:791:9`!(mret) != NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!) {
2003 mret = SCTP_BUF_NEXTcxx . . $ `usrsctplib/netinet/sctp_os_userspace.h:791:9`!(mret);
2004 }
2005 SCTP_BUF_NEXTcxx . . $ `usrsctplib/netinet/sctp_os_userspace.h:791:9`!(mret) = sctp_get_mbuf_for_msgcxx . . $ sctp_get_mbuf_for_msg(c7c30fc329598377).(plen, 0, M_NOWAITcxx . . $ `usrsctplib/user_malloc.h:60:9`!, 1, MT_DATAcxx . . $ `usrsctplib/user_mbuf.h:289:9`!);
2006 if (SCTP_BUF_NEXTcxx . . $ `usrsctplib/netinet/sctp_os_userspace.h:791:9`!(mret) == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!) {
2007 /* We are hosed, can't add more addresses */
2008 return (m);
2009 }
2010 mret = SCTP_BUF_NEXTcxx . . $ `usrsctplib/netinet/sctp_os_userspace.h:791:9`!(mret);
2011 paramh = mtodcxx . . $ `usrsctplib/user_mbuf.h:96:9`!(mret, struct sctp_paramhdr *);
2012 }
2013 /* now add the parameter */
2014 switch (ifa->addresscxx . . $ sctp_ifa#address..sa.sa_familycxx . . $ sockaddr#sa_family.) {
2015 #ifdef INETcxx . . $ `<built-in>:431:9`!
2016 case AF_INETcxx . . $ `<external>/8962547315054503424/socket.h:97:9`!:
2017 {
2018 struct sctp_ipv4addr_paramcxx . . $ sctp_ipv4addr_param# *ipv4p;
2019 struct sockaddr_incxx . . $ sockaddr_in# *sin;
2020
2021 sin = &ifa->addresscxx . . $ sctp_ifa#address..sin;
2022 ipv4p = (struct sctp_ipv4addr_paramcxx . . $ sctp_ipv4addr_param# *)paramh;
2023 paramh->param_typecxx . . $ sctp_paramhdr#param_type. = htonscxx . . $ htons(a18c05e4017afb3d).(SCTP_IPV4_ADDRESScxx . . $ `usrsctplib/netinet/sctp_constants.h:399:9`!);
2024 paramh->param_lengthcxx . . $ sctp_paramhdr#param_length. = htonscxx . . $ htons(a18c05e4017afb3d).(plen);
2025 ipv4p->addrcxx . . $ sctp_ipv4addr_param#addr. = sin->sin_addrcxx . . $ sockaddr_in#sin_addr..s_addrcxx . . $ in_addr#s_addr.;
2026 SCTP_BUF_LENcxx . . $ `usrsctplib/netinet/sctp_os_userspace.h:790:9`!(mret) += plen;
2027 break;
2028 }
2029 #endif
2030 #ifdef INET6cxx . . $ `<built-in>:432:9`!
2031 case AF_INET6cxx . . $ `<external>/8962547315054503424/socket.h:105:9`!:
2032 {
2033 struct sctp_ipv6addr_paramcxx . . $ sctp_ipv6addr_param# *ipv6p;
2034 struct sockaddr_in6cxx . . $ sockaddr_in6# *sin6;
2035
2036 sin6 = &ifa->addresscxx . . $ sctp_ifa#address..sin6;
2037 ipv6p = (struct sctp_ipv6addr_paramcxx . . $ sctp_ipv6addr_param# *)paramh;
2038 paramh->param_typecxx . . $ sctp_paramhdr#param_type. = htonscxx . . $ htons(a18c05e4017afb3d).(SCTP_IPV6_ADDRESScxx . . $ `usrsctplib/netinet/sctp_constants.h:400:9`!);
2039 paramh->param_lengthcxx . . $ sctp_paramhdr#param_length. = htonscxx . . $ htons(a18c05e4017afb3d).(plen);
2040 memcpycxx . . $ memcpy(cc817cb175f282d).(ipv6p->addrcxx . . $ sctp_ipv6addr_param#addr., &sin6->sin6_addrcxx . . $ sockaddr_in6#sin6_addr.,
2041 sizeof(ipv6p->addrcxx . . $ sctp_ipv6addr_param#addr.));
2042 #if defined(SCTP_EMBEDDED_V6_SCOPE)
2043 /* clear embedded scope in the address */
2044 in6_clearscope((struct in6_addr *)ipv6p->addr);
2045 #endif
2046 SCTP_BUF_LENcxx . . $ `usrsctplib/netinet/sctp_os_userspace.h:790:9`!(mret) += plen;
2047 break;
2048 }
2049 #endif
2050 default:
2051 return (m);
2052 }
2053 if (len != NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!) {
2054 *len += plen;
2055 }
2056 return (mret);
2057 #endif
2058 }
2059
2060 struct mbufcxx . . $ mbuf# *
2061 sctp_add_addresses_to_i_iacxx . . $ sctp_add_addresses_to_i_ia(9e6c56b7dd223edd).(struct sctp_inpcbcxx . . $ sctp_inpcb# *inp, struct sctp_tcbcxx . . $ sctp_tcb# *stcb,
2062 struct sctp_scopingcxx . . $ sctp_scoping# *scope,
2063 struct mbufcxx . . $ mbuf# *m_at, int cnt_inits_to,
2064 uint16_tcxx . . $ uint16_t# *padding_len, uint16_tcxx . . $ uint16_t# *chunk_len)
2065 {
2066 struct sctp_vrfcxx . . $ sctp_vrf# *vrf = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!;
2067 int cnt, limit_out = 0, total_count;
2068 uint32_tcxx . . $ uint32_t# vrf_id;
2069
2070 vrf_id = inp->def_vrf_idcxx . . $ sctp_inpcb#def_vrf_id.;
2071 SCTP_IPI_ADDR_RLOCKcxx . . $ `usrsctplib/netinet/sctp_process_lock.h:589:9`!();
2072 vrf = sctp_find_vrfcxx . . $ sctp_find_vrf(3a554f7b877238ae).(vrf_id);
2073 if (vrf == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!) {
2074 SCTP_IPI_ADDR_RUNLOCKcxx . . $ `usrsctplib/netinet/sctp_process_lock.h:591:9`!();
2075 return (m_at);
2076 }
2077 if (inp->sctp_flagscxx . . $ sctp_inpcb#sctp_flags. & SCTP_PCB_FLAGS_BOUNDALLcxx . . $ `usrsctplib/netinet/sctp.h:525:9`!) {
2078 struct sctp_ifacxx . . $ sctp_ifa# *sctp_ifap;
2079 struct sctp_ifncxx . . $ sctp_ifn# *sctp_ifnp;
2080
2081 cnt = cnt_inits_to;
2082 if (vrf->total_ifa_countcxx . . $ sctp_vrf#total_ifa_count. > SCTP_COUNT_LIMITcxx . . $ `usrsctplib/netinet/sctp_constants.h:81:9`!) {
2083 limit_out = 1;
2084 cnt = SCTP_ADDRESS_LIMITcxx . . $ `usrsctplib/netinet/sctp_constants.h:69:9`!;
2085 goto skip_count;
2086 }
2087 LIST_FOREACHcxx . . $ `<external>/2546723208511035544/queue.h:134:9`!(sctp_ifnp, &vrf->ifnlist, next_ifn) {
2088 if ((scope->loopback_scopecxx . . $ sctp_scoping#loopback_scope. == 0) &&
2089 SCTP_IFN_IS_IFT_LOOPcxx . . $ `usrsctplib/netinet/sctp_os_userspace.h:645:9`!(sctp_ifnp)) {
2090 /*
2091 * Skip loopback devices if loopback_scope
2092 * not set
2093 */
2094 continue;
2095 }
2096 LIST_FOREACHcxx . . $ `<external>/2546723208511035544/queue.h:134:9`!(sctp_ifap, &sctp_ifnp->ifalist, next_ifa) {
2097 #if defined(__FreeBSD__) && !defined(__Userspace__cxx . . $ `<built-in>:442:9`!)
2098 #ifdef INET
2099 if ((sctp_ifap->address.sa.sa_family == AF_INET) &&
2100 (prison_check_ip4(inp->ip_inp.inp.inp_cred,
2101 &sctp_ifap->address.sin.sin_addr) != 0)) {
2102 continue;
2103 }
2104 #endif
2105 #ifdef INET6
2106 if ((sctp_ifap->address.sa.sa_family == AF_INET6) &&
2107 (prison_check_ip6(inp->ip_inp.inp.inp_cred,
2108 &sctp_ifap->address.sin6.sin6_addr) != 0)) {
2109 continue;
2110 }
2111 #endif
2112 #endif
2113 if (sctp_is_addr_restrictedcxx . . $ sctp_is_addr_restricted(c48a07521d21bc8a).(stcb, sctp_ifap)) {
2114 continue;
2115 }
2116 #if defined(__Userspace__cxx . . $ `<built-in>:442:9`!)
2117 if (sctp_ifap->addresscxx . . $ sctp_ifa#address..sa.sa_familycxx . . $ sockaddr#sa_family. == AF_CONNcxx . . $ `usrsctplib/netinet/sctp_os_userspace.h:995:9`!) {
2118 continue;
2119 }
2120 #endif
2121 if (sctp_is_address_in_scopecxx . . $ sctp_is_address_in_scope(1ddcbca5a886b8b1).(sctp_ifap, scope, 1) == 0) {
2122 continue;
2123 }
2124 cnt++;
2125 if (cnt > SCTP_ADDRESS_LIMITcxx . . $ `usrsctplib/netinet/sctp_constants.h:69:9`!) {
2126 break;
2127 }
2128 }
2129 if (cnt > SCTP_ADDRESS_LIMITcxx . . $ `usrsctplib/netinet/sctp_constants.h:69:9`!) {
2130 break;
2131 }
2132 }
2133 skip_count:
2134 if (cnt > 1) {
2135 total_count = 0;
2136 LIST_FOREACHcxx . . $ `<external>/2546723208511035544/queue.h:134:9`!(sctp_ifnp, &vrf->ifnlist, next_ifn) {
2137 cnt = 0;
2138 if ((scope->loopback_scopecxx . . $ sctp_scoping#loopback_scope. == 0) &&
2139 SCTP_IFN_IS_IFT_LOOPcxx . . $ `usrsctplib/netinet/sctp_os_userspace.h:645:9`!(sctp_ifnp)) {
2140 /*
2141 * Skip loopback devices if
2142 * loopback_scope not set
2143 */
2144 continue;
2145 }
2146 LIST_FOREACHcxx . . $ `<external>/2546723208511035544/queue.h:134:9`!(sctp_ifap, &sctp_ifnp->ifalist, next_ifa) {
2147 #if defined(__FreeBSD__) && !defined(__Userspace__cxx . . $ `<built-in>:442:9`!)
2148 #ifdef INET
2149 if ((sctp_ifap->address.sa.sa_family == AF_INET) &&
2150 (prison_check_ip4(inp->ip_inp.inp.inp_cred,
2151 &sctp_ifap->address.sin.sin_addr) != 0)) {
2152 continue;
2153 }
2154 #endif
2155 #ifdef INET6
2156 if ((sctp_ifap->address.sa.sa_family == AF_INET6) &&
2157 (prison_check_ip6(inp->ip_inp.inp.inp_cred,
2158 &sctp_ifap->address.sin6.sin6_addr) != 0)) {
2159 continue;
2160 }
2161 #endif
2162 #endif
2163 if (sctp_is_addr_restrictedcxx . . $ sctp_is_addr_restricted(c48a07521d21bc8a).(stcb, sctp_ifap)) {
2164 continue;
2165 }
2166 #if defined(__Userspace__cxx . . $ `<built-in>:442:9`!)
2167 if (sctp_ifap->addresscxx . . $ sctp_ifa#address..sa.sa_familycxx . . $ sockaddr#sa_family. == AF_CONNcxx . . $ `usrsctplib/netinet/sctp_os_userspace.h:995:9`!) {
2168 continue;
2169 }
2170 #endif
2171 if (sctp_is_address_in_scopecxx . . $ sctp_is_address_in_scope(1ddcbca5a886b8b1).(sctp_ifap,
2172 scope, 0) == 0) {
2173 continue;
2174 }
2175 if ((chunk_len != NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!) &&
2176 (padding_len != NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!) &&
2177 (*padding_len > 0)) {
2178 memsetcxx . . $ memset(d1de1e4fb215f1c6).(mtodcxx . . $ `usrsctplib/user_mbuf.h:96:9`!(m_at, caddr_t) + *chunk_len, 0, *padding_len);
2179 SCTP_BUF_LENcxx . . $ `usrsctplib/netinet/sctp_os_userspace.h:790:9`!(m_at) += *padding_len;
2180 *chunk_len += *padding_len;
2181 *padding_len = 0;
2182 }
2183 m_at = sctp_add_addr_to_mbufcxx . . $ sctp_add_addr_to_mbuf(9d47a8c9ffb460ca).(m_at, sctp_ifap, chunk_len);
2184 if (limit_out) {
2185 cnt++;
2186 total_count++;
2187 if (cnt >= 2) {
2188 /* two from each address */
2189 break;
2190 }
2191 if (total_count > SCTP_ADDRESS_LIMITcxx . . $ `usrsctplib/netinet/sctp_constants.h:69:9`!) {
2192 /* No more addresses */
2193 break;
2194 }
2195 }
2196 }
2197 }
2198 }
2199 } else {
2200 struct sctp_laddrcxx . . $ sctp_laddr# *laddr;
2201
2202 cnt = cnt_inits_to;
2203 /* First, how many ? */
2204 LIST_FOREACHcxx . . $ `<external>/2546723208511035544/queue.h:134:9`!(laddr, &inp->sctp_addr_list, sctp_nxt_addr) {
2205 if (laddr->ifacxx . . $ sctp_laddr#ifa. == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!) {
2206 continue;
2207 }
2208 if (laddr->ifacxx . . $ sctp_laddr#ifa.->localifa_flagscxx . . $ sctp_ifa#localifa_flags. & SCTP_BEING_DELETEDcxx . . $ `usrsctplib/netinet/sctp_pcb.h:95:9`!)
2209 /* Address being deleted by the system, dont
2210 * list.
2211 */
2212 continue;
2213 if (laddr->actioncxx . . $ sctp_laddr#action. == SCTP_DEL_IP_ADDRESScxx . . $ `usrsctplib/netinet/sctp_constants.h:436:9`!) {
2214 /* Address being deleted on this ep
2215 * don't list.
2216 */
2217 continue;
2218 }
2219 #if defined(__Userspace__cxx . . $ `<built-in>:442:9`!)
2220 if (laddr->ifacxx . . $ sctp_laddr#ifa.->addresscxx . . $ sctp_ifa#address..sa.sa_familycxx . . $ sockaddr#sa_family. == AF_CONNcxx . . $ `usrsctplib/netinet/sctp_os_userspace.h:995:9`!) {
2221 continue;
2222 }
2223 #endif
2224 if (sctp_is_address_in_scopecxx . . $ sctp_is_address_in_scope(1ddcbca5a886b8b1).(laddr->ifacxx . . $ sctp_laddr#ifa.,
2225 scope, 1) == 0) {
2226 continue;
2227 }
2228 cnt++;
2229 }
2230 /*
2231 * To get through a NAT we only list addresses if we have
2232 * more than one. That way if you just bind a single address
2233 * we let the source of the init dictate our address.
2234 */
2235 if (cnt > 1) {
2236 cnt = cnt_inits_to;
2237 LIST_FOREACHcxx . . $ `<external>/2546723208511035544/queue.h:134:9`!(laddr, &inp->sctp_addr_list, sctp_nxt_addr) {
2238 if (laddr->ifacxx . . $ sctp_laddr#ifa. == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!) {
2239 continue;
2240 }
2241 if (laddr->ifacxx . . $ sctp_laddr#ifa.->localifa_flagscxx . . $ sctp_ifa#localifa_flags. & SCTP_BEING_DELETEDcxx . . $ `usrsctplib/netinet/sctp_pcb.h:95:9`!) {
2242 continue;
2243 }
2244 #if defined(__Userspace__cxx . . $ `<built-in>:442:9`!)
2245 if (laddr->ifacxx . . $ sctp_laddr#ifa.->addresscxx . . $ sctp_ifa#address..sa.sa_familycxx . . $ sockaddr#sa_family. == AF_CONNcxx . . $ `usrsctplib/netinet/sctp_os_userspace.h:995:9`!) {
2246 continue;
2247 }
2248 #endif
2249 if (sctp_is_address_in_scopecxx . . $ sctp_is_address_in_scope(1ddcbca5a886b8b1).(laddr->ifacxx . . $ sctp_laddr#ifa.,
2250 scope, 0) == 0) {
2251 continue;
2252 }
2253 if ((chunk_len != NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!) &&
2254 (padding_len != NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!) &&
2255 (*padding_len > 0)) {
2256 memsetcxx . . $ memset(d1de1e4fb215f1c6).(mtodcxx . . $ `usrsctplib/user_mbuf.h:96:9`!(m_at, caddr_t) + *chunk_len, 0, *padding_len);
2257 SCTP_BUF_LENcxx . . $ `usrsctplib/netinet/sctp_os_userspace.h:790:9`!(m_at) += *padding_len;
2258 *chunk_len += *padding_len;
2259 *padding_len = 0;
2260 }
2261 m_at = sctp_add_addr_to_mbufcxx . . $ sctp_add_addr_to_mbuf(9d47a8c9ffb460ca).(m_at, laddr->ifacxx . . $ sctp_laddr#ifa., chunk_len);
2262 cnt++;
2263 if (cnt >= SCTP_ADDRESS_LIMITcxx . . $ `usrsctplib/netinet/sctp_constants.h:69:9`!) {
2264 break;
2265 }
2266 }
2267 }
2268 }
2269 SCTP_IPI_ADDR_RUNLOCKcxx . . $ `usrsctplib/netinet/sctp_process_lock.h:591:9`!();
2270 return (m_at);
2271 }
2272
2273 static struct sctp_ifacxx . . $ sctp_ifa# *
2274 sctp_is_ifa_addr_preferredcxx . . $ sctp_is_ifa_addr_preferred(f5b285baa6f0444f).(struct sctp_ifacxx . . $ sctp_ifa# *ifa,
2275 uint8_tcxx . . $ uint8_t# dest_is_loop,
2276 uint8_tcxx . . $ uint8_t# dest_is_priv,
2277 sa_family_tcxx . . $ sa_family_t# fam)
2278 {
2279 uint8_tcxx . . $ uint8_t# dest_is_global = 0;
2280 /* dest_is_priv is true if destination is a private address */
2281 /* dest_is_loop is true if destination is a loopback addresses */
2282
2283 /**
2284 * Here we determine if its a preferred address. A preferred address
2285 * means it is the same scope or higher scope then the destination.
2286 * L = loopback, P = private, G = global
2287 * -----------------------------------------
2288 * src | dest | result
2289 * ----------------------------------------
2290 * L | L | yes
2291 * -----------------------------------------
2292 * P | L | yes-v4 no-v6
2293 * -----------------------------------------
2294 * G | L | yes-v4 no-v6
2295 * -----------------------------------------
2296 * L | P | no
2297 * -----------------------------------------
2298 * P | P | yes
2299 * -----------------------------------------
2300 * G | P | no
2301 * -----------------------------------------
2302 * L | G | no
2303 * -----------------------------------------
2304 * P | G | no
2305 * -----------------------------------------
2306 * G | G | yes
2307 * -----------------------------------------
2308 */
2309
2310 if (ifa->addresscxx . . $ sctp_ifa#address..sa.sa_familycxx . . $ sockaddr#sa_family. != fam) {
2311 /* forget mis-matched family */
2312 return (NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!);
2313 }
2314 if ((dest_is_priv == 0) && (dest_is_loop == 0)) {
2315 dest_is_global = 1;
2316 }
2317 SCTPDBGcxx . . $ `usrsctplib/netinet/sctp_os_userspace.h:591:9`!(SCTP_DEBUG_OUTPUT2cxx . . $ `usrsctplib/netinet/sctp_constants.h:644:9`!, "Is destination preferred:");
2318 SCTPDBG_ADDRcxx . . $ `usrsctplib/netinet/sctp_os_userspace.h:599:9`!(SCTP_DEBUG_OUTPUT2cxx . . $ `usrsctplib/netinet/sctp_constants.h:644:9`!, &ifa->address.sa);
2319 /* Ok the address may be ok */
2320 #ifdef INET6cxx . . $ `<built-in>:432:9`!
2321 if (fam == AF_INET6cxx . . $ `<external>/8962547315054503424/socket.h:105:9`!) {
2322 /* ok to use deprecated addresses? no lets not! */
2323 if (ifa->localifa_flagscxx . . $ sctp_ifa#localifa_flags. & SCTP_ADDR_IFA_UNUSEABLEcxx . . $ `usrsctplib/netinet/sctp_pcb.h:103:9`!) {
2324 SCTPDBGcxx . . $ `usrsctplib/netinet/sctp_os_userspace.h:591:9`!(SCTP_DEBUG_OUTPUT3cxx . . $ `usrsctplib/netinet/sctp_constants.h:645:9`!, "NO:1\n");
2325 return (NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!);
2326 }
2327 if (ifa->src_is_privcxx . . $ sctp_ifa#src_is_priv. && !ifa->src_is_loopcxx . . $ sctp_ifa#src_is_loop.) {
2328 if (dest_is_loop) {
2329 SCTPDBGcxx . . $ `usrsctplib/netinet/sctp_os_userspace.h:591:9`!(SCTP_DEBUG_OUTPUT3cxx . . $ `usrsctplib/netinet/sctp_constants.h:645:9`!, "NO:2\n");
2330 return (NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!);
2331 }
2332 }
2333 if (ifa->src_is_globcxx . . $ sctp_ifa#src_is_glob.) {
2334 if (dest_is_loop) {
2335 SCTPDBGcxx . . $ `usrsctplib/netinet/sctp_os_userspace.h:591:9`!(SCTP_DEBUG_OUTPUT3cxx . . $ `usrsctplib/netinet/sctp_constants.h:645:9`!, "NO:3\n");
2336 return (NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!);
2337 }
2338 }
2339 }
2340 #endif
2341 /* Now that we know what is what, implement or table
2342 * this could in theory be done slicker (it used to be), but this
2343 * is straightforward and easier to validate :-)
2344 */
2345 SCTPDBGcxx . . $ `usrsctplib/netinet/sctp_os_userspace.h:591:9`!(SCTP_DEBUG_OUTPUT3cxx . . $ `usrsctplib/netinet/sctp_constants.h:645:9`!, "src_loop:%d src_priv:%d src_glob:%d\n",
2346 ifa->src_is_loop, ifa->src_is_priv, ifa->src_is_glob);
2347 SCTPDBGcxx . . $ `usrsctplib/netinet/sctp_os_userspace.h:591:9`!(SCTP_DEBUG_OUTPUT3cxx . . $ `usrsctplib/netinet/sctp_constants.h:645:9`!, "dest_loop:%d dest_priv:%d dest_glob:%d\n",
2348 dest_is_loop, dest_is_priv, dest_is_global);
2349
2350 if ((ifa->src_is_loopcxx . . $ sctp_ifa#src_is_loop.) && (dest_is_priv)) {
2351 SCTPDBGcxx . . $ `usrsctplib/netinet/sctp_os_userspace.h:591:9`!(SCTP_DEBUG_OUTPUT3cxx . . $ `usrsctplib/netinet/sctp_constants.h:645:9`!, "NO:4\n");
2352 return (NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!);
2353 }
2354 if ((ifa->src_is_globcxx . . $ sctp_ifa#src_is_glob.) && (dest_is_priv)) {
2355 SCTPDBGcxx . . $ `usrsctplib/netinet/sctp_os_userspace.h:591:9`!(SCTP_DEBUG_OUTPUT3cxx . . $ `usrsctplib/netinet/sctp_constants.h:645:9`!, "NO:5\n");
2356 return (NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!);
2357 }
2358 if ((ifa->src_is_loopcxx . . $ sctp_ifa#src_is_loop.) && (dest_is_global)) {
2359 SCTPDBGcxx . . $ `usrsctplib/netinet/sctp_os_userspace.h:591:9`!(SCTP_DEBUG_OUTPUT3cxx . . $ `usrsctplib/netinet/sctp_constants.h:645:9`!, "NO:6\n");
2360 return (NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!);
2361 }
2362 if ((ifa->src_is_privcxx . . $ sctp_ifa#src_is_priv.) && (dest_is_global)) {
2363 SCTPDBGcxx . . $ `usrsctplib/netinet/sctp_os_userspace.h:591:9`!(SCTP_DEBUG_OUTPUT3cxx . . $ `usrsctplib/netinet/sctp_constants.h:645:9`!, "NO:7\n");
2364 return (NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!);
2365 }
2366 SCTPDBGcxx . . $ `usrsctplib/netinet/sctp_os_userspace.h:591:9`!(SCTP_DEBUG_OUTPUT3cxx . . $ `usrsctplib/netinet/sctp_constants.h:645:9`!, "YES\n");
2367 /* its a preferred address */
2368 return (ifa);
2369 }
2370
2371 static struct sctp_ifacxx . . $ sctp_ifa# *
2372 sctp_is_ifa_addr_acceptablecxx . . $ sctp_is_ifa_addr_acceptable(f5b285baa6f0444f).(struct sctp_ifacxx . . $ sctp_ifa# *ifa,
2373 uint8_tcxx . . $ uint8_t# dest_is_loop,
2374 uint8_tcxx . . $ uint8_t# dest_is_priv,
2375 sa_family_tcxx . . $ sa_family_t# fam)
2376 {
2377 uint8_tcxx . . $ uint8_t# dest_is_global = 0;
2378
2379 /**
2380 * Here we determine if its a acceptable address. A acceptable
2381 * address means it is the same scope or higher scope but we can
2382 * allow for NAT which means its ok to have a global dest and a
2383 * private src.
2384 *
2385 * L = loopback, P = private, G = global
2386 * -----------------------------------------
2387 * src | dest | result
2388 * -----------------------------------------
2389 * L | L | yes
2390 * -----------------------------------------
2391 * P | L | yes-v4 no-v6
2392 * -----------------------------------------
2393 * G | L | yes
2394 * -----------------------------------------
2395 * L | P | no
2396 * -----------------------------------------
2397 * P | P | yes
2398 * -----------------------------------------
2399 * G | P | yes - May not work
2400 * -----------------------------------------
2401 * L | G | no
2402 * -----------------------------------------
2403 * P | G | yes - May not work
2404 * -----------------------------------------
2405 * G | G | yes
2406 * -----------------------------------------
2407 */
2408
2409 if (ifa->addresscxx . . $ sctp_ifa#address..sa.sa_familycxx . . $ sockaddr#sa_family. != fam) {
2410 /* forget non matching family */
2411 SCTPDBGcxx . . $ `usrsctplib/netinet/sctp_os_userspace.h:591:9`!(SCTP_DEBUG_OUTPUT3cxx . . $ `usrsctplib/netinet/sctp_constants.h:645:9`!, "ifa_fam:%d fam:%d\n",
2412 ifa->address.sa.sa_family, fam);
2413 return (NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!);
2414 }
2415 /* Ok the address may be ok */
2416 SCTPDBG_ADDRcxx . . $ `usrsctplib/netinet/sctp_os_userspace.h:599:9`!(SCTP_DEBUG_OUTPUT3cxx . . $ `usrsctplib/netinet/sctp_constants.h:645:9`!, &ifa->address.sa);
2417 SCTPDBGcxx . . $ `usrsctplib/netinet/sctp_os_userspace.h:591:9`!(SCTP_DEBUG_OUTPUT3cxx . . $ `usrsctplib/netinet/sctp_constants.h:645:9`!, "dst_is_loop:%d dest_is_priv:%d\n",
2418 dest_is_loop, dest_is_priv);
2419 if ((dest_is_loop == 0) && (dest_is_priv == 0)) {
2420 dest_is_global = 1;
2421 }
2422 #ifdef INET6cxx . . $ `<built-in>:432:9`!
2423 if (fam == AF_INET6cxx . . $ `<external>/8962547315054503424/socket.h:105:9`!) {
2424 /* ok to use deprecated addresses? */
2425 if (ifa->localifa_flagscxx . . $ sctp_ifa#localifa_flags. & SCTP_ADDR_IFA_UNUSEABLEcxx . . $ `usrsctplib/netinet/sctp_pcb.h:103:9`!) {
2426 return (NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!);
2427 }
2428 if (ifa->src_is_privcxx . . $ sctp_ifa#src_is_priv.) {
2429 /* Special case, linklocal to loop */
2430 if (dest_is_loop)
2431 return (NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!);
2432 }
2433 }
2434 #endif
2435 /*
2436 * Now that we know what is what, implement our table.
2437 * This could in theory be done slicker (it used to be), but this
2438 * is straightforward and easier to validate :-)
2439 */
2440 SCTPDBGcxx . . $ `usrsctplib/netinet/sctp_os_userspace.h:591:9`!(SCTP_DEBUG_OUTPUT3cxx . . $ `usrsctplib/netinet/sctp_constants.h:645:9`!, "ifa->src_is_loop:%d dest_is_priv:%d\n",
2441 ifa->src_is_loop,
2442 dest_is_priv);
2443 if ((ifa->src_is_loopcxx . . $ sctp_ifa#src_is_loop. == 1) && (dest_is_priv)) {
2444 return (NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!);
2445 }
2446 SCTPDBGcxx . . $ `usrsctplib/netinet/sctp_os_userspace.h:591:9`!(SCTP_DEBUG_OUTPUT3cxx . . $ `usrsctplib/netinet/sctp_constants.h:645:9`!, "ifa->src_is_loop:%d dest_is_glob:%d\n",
2447 ifa->src_is_loop,
2448 dest_is_global);
2449 if ((ifa->src_is_loopcxx . . $ sctp_ifa#src_is_loop. == 1) && (dest_is_global)) {
2450 return (NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!);
2451 }
2452 SCTPDBGcxx . . $ `usrsctplib/netinet/sctp_os_userspace.h:591:9`!(SCTP_DEBUG_OUTPUT3cxx . . $ `usrsctplib/netinet/sctp_constants.h:645:9`!, "address is acceptable\n");
2453 /* its an acceptable address */
2454 return (ifa);
2455 }
2456
2457 int
2458 sctp_is_addr_restrictedcxx . . $ sctp_is_addr_restricted(c48a07521d21bc8a).(struct sctp_tcbcxx . . $ sctp_tcb# *stcb, struct sctp_ifacxx . . $ sctp_ifa# *ifa)
2459 {
2460 struct sctp_laddrcxx . . $ sctp_laddr# *laddr;
2461
2462 if (stcb == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!) {
2463 /* There are no restrictions, no TCB :-) */
2464 return (0);
2465 }
2466 LIST_FOREACHcxx . . $ `<external>/2546723208511035544/queue.h:134:9`!(laddr, &stcb->asoc.sctp_restricted_addrs, sctp_nxt_addr) {
2467 if (laddr->ifacxx . . $ sctp_laddr#ifa. == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!) {
2468 SCTPDBGcxx . . $ `usrsctplib/netinet/sctp_os_userspace.h:591:9`!(SCTP_DEBUG_OUTPUT1cxx . . $ `usrsctplib/netinet/sctp_constants.h:643:9`!, "%s: NULL ifa\n",
2469 __func__);
2470 continue;
2471 }
2472 if (laddr->ifacxx . . $ sctp_laddr#ifa. == ifa) {
2473 /* Yes it is on the list */
2474 return (1);
2475 }
2476 }
2477 return (0);
2478 }
2479
2480 int
2481 sctp_is_addr_in_epcxx . . $ sctp_is_addr_in_ep(7058b806c9bbb4f6).(struct sctp_inpcbcxx . . $ sctp_inpcb# *inp, struct sctp_ifacxx . . $ sctp_ifa# *ifa)
2482 {
2483 struct sctp_laddrcxx . . $ sctp_laddr# *laddr;
2484
2485 if (ifa == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!)
2486 return (0);
2487 LIST_FOREACHcxx . . $ `<external>/2546723208511035544/queue.h:134:9`!(laddr, &inp->sctp_addr_list, sctp_nxt_addr) {
2488 if (laddr->ifacxx . . $ sctp_laddr#ifa. == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!) {
2489 SCTPDBGcxx . . $ `usrsctplib/netinet/sctp_os_userspace.h:591:9`!(SCTP_DEBUG_OUTPUT1cxx . . $ `usrsctplib/netinet/sctp_constants.h:643:9`!, "%s: NULL ifa\n",
2490 __func__);
2491 continue;
2492 }
2493 if ((laddr->ifacxx . . $ sctp_laddr#ifa. == ifa) && laddr->actioncxx . . $ sctp_laddr#action. == 0)
2494 /* same pointer */
2495 return (1);
2496 }
2497 return (0);
2498 }
2499
2500 static struct sctp_ifacxx . . $ sctp_ifa# *
2501 sctp_choose_boundspecific_inpcxx . . $ sctp_choose_boundspecific_inp(b5cb8f7ca38bc87).(struct sctp_inpcbcxx . . $ sctp_inpcb# *inp,
2502 sctp_route_tcxx . . $ sctp_route_t# *ro,
2503 uint32_tcxx . . $ uint32_t# vrf_id,
2504 int non_asoc_addr_ok,
2505 uint8_tcxx . . $ uint8_t# dest_is_priv,
2506 uint8_tcxx . . $ uint8_t# dest_is_loop,
2507 sa_family_tcxx . . $ sa_family_t# fam)
2508 {
2509 struct sctp_laddrcxx . . $ sctp_laddr# *laddr, *starting_point;
2510 void *ifn;
2511 int resettotop = 0;
2512 struct sctp_ifncxx . . $ sctp_ifn# *sctp_ifn;
2513 struct sctp_ifacxx . . $ sctp_ifa# *sctp_ifa, *sifa;
2514 struct sctp_vrfcxx . . $ sctp_vrf# *vrf;
2515 uint32_tcxx . . $ uint32_t# ifn_index;
2516
2517 vrf = sctp_find_vrfcxx . . $ sctp_find_vrf(3a554f7b877238ae).(vrf_id);
2518 if (vrf == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!)
2519 return (NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!);
2520
2521 ifn = SCTP_GET_IFN_VOID_FROM_ROUTEcxx . . $ `usrsctplib/netinet/sctp_os_userspace.h:655:9`!(ro);
2522 ifn_index = SCTP_GET_IF_INDEX_FROM_ROUTEcxx . . $ `usrsctplib/netinet/sctp_os_userspace.h:656:9`!(ro);
2523 sctp_ifn = sctp_find_ifncxx . . $ sctp_find_ifn(49a397a2897c363c).(ifn, ifn_index);
2524 /*
2525 * first question, is the ifn we will emit on in our list, if so, we
2526 * want such an address. Note that we first looked for a
2527 * preferred address.
2528 */
2529 if (sctp_ifn) {
2530 /* is a preferred one on the interface we route out? */
2531 LIST_FOREACHcxx . . $ `<external>/2546723208511035544/queue.h:134:9`!(sctp_ifa, &sctp_ifn->ifalist, next_ifa) {
2532 #if defined(__FreeBSD__) && !defined(__Userspace__cxx . . $ `<built-in>:442:9`!)
2533 #ifdef INET
2534 if ((sctp_ifa->address.sa.sa_family == AF_INET) &&
2535 (prison_check_ip4(inp->ip_inp.inp.inp_cred,
2536 &sctp_ifa->address.sin.sin_addr) != 0)) {
2537 continue;
2538 }
2539 #endif
2540 #ifdef INET6
2541 if ((sctp_ifa->address.sa.sa_family == AF_INET6) &&
2542 (prison_check_ip6(inp->ip_inp.inp.inp_cred,
2543 &sctp_ifa->address.sin6.sin6_addr) != 0)) {
2544 continue;
2545 }
2546 #endif
2547 #endif
2548 if ((sctp_ifa->localifa_flagscxx . . $ sctp_ifa#localifa_flags. & SCTP_ADDR_DEFER_USEcxx . . $ `usrsctplib/netinet/sctp_pcb.h:102:9`!) &&
2549 (non_asoc_addr_ok == 0))
2550 continue;
2551 sifa = sctp_is_ifa_addr_preferredcxx . . $ sctp_is_ifa_addr_preferred(f5b285baa6f0444f).(sctp_ifa,
2552 dest_is_loop,
2553 dest_is_priv, fam);
2554 if (sifa == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!)
2555 continue;
2556 if (sctp_is_addr_in_epcxx . . $ sctp_is_addr_in_ep(7058b806c9bbb4f6).(inp, sifa)) {
2557 atomic_add_intcxx . . $ `usrsctplib/user_atomic.h:94:9`!(&sifa->refcount, 1);
2558 return (sifa);
2559 }
2560 }
2561 }
2562 /*
2563 * ok, now we now need to find one on the list of the addresses.
2564 * We can't get one on the emitting interface so let's find first
2565 * a preferred one. If not that an acceptable one otherwise...
2566 * we return NULL.
2567 */
2568 starting_point = inp->next_addr_tousecxx . . $ sctp_inpcb#next_addr_touse.;
2569 once_again:
2570 if (inp->next_addr_tousecxx . . $ sctp_inpcb#next_addr_touse. == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!) {
2571 inp->next_addr_tousecxx . . $ sctp_inpcb#next_addr_touse. = LIST_FIRSTcxx . . $ `<external>/2546723208511035544/queue.h:143:9`!(&inp->sctp_addr_list);
2572 resettotop = 1;
2573 }
2574 for (laddr = inp->next_addr_tousecxx . . $ sctp_inpcb#next_addr_touse.; laddr;
2575 laddr = LIST_NEXTcxx . . $ `<external>/2546723208511035544/queue.h:144:9`!(laddr, sctp_nxt_addr)) {
2576 if (laddr->ifacxx . . $ sctp_laddr#ifa. == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!) {
2577 /* address has been removed */
2578 continue;
2579 }
2580 if (laddr->actioncxx . . $ sctp_laddr#action. == SCTP_DEL_IP_ADDRESScxx . . $ `usrsctplib/netinet/sctp_constants.h:436:9`!) {
2581 /* address is being deleted */
2582 continue;
2583 }
2584 sifa = sctp_is_ifa_addr_preferredcxx . . $ sctp_is_ifa_addr_preferred(f5b285baa6f0444f).(laddr->ifacxx . . $ sctp_laddr#ifa., dest_is_loop,
2585 dest_is_priv, fam);
2586 if (sifa == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!)
2587 continue;
2588 atomic_add_intcxx . . $ `usrsctplib/user_atomic.h:94:9`!(&sifa->refcount, 1);
2589 return (sifa);
2590 }
2591 if (resettotop == 0) {
2592 inp->next_addr_tousecxx . . $ sctp_inpcb#next_addr_touse. = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!;
2593 goto once_again;
2594 }
2595
2596 inp->next_addr_tousecxx . . $ sctp_inpcb#next_addr_touse. = starting_point;
2597 resettotop = 0;
2598 once_again_too:
2599 if (inp->next_addr_tousecxx . . $ sctp_inpcb#next_addr_touse. == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!) {
2600 inp->next_addr_tousecxx . . $ sctp_inpcb#next_addr_touse. = LIST_FIRSTcxx . . $ `<external>/2546723208511035544/queue.h:143:9`!(&inp->sctp_addr_list);
2601 resettotop = 1;
2602 }
2603
2604 /* ok, what about an acceptable address in the inp */
2605 for (laddr = inp->next_addr_tousecxx . . $ sctp_inpcb#next_addr_touse.; laddr;
2606 laddr = LIST_NEXTcxx . . $ `<external>/2546723208511035544/queue.h:144:9`!(laddr, sctp_nxt_addr)) {
2607 if (laddr->ifacxx . . $ sctp_laddr#ifa. == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!) {
2608 /* address has been removed */
2609 continue;
2610 }
2611 if (laddr->actioncxx . . $ sctp_laddr#action. == SCTP_DEL_IP_ADDRESScxx . . $ `usrsctplib/netinet/sctp_constants.h:436:9`!) {
2612 /* address is being deleted */
2613 continue;
2614 }
2615 sifa = sctp_is_ifa_addr_acceptablecxx . . $ sctp_is_ifa_addr_acceptable(f5b285baa6f0444f).(laddr->ifacxx . . $ sctp_laddr#ifa., dest_is_loop,
2616 dest_is_priv, fam);
2617 if (sifa == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!)
2618 continue;
2619 atomic_add_intcxx . . $ `usrsctplib/user_atomic.h:94:9`!(&sifa->refcount, 1);
2620 return (sifa);
2621 }
2622 if (resettotop == 0) {
2623 inp->next_addr_tousecxx . . $ sctp_inpcb#next_addr_touse. = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!;
2624 goto once_again_too;
2625 }
2626
2627 /*
2628 * no address bound can be a source for the destination we are in
2629 * trouble
2630 */
2631 return (NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!);
2632 }
2633
2634 static struct sctp_ifacxx . . $ sctp_ifa# *
2635 sctp_choose_boundspecific_stcbcxx . . $ sctp_choose_boundspecific_stcb(e69673cda45237de).(struct sctp_inpcbcxx . . $ sctp_inpcb# *inp,
2636 struct sctp_tcbcxx . . $ sctp_tcb# *stcb,
2637 sctp_route_tcxx . . $ sctp_route_t# *ro,
2638 uint32_tcxx . . $ uint32_t# vrf_id,
2639 uint8_tcxx . . $ uint8_t# dest_is_priv,
2640 uint8_tcxx . . $ uint8_t# dest_is_loop,
2641 int non_asoc_addr_ok,
2642 sa_family_tcxx . . $ sa_family_t# fam)
2643 {
2644 struct sctp_laddrcxx . . $ sctp_laddr# *laddr, *starting_point;
2645 void *ifn;
2646 struct sctp_ifncxx . . $ sctp_ifn# *sctp_ifn;
2647 struct sctp_ifacxx . . $ sctp_ifa# *sctp_ifa, *sifa;
2648 uint8_tcxx . . $ uint8_t# start_at_beginning = 0;
2649 struct sctp_vrfcxx . . $ sctp_vrf# *vrf;
2650 uint32_tcxx . . $ uint32_t# ifn_index;
2651
2652 /*
2653 * first question, is the ifn we will emit on in our list, if so, we
2654 * want that one.
2655 */
2656 vrf = sctp_find_vrfcxx . . $ sctp_find_vrf(3a554f7b877238ae).(vrf_id);
2657 if (vrf == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!)
2658 return (NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!);
2659
2660 ifn = SCTP_GET_IFN_VOID_FROM_ROUTEcxx . . $ `usrsctplib/netinet/sctp_os_userspace.h:655:9`!(ro);
2661 ifn_index = SCTP_GET_IF_INDEX_FROM_ROUTEcxx . . $ `usrsctplib/netinet/sctp_os_userspace.h:656:9`!(ro);
2662 sctp_ifn = sctp_find_ifncxx . . $ sctp_find_ifn(49a397a2897c363c).(ifn, ifn_index);
2663
2664 /*
2665 * first question, is the ifn we will emit on in our list? If so,
2666 * we want that one. First we look for a preferred. Second, we go
2667 * for an acceptable.
2668 */
2669 if (sctp_ifn) {
2670 /* first try for a preferred address on the ep */
2671 LIST_FOREACHcxx . . $ `<external>/2546723208511035544/queue.h:134:9`!(sctp_ifa, &sctp_ifn->ifalist, next_ifa) {
2672 #if defined(__FreeBSD__) && !defined(__Userspace__cxx . . $ `<built-in>:442:9`!)
2673 #ifdef INET
2674 if ((sctp_ifa->address.sa.sa_family == AF_INET) &&
2675 (prison_check_ip4(inp->ip_inp.inp.inp_cred,
2676 &sctp_ifa->address.sin.sin_addr) != 0)) {
2677 continue;
2678 }
2679 #endif
2680 #ifdef INET6
2681 if ((sctp_ifa->address.sa.sa_family == AF_INET6) &&
2682 (prison_check_ip6(inp->ip_inp.inp.inp_cred,
2683 &sctp_ifa->address.sin6.sin6_addr) != 0)) {
2684 continue;
2685 }
2686 #endif
2687 #endif
2688 if ((sctp_ifa->localifa_flagscxx . . $ sctp_ifa#localifa_flags. & SCTP_ADDR_DEFER_USEcxx . . $ `usrsctplib/netinet/sctp_pcb.h:102:9`!) && (non_asoc_addr_ok == 0))
2689 continue;
2690 if (sctp_is_addr_in_epcxx . . $ sctp_is_addr_in_ep(7058b806c9bbb4f6).(inp, sctp_ifa)) {
2691 sifa = sctp_is_ifa_addr_preferredcxx . . $ sctp_is_ifa_addr_preferred(f5b285baa6f0444f).(sctp_ifa, dest_is_loop, dest_is_priv, fam);
2692 if (sifa == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!)
2693 continue;
2694 if (((non_asoc_addr_ok == 0) &&
2695 (sctp_is_addr_restrictedcxx . . $ sctp_is_addr_restricted(c48a07521d21bc8a).(stcb, sifa))) ||
2696 (non_asoc_addr_ok &&
2697 (sctp_is_addr_restrictedcxx . . $ sctp_is_addr_restricted(c48a07521d21bc8a).(stcb, sifa)) &&
2698 (!sctp_is_addr_pendingcxx . . $ sctp_is_addr_pending(c48a07521d21bc8a).(stcb, sifa)))) {
2699 /* on the no-no list */
2700 continue;
2701 }
2702 atomic_add_intcxx . . $ `usrsctplib/user_atomic.h:94:9`!(&sifa->refcount, 1);
2703 return (sifa);
2704 }
2705 }
2706 /* next try for an acceptable address on the ep */
2707 LIST_FOREACHcxx . . $ `<external>/2546723208511035544/queue.h:134:9`!(sctp_ifa, &sctp_ifn->ifalist, next_ifa) {
2708 #if defined(__FreeBSD__) && !defined(__Userspace__cxx . . $ `<built-in>:442:9`!)
2709 #ifdef INET
2710 if ((sctp_ifa->address.sa.sa_family == AF_INET) &&
2711 (prison_check_ip4(inp->ip_inp.inp.inp_cred,
2712 &sctp_ifa->address.sin.sin_addr) != 0)) {
2713 continue;
2714 }
2715 #endif
2716 #ifdef INET6
2717 if ((sctp_ifa->address.sa.sa_family == AF_INET6) &&
2718 (prison_check_ip6(inp->ip_inp.inp.inp_cred,
2719 &sctp_ifa->address.sin6.sin6_addr) != 0)) {
2720 continue;
2721 }
2722 #endif
2723 #endif
2724 if ((sctp_ifa->localifa_flagscxx . . $ sctp_ifa#localifa_flags. & SCTP_ADDR_DEFER_USEcxx . . $ `usrsctplib/netinet/sctp_pcb.h:102:9`!) && (non_asoc_addr_ok == 0))
2725 continue;
2726 if (sctp_is_addr_in_epcxx . . $ sctp_is_addr_in_ep(7058b806c9bbb4f6).(inp, sctp_ifa)) {
2727 sifa= sctp_is_ifa_addr_acceptablecxx . . $ sctp_is_ifa_addr_acceptable(f5b285baa6f0444f).(sctp_ifa, dest_is_loop, dest_is_priv,fam);
2728 if (sifa == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!)
2729 continue;
2730 if (((non_asoc_addr_ok == 0) &&
2731 (sctp_is_addr_restrictedcxx . . $ sctp_is_addr_restricted(c48a07521d21bc8a).(stcb, sifa))) ||
2732 (non_asoc_addr_ok &&
2733 (sctp_is_addr_restrictedcxx . . $ sctp_is_addr_restricted(c48a07521d21bc8a).(stcb, sifa)) &&
2734 (!sctp_is_addr_pendingcxx . . $ sctp_is_addr_pending(c48a07521d21bc8a).(stcb, sifa)))) {
2735 /* on the no-no list */
2736 continue;
2737 }
2738 atomic_add_intcxx . . $ `usrsctplib/user_atomic.h:94:9`!(&sifa->refcount, 1);
2739 return (sifa);
2740 }
2741 }
2742 }
2743 /*
2744 * if we can't find one like that then we must look at all
2745 * addresses bound to pick one at first preferable then
2746 * secondly acceptable.
2747 */
2748 starting_point = stcb->asoccxx . . $ sctp_tcb#asoc..last_used_addresscxx . . $ sctp_association#last_used_address.;
2749 sctp_from_the_top:
2750 if (stcb->asoccxx . . $ sctp_tcb#asoc..last_used_addresscxx . . $ sctp_association#last_used_address. == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!) {
2751 start_at_beginning = 1;
2752 stcb->asoccxx . . $ sctp_tcb#asoc..last_used_addresscxx . . $ sctp_association#last_used_address. = LIST_FIRSTcxx . . $ `<external>/2546723208511035544/queue.h:143:9`!(&inp->sctp_addr_list);
2753 }
2754 /* search beginning with the last used address */
2755 for (laddr = stcb->asoccxx . . $ sctp_tcb#asoc..last_used_addresscxx . . $ sctp_association#last_used_address.; laddr;
2756 laddr = LIST_NEXTcxx . . $ `<external>/2546723208511035544/queue.h:144:9`!(laddr, sctp_nxt_addr)) {
2757 if (laddr->ifacxx . . $ sctp_laddr#ifa. == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!) {
2758 /* address has been removed */
2759 continue;
2760 }
2761 if (laddr->actioncxx . . $ sctp_laddr#action. == SCTP_DEL_IP_ADDRESScxx . . $ `usrsctplib/netinet/sctp_constants.h:436:9`!) {
2762 /* address is being deleted */
2763 continue;
2764 }
2765 sifa = sctp_is_ifa_addr_preferredcxx . . $ sctp_is_ifa_addr_preferred(f5b285baa6f0444f).(laddr->ifacxx . . $ sctp_laddr#ifa., dest_is_loop, dest_is_priv, fam);
2766 if (sifa == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!)
2767 continue;
2768 if (((non_asoc_addr_ok == 0) &&
2769 (sctp_is_addr_restrictedcxx . . $ sctp_is_addr_restricted(c48a07521d21bc8a).(stcb, sifa))) ||
2770 (non_asoc_addr_ok &&
2771 (sctp_is_addr_restrictedcxx . . $ sctp_is_addr_restricted(c48a07521d21bc8a).(stcb, sifa)) &&
2772 (!sctp_is_addr_pendingcxx . . $ sctp_is_addr_pending(c48a07521d21bc8a).(stcb, sifa)))) {
2773 /* on the no-no list */
2774 continue;
2775 }
2776 stcb->asoccxx . . $ sctp_tcb#asoc..last_used_addresscxx . . $ sctp_association#last_used_address. = laddr;
2777 atomic_add_intcxx . . $ `usrsctplib/user_atomic.h:94:9`!(&sifa->refcount, 1);
2778 return (sifa);
2779 }
2780 if (start_at_beginning == 0) {
2781 stcb->asoccxx . . $ sctp_tcb#asoc..last_used_addresscxx . . $ sctp_association#last_used_address. = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!;
2782 goto sctp_from_the_top;
2783 }
2784 /* now try for any higher scope than the destination */
2785 stcb->asoccxx . . $ sctp_tcb#asoc..last_used_addresscxx . . $ sctp_association#last_used_address. = starting_point;
2786 start_at_beginning = 0;
2787 sctp_from_the_top2:
2788 if (stcb->asoccxx . . $ sctp_tcb#asoc..last_used_addresscxx . . $ sctp_association#last_used_address. == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!) {
2789 start_at_beginning = 1;
2790 stcb->asoccxx . . $ sctp_tcb#asoc..last_used_addresscxx . . $ sctp_association#last_used_address. = LIST_FIRSTcxx . . $ `<external>/2546723208511035544/queue.h:143:9`!(&inp->sctp_addr_list);
2791 }
2792 /* search beginning with the last used address */
2793 for (laddr = stcb->asoccxx . . $ sctp_tcb#asoc..last_used_addresscxx . . $ sctp_association#last_used_address.; laddr;
2794 laddr = LIST_NEXTcxx . . $ `<external>/2546723208511035544/queue.h:144:9`!(laddr, sctp_nxt_addr)) {
2795 if (laddr->ifacxx . . $ sctp_laddr#ifa. == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!) {
2796 /* address has been removed */
2797 continue;
2798 }
2799 if (laddr->actioncxx . . $ sctp_laddr#action. == SCTP_DEL_IP_ADDRESScxx . . $ `usrsctplib/netinet/sctp_constants.h:436:9`!) {
2800 /* address is being deleted */
2801 continue;
2802 }
2803 sifa = sctp_is_ifa_addr_acceptablecxx . . $ sctp_is_ifa_addr_acceptable(f5b285baa6f0444f).(laddr->ifacxx . . $ sctp_laddr#ifa., dest_is_loop,
2804 dest_is_priv, fam);
2805 if (sifa == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!)
2806 continue;
2807 if (((non_asoc_addr_ok == 0) &&
2808 (sctp_is_addr_restrictedcxx . . $ sctp_is_addr_restricted(c48a07521d21bc8a).(stcb, sifa))) ||
2809 (non_asoc_addr_ok &&
2810 (sctp_is_addr_restrictedcxx . . $ sctp_is_addr_restricted(c48a07521d21bc8a).(stcb, sifa)) &&
2811 (!sctp_is_addr_pendingcxx . . $ sctp_is_addr_pending(c48a07521d21bc8a).(stcb, sifa)))) {
2812 /* on the no-no list */
2813 continue;
2814 }
2815 stcb->asoccxx . . $ sctp_tcb#asoc..last_used_addresscxx . . $ sctp_association#last_used_address. = laddr;
2816 atomic_add_intcxx . . $ `usrsctplib/user_atomic.h:94:9`!(&sifa->refcount, 1);
2817 return (sifa);
2818 }
2819 if (start_at_beginning == 0) {
2820 stcb->asoccxx . . $ sctp_tcb#asoc..last_used_addresscxx . . $ sctp_association#last_used_address. = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!;
2821 goto sctp_from_the_top2;
2822 }
2823 return (NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!);
2824 }
2825
2826 static struct sctp_ifacxx . . $ sctp_ifa# *
2827 sctp_select_nth_preferred_addr_from_ifn_boundallcxx . . $ sctp_select_nth_preferred_addr_from_ifn_boundall(e305c165acfc1f3c).(struct sctp_ifncxx . . $ sctp_ifn# *ifn,
2828 #if defined(__FreeBSD__) && !defined(__Userspace__cxx . . $ `<built-in>:442:9`!)
2829 struct sctp_inpcb *inp,
2830 #else
2831 struct sctp_inpcbcxx . . $ sctp_inpcb# *inp SCTP_UNUSEDcxx . . $ `usrsctplib/netinet/sctp_os_userspace.h:780:9`!,
2832 #endif
2833 struct sctp_tcbcxx . . $ sctp_tcb# *stcb,
2834 int non_asoc_addr_ok,
2835 uint8_tcxx . . $ uint8_t# dest_is_loop,
2836 uint8_tcxx . . $ uint8_t# dest_is_priv,
2837 int addr_wanted,
2838 sa_family_tcxx . . $ sa_family_t# fam,
2839 sctp_route_tcxx . . $ sctp_route_t# *ro)
2840 {
2841 struct sctp_ifacxx . . $ sctp_ifa# *ifa, *sifa;
2842 int num_eligible_addr = 0;
2843 #ifdef INET6cxx . . $ `<built-in>:432:9`!
2844 #ifdef SCTP_EMBEDDED_V6_SCOPE
2845 struct sockaddr_in6 sin6, lsa6;
2846
2847 if (fam == AF_INET6) {
2848 memcpy(&sin6, &ro->ro_dst, sizeof(struct sockaddr_in6));
2849 #ifdef SCTP_KAME
2850 (void)sa6_recoverscope(&sin6);
2851 #else
2852 (void)in6_recoverscope(&sin6, &sin6.sin6_addr, NULL);
2853 #endif /* SCTP_KAME */
2854 }
2855 #endif /* SCTP_EMBEDDED_V6_SCOPE */
2856 #endif /* INET6 */
2857 LIST_FOREACHcxx . . $ `<external>/2546723208511035544/queue.h:134:9`!(ifa, &ifn->ifalist, next_ifa) {
2858 #if defined(__FreeBSD__) && !defined(__Userspace__cxx . . $ `<built-in>:442:9`!)
2859 #ifdef INET
2860 if ((ifa->address.sa.sa_family == AF_INET) &&
2861 (prison_check_ip4(inp->ip_inp.inp.inp_cred,
2862 &ifa->address.sin.sin_addr) != 0)) {
2863 continue;
2864 }
2865 #endif
2866 #ifdef INET6
2867 if ((ifa->address.sa.sa_family == AF_INET6) &&
2868 (prison_check_ip6(inp->ip_inp.inp.inp_cred,
2869 &ifa->address.sin6.sin6_addr) != 0)) {
2870 continue;
2871 }
2872 #endif
2873 #endif
2874 if ((ifa->localifa_flagscxx . . $ sctp_ifa#localifa_flags. & SCTP_ADDR_DEFER_USEcxx . . $ `usrsctplib/netinet/sctp_pcb.h:102:9`!) &&
2875 (non_asoc_addr_ok == 0))
2876 continue;
2877 sifa = sctp_is_ifa_addr_preferredcxx . . $ sctp_is_ifa_addr_preferred(f5b285baa6f0444f).(ifa, dest_is_loop,
2878 dest_is_priv, fam);
2879 if (sifa == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!)
2880 continue;
2881 #ifdef INET6cxx . . $ `<built-in>:432:9`!
2882 if (fam == AF_INET6cxx . . $ `<external>/8962547315054503424/socket.h:105:9`! &&
2883 dest_is_loop &&
2884 sifa->src_is_loopcxx . . $ sctp_ifa#src_is_loop. && sifa->src_is_privcxx . . $ sctp_ifa#src_is_priv.) {
2885 /* don't allow fe80::1 to be a src on loop ::1, we don't list it
2886 * to the peer so we will get an abort.
2887 */
2888 continue;
2889 }
2890 #ifdef SCTP_EMBEDDED_V6_SCOPE
2891 if (fam == AF_INET6 &&
2892 IN6_IS_ADDR_LINKLOCAL(&sifa->address.sin6.sin6_addr) &&
2893 IN6_IS_ADDR_LINKLOCAL(&sin6.sin6_addr)) {
2894 /* link-local <-> link-local must belong to the same scope. */
2895 memcpy(&lsa6, &sifa->address.sin6, sizeof(struct sockaddr_in6));
2896 #ifdef SCTP_KAME
2897 (void)sa6_recoverscope(&lsa6);
2898 #else
2899 (void)in6_recoverscope(&lsa6, &lsa6.sin6_addr, NULL);
2900 #endif /* SCTP_KAME */
2901 if (sin6.sin6_scope_id != lsa6.sin6_scope_id) {
2902 continue;
2903 }
2904 }
2905 #endif /* SCTP_EMBEDDED_V6_SCOPE */
2906 #endif /* INET6 */
2907
2908 #if defined(__FreeBSD__) || defined(__APPLE__) || defined(__Userspace__cxx . . $ `<built-in>:442:9`!)
2909 /* Check if the IPv6 address matches to next-hop.
2910 In the mobile case, old IPv6 address may be not deleted
2911 from the interface. Then, the interface has previous and
2912 new addresses. We should use one corresponding to the
2913 next-hop. (by micchie)
2914 */
2915 #ifdef INET6cxx . . $ `<built-in>:432:9`!
2916 if (stcb && fam == AF_INET6cxx . . $ `<external>/8962547315054503424/socket.h:105:9`! &&
2917 sctp_is_mobility_feature_oncxx . . $ `usrsctplib/netinet/sctp_var.h:85:9`!(stcb->sctp_ep, SCTP_MOBILITY_BASEcxx . . $ `usrsctplib/netinet/sctp.h:601:9`!)) {
2918 if (sctp_v6src_match_nexthopcxx . . $ sctp_v6src_match_nexthop(5fd08f6fe6ec8888).(&sifa->addresscxx . . $ sctp_ifa#address..sin6, ro)
2919 == 0) {
2920 continue;
2921 }
2922 }
2923 #endif
2924 #ifdef INETcxx . . $ `<built-in>:431:9`!
2925 /* Avoid topologically incorrect IPv4 address */
2926 if (stcb && fam == AF_INETcxx . . $ `<external>/8962547315054503424/socket.h:97:9`! &&
2927 sctp_is_mobility_feature_oncxx . . $ `usrsctplib/netinet/sctp_var.h:85:9`!(stcb->sctp_ep, SCTP_MOBILITY_BASEcxx . . $ `usrsctplib/netinet/sctp.h:601:9`!)) {
2928 if (sctp_v4src_match_nexthopcxx . . $ sctp_v4src_match_nexthop(43a5fcdb6d536ef6).(sifa, ro) == 0) {
2929 continue;
2930 }
2931 }
2932 #endif
2933 #endif
2934 if (stcb) {
2935 if (sctp_is_address_in_scopecxx . . $ sctp_is_address_in_scope(1ddcbca5a886b8b1).(ifa, &stcb->asoccxx . . $ sctp_tcb#asoc..scopecxx . . $ sctp_association#scope., 0) == 0) {
2936 continue;
2937 }
2938 if (((non_asoc_addr_ok == 0) &&
2939 (sctp_is_addr_restrictedcxx . . $ sctp_is_addr_restricted(c48a07521d21bc8a).(stcb, sifa))) ||
2940 (non_asoc_addr_ok &&
2941 (sctp_is_addr_restrictedcxx . . $ sctp_is_addr_restricted(c48a07521d21bc8a).(stcb, sifa)) &&
2942 (!sctp_is_addr_pendingcxx . . $ sctp_is_addr_pending(c48a07521d21bc8a).(stcb, sifa)))) {
2943 /*
2944 * It is restricted for some reason..
2945 * probably not yet added.
2946 */
2947 continue;
2948 }
2949 }
2950 if (num_eligible_addr >= addr_wanted) {
2951 return (sifa);
2952 }
2953 num_eligible_addr++;
2954 }
2955 return (NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!);
2956 }
2957
2958 static int
2959 sctp_count_num_preferred_boundallcxx . . $ sctp_count_num_preferred_boundall(e4f5ed445df079d3).(struct sctp_ifncxx . . $ sctp_ifn# *ifn,
2960 #if defined(__FreeBSD__) && !defined(__Userspace__cxx . . $ `<built-in>:442:9`!)
2961 struct sctp_inpcb *inp,
2962 #else
2963 struct sctp_inpcbcxx . . $ sctp_inpcb# *inp SCTP_UNUSEDcxx . . $ `usrsctplib/netinet/sctp_os_userspace.h:780:9`!,
2964 #endif
2965 struct sctp_tcbcxx . . $ sctp_tcb# *stcb,
2966 int non_asoc_addr_ok,
2967 uint8_tcxx . . $ uint8_t# dest_is_loop,
2968 uint8_tcxx . . $ uint8_t# dest_is_priv,
2969 sa_family_tcxx . . $ sa_family_t# fam)
2970 {
2971 struct sctp_ifacxx . . $ sctp_ifa# *ifa, *sifa;
2972 int num_eligible_addr = 0;
2973
2974 LIST_FOREACHcxx . . $ `<external>/2546723208511035544/queue.h:134:9`!(ifa, &ifn->ifalist, next_ifa) {
2975 #if defined(__FreeBSD__) && !defined(__Userspace__cxx . . $ `<built-in>:442:9`!)
2976 #ifdef INET
2977 if ((ifa->address.sa.sa_family == AF_INET) &&
2978 (prison_check_ip4(inp->ip_inp.inp.inp_cred,
2979 &ifa->address.sin.sin_addr) != 0)) {
2980 continue;
2981 }
2982 #endif
2983 #ifdef INET6
2984 if ((ifa->address.sa.sa_family == AF_INET6) &&
2985 (stcb != NULL) &&
2986 (prison_check_ip6(inp->ip_inp.inp.inp_cred,
2987 &ifa->address.sin6.sin6_addr) != 0)) {
2988 continue;
2989 }
2990 #endif
2991 #endif
2992 if ((ifa->localifa_flagscxx . . $ sctp_ifa#localifa_flags. & SCTP_ADDR_DEFER_USEcxx . . $ `usrsctplib/netinet/sctp_pcb.h:102:9`!) &&
2993 (non_asoc_addr_ok == 0)) {
2994 continue;
2995 }
2996 sifa = sctp_is_ifa_addr_preferredcxx . . $ sctp_is_ifa_addr_preferred(f5b285baa6f0444f).(ifa, dest_is_loop,
2997 dest_is_priv, fam);
2998 if (sifa == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!) {
2999 continue;
3000 }
3001 if (stcb) {
3002 if (sctp_is_address_in_scopecxx . . $ sctp_is_address_in_scope(1ddcbca5a886b8b1).(ifa, &stcb->asoccxx . . $ sctp_tcb#asoc..scopecxx . . $ sctp_association#scope., 0) == 0) {
3003 continue;
3004 }
3005 if (((non_asoc_addr_ok == 0) &&
3006 (sctp_is_addr_restrictedcxx . . $ sctp_is_addr_restricted(c48a07521d21bc8a).(stcb, sifa))) ||
3007 (non_asoc_addr_ok &&
3008 (sctp_is_addr_restrictedcxx . . $ sctp_is_addr_restricted(c48a07521d21bc8a).(stcb, sifa)) &&
3009 (!sctp_is_addr_pendingcxx . . $ sctp_is_addr_pending(c48a07521d21bc8a).(stcb, sifa)))) {
3010 /*
3011 * It is restricted for some reason..
3012 * probably not yet added.
3013 */
3014 continue;
3015 }
3016 }
3017 num_eligible_addr++;
3018 }
3019 return (num_eligible_addr);
3020 }
3021
3022 static struct sctp_ifacxx . . $ sctp_ifa# *
3023 sctp_choose_boundallcxx . . $ sctp_choose_boundall(8ad7c683279bfa89).(struct sctp_inpcbcxx . . $ sctp_inpcb# *inp,
3024 struct sctp_tcbcxx . . $ sctp_tcb# *stcb,
3025 struct sctp_netscxx . . $ sctp_nets# *net,
3026 sctp_route_tcxx . . $ sctp_route_t# *ro,
3027 uint32_tcxx . . $ uint32_t# vrf_id,
3028 uint8_tcxx . . $ uint8_t# dest_is_priv,
3029 uint8_tcxx . . $ uint8_t# dest_is_loop,
3030 int non_asoc_addr_ok,
3031 sa_family_tcxx . . $ sa_family_t# fam)
3032 {
3033 int cur_addr_num = 0, num_preferred = 0;
3034 void *ifn;
3035 struct sctp_ifncxx . . $ sctp_ifn# *sctp_ifn, *looked_at = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!, *emit_ifn;
3036 struct sctp_ifacxx . . $ sctp_ifa# *sctp_ifa, *sifa;
3037 uint32_tcxx . . $ uint32_t# ifn_index;
3038 struct sctp_vrfcxx . . $ sctp_vrf# *vrf;
3039 #ifdef INETcxx . . $ `<built-in>:431:9`!
3040 int retried = 0;
3041 #endif
3042
3043 /*-
3044 * For boundall we can use any address in the association.
3045 * If non_asoc_addr_ok is set we can use any address (at least in
3046 * theory). So we look for preferred addresses first. If we find one,
3047 * we use it. Otherwise we next try to get an address on the
3048 * interface, which we should be able to do (unless non_asoc_addr_ok
3049 * is false and we are routed out that way). In these cases where we
3050 * can't use the address of the interface we go through all the
3051 * ifn's looking for an address we can use and fill that in. Punting
3052 * means we send back address 0, which will probably cause problems
3053 * actually since then IP will fill in the address of the route ifn,
3054 * which means we probably already rejected it.. i.e. here comes an
3055 * abort :-<.
3056 */
3057 vrf = sctp_find_vrfcxx . . $ sctp_find_vrf(3a554f7b877238ae).(vrf_id);
3058 if (vrf == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!)
3059 return (NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!);
3060
3061 ifn = SCTP_GET_IFN_VOID_FROM_ROUTEcxx . . $ `usrsctplib/netinet/sctp_os_userspace.h:655:9`!(ro);
3062 ifn_index = SCTP_GET_IF_INDEX_FROM_ROUTEcxx . . $ `usrsctplib/netinet/sctp_os_userspace.h:656:9`!(ro);
3063 SCTPDBGcxx . . $ `usrsctplib/netinet/sctp_os_userspace.h:591:9`!(SCTP_DEBUG_OUTPUT2cxx . . $ `usrsctplib/netinet/sctp_constants.h:644:9`!,"ifn from route:%p ifn_index:%d\n", ifn, ifn_index);
3064 emit_ifn = looked_at = sctp_ifn = sctp_find_ifncxx . . $ sctp_find_ifn(49a397a2897c363c).(ifn, ifn_index);
3065 if (sctp_ifn == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!) {
3066 /* ?? We don't have this guy ?? */
3067 SCTPDBGcxx . . $ `usrsctplib/netinet/sctp_os_userspace.h:591:9`!(SCTP_DEBUG_OUTPUT2cxx . . $ `usrsctplib/netinet/sctp_constants.h:644:9`!,"No ifn emit interface?\n");
3068 goto bound_all_plan_b;
3069 }
3070 SCTPDBGcxx . . $ `usrsctplib/netinet/sctp_os_userspace.h:591:9`!(SCTP_DEBUG_OUTPUT2cxx . . $ `usrsctplib/netinet/sctp_constants.h:644:9`!,"ifn_index:%d name:%s is emit interface\n",
3071 ifn_index, sctp_ifn->ifn_name);
3072
3073 if (net) {
3074 cur_addr_num = net->indx_of_eligible_next_to_usecxx . . $ sctp_nets#indx_of_eligible_next_to_use.;
3075 }
3076 num_preferred = sctp_count_num_preferred_boundallcxx . . $ sctp_count_num_preferred_boundall(e4f5ed445df079d3).(sctp_ifn,
3077 inp, stcb,
3078 non_asoc_addr_ok,
3079 dest_is_loop,
3080 dest_is_priv, fam);
3081 SCTPDBGcxx . . $ `usrsctplib/netinet/sctp_os_userspace.h:591:9`!(SCTP_DEBUG_OUTPUT2cxx . . $ `usrsctplib/netinet/sctp_constants.h:644:9`!, "Found %d preferred source addresses for intf:%s\n",
3082 num_preferred, sctp_ifn->ifn_name);
3083 if (num_preferred == 0) {
3084 /*
3085 * no eligible addresses, we must use some other interface
3086 * address if we can find one.
3087 */
3088 goto bound_all_plan_b;
3089 }
3090 /*
3091 * Ok we have num_eligible_addr set with how many we can use, this
3092 * may vary from call to call due to addresses being deprecated
3093 * etc..
3094 */
3095 if (cur_addr_num >= num_preferred) {
3096 cur_addr_num = 0;
3097 }
3098 /*
3099 * select the nth address from the list (where cur_addr_num is the
3100 * nth) and 0 is the first one, 1 is the second one etc...
3101 */
3102 SCTPDBGcxx . . $ `usrsctplib/netinet/sctp_os_userspace.h:591:9`!(SCTP_DEBUG_OUTPUT2cxx . . $ `usrsctplib/netinet/sctp_constants.h:644:9`!, "cur_addr_num:%d\n", cur_addr_num);
3103
3104 sctp_ifa = sctp_select_nth_preferred_addr_from_ifn_boundallcxx . . $ sctp_select_nth_preferred_addr_from_ifn_boundall(e305c165acfc1f3c).(sctp_ifn, inp, stcb, non_asoc_addr_ok, dest_is_loop,
3105 dest_is_priv, cur_addr_num, fam, ro);
3106
3107 /* if sctp_ifa is NULL something changed??, fall to plan b. */
3108 if (sctp_ifa) {
3109 atomic_add_intcxx . . $ `usrsctplib/user_atomic.h:94:9`!(&sctp_ifa->refcount, 1);
3110 if (net) {
3111 /* save off where the next one we will want */
3112 net->indx_of_eligible_next_to_usecxx . . $ sctp_nets#indx_of_eligible_next_to_use. = cur_addr_num + 1;
3113 }
3114 return (sctp_ifa);
3115 }
3116 /*
3117 * plan_b: Look at all interfaces and find a preferred address. If
3118 * no preferred fall through to plan_c.
3119 */
3120 bound_all_plan_b:
3121 SCTPDBGcxx . . $ `usrsctplib/netinet/sctp_os_userspace.h:591:9`!(SCTP_DEBUG_OUTPUT2cxx . . $ `usrsctplib/netinet/sctp_constants.h:644:9`!, "Trying Plan B\n");
3122 LIST_FOREACHcxx . . $ `<external>/2546723208511035544/queue.h:134:9`!(sctp_ifn, &vrf->ifnlist, next_ifn) {
3123 SCTPDBGcxx . . $ `usrsctplib/netinet/sctp_os_userspace.h:591:9`!(SCTP_DEBUG_OUTPUT2cxx . . $ `usrsctplib/netinet/sctp_constants.h:644:9`!, "Examine interface %s\n",
3124 sctp_ifn->ifn_name);
3125 if (dest_is_loop == 0 && SCTP_IFN_IS_IFT_LOOPcxx . . $ `usrsctplib/netinet/sctp_os_userspace.h:645:9`!(sctp_ifn)) {
3126 /* wrong base scope */
3127 SCTPDBGcxx . . $ `usrsctplib/netinet/sctp_os_userspace.h:591:9`!(SCTP_DEBUG_OUTPUT2cxx . . $ `usrsctplib/netinet/sctp_constants.h:644:9`!, "skip\n");
3128 continue;
3129 }
3130 if ((sctp_ifn == looked_at) && looked_at) {
3131 /* already looked at this guy */
3132 SCTPDBGcxx . . $ `usrsctplib/netinet/sctp_os_userspace.h:591:9`!(SCTP_DEBUG_OUTPUT2cxx . . $ `usrsctplib/netinet/sctp_constants.h:644:9`!, "already seen\n");
3133 continue;
3134 }
3135 num_preferred = sctp_count_num_preferred_boundallcxx . . $ sctp_count_num_preferred_boundall(e4f5ed445df079d3).(sctp_ifn, inp, stcb, non_asoc_addr_ok,
3136 dest_is_loop, dest_is_priv, fam);
3137 SCTPDBGcxx . . $ `usrsctplib/netinet/sctp_os_userspace.h:591:9`!(SCTP_DEBUG_OUTPUT2cxx . . $ `usrsctplib/netinet/sctp_constants.h:644:9`!,
3138 "Found ifn:%p %d preferred source addresses\n",
3139 ifn, num_preferred);
3140 if (num_preferred == 0) {
3141 /* None on this interface. */
3142 SCTPDBGcxx . . $ `usrsctplib/netinet/sctp_os_userspace.h:591:9`!(SCTP_DEBUG_OUTPUT2cxx . . $ `usrsctplib/netinet/sctp_constants.h:644:9`!, "No preferred -- skipping to next\n");
3143 continue;
3144 }
3145 SCTPDBGcxx . . $ `usrsctplib/netinet/sctp_os_userspace.h:591:9`!(SCTP_DEBUG_OUTPUT2cxx . . $ `usrsctplib/netinet/sctp_constants.h:644:9`!,
3146 "num preferred:%d on interface:%p cur_addr_num:%d\n",
3147 num_preferred, (void *)sctp_ifn, cur_addr_num);
3148
3149 /*
3150 * Ok we have num_eligible_addr set with how many we can
3151 * use, this may vary from call to call due to addresses
3152 * being deprecated etc..
3153 */
3154 if (cur_addr_num >= num_preferred) {
3155 cur_addr_num = 0;
3156 }
3157 sifa = sctp_select_nth_preferred_addr_from_ifn_boundallcxx . . $ sctp_select_nth_preferred_addr_from_ifn_boundall(e305c165acfc1f3c).(sctp_ifn, inp, stcb, non_asoc_addr_ok, dest_is_loop,
3158 dest_is_priv, cur_addr_num, fam, ro);
3159 if (sifa == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!)
3160 continue;
3161 if (net) {
3162 net->indx_of_eligible_next_to_usecxx . . $ sctp_nets#indx_of_eligible_next_to_use. = cur_addr_num + 1;
3163 SCTPDBGcxx . . $ `usrsctplib/netinet/sctp_os_userspace.h:591:9`!(SCTP_DEBUG_OUTPUT2cxx . . $ `usrsctplib/netinet/sctp_constants.h:644:9`!, "we selected %d\n",
3164 cur_addr_num);
3165 SCTPDBGcxx . . $ `usrsctplib/netinet/sctp_os_userspace.h:591:9`!(SCTP_DEBUG_OUTPUT2cxx . . $ `usrsctplib/netinet/sctp_constants.h:644:9`!, "Source:");
3166 SCTPDBG_ADDRcxx . . $ `usrsctplib/netinet/sctp_os_userspace.h:599:9`!(SCTP_DEBUG_OUTPUT2cxx . . $ `usrsctplib/netinet/sctp_constants.h:644:9`!, &sifa->address.sa);
3167 SCTPDBGcxx . . $ `usrsctplib/netinet/sctp_os_userspace.h:591:9`!(SCTP_DEBUG_OUTPUT2cxx . . $ `usrsctplib/netinet/sctp_constants.h:644:9`!, "Dest:");
3168 SCTPDBG_ADDRcxx . . $ `usrsctplib/netinet/sctp_os_userspace.h:599:9`!(SCTP_DEBUG_OUTPUT2cxx . . $ `usrsctplib/netinet/sctp_constants.h:644:9`!, &net->ro._l_addr.sa);
3169 }
3170 atomic_add_intcxx . . $ `usrsctplib/user_atomic.h:94:9`!(&sifa->refcount, 1);
3171 return (sifa);
3172 }
3173 #ifdef INETcxx . . $ `<built-in>:431:9`!
3174 again_with_private_addresses_allowed:
3175 #endif
3176 /* plan_c: do we have an acceptable address on the emit interface */
3177 sifa = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!;
3178 SCTPDBGcxx . . $ `usrsctplib/netinet/sctp_os_userspace.h:591:9`!(SCTP_DEBUG_OUTPUT2cxx . . $ `usrsctplib/netinet/sctp_constants.h:644:9`!,"Trying Plan C: find acceptable on interface\n");
3179 if (emit_ifn == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!) {
3180 SCTPDBGcxx . . $ `usrsctplib/netinet/sctp_os_userspace.h:591:9`!(SCTP_DEBUG_OUTPUT2cxx . . $ `usrsctplib/netinet/sctp_constants.h:644:9`!,"Jump to Plan D - no emit_ifn\n");
3181 goto plan_d;
3182 }
3183 LIST_FOREACHcxx . . $ `<external>/2546723208511035544/queue.h:134:9`!(sctp_ifa, &emit_ifn->ifalist, next_ifa) {
3184 SCTPDBGcxx . . $ `usrsctplib/netinet/sctp_os_userspace.h:591:9`!(SCTP_DEBUG_OUTPUT2cxx . . $ `usrsctplib/netinet/sctp_constants.h:644:9`!, "ifa:%p\n", (void *)sctp_ifa);
3185 #if defined(__FreeBSD__) && !defined(__Userspace__cxx . . $ `<built-in>:442:9`!)
3186 #ifdef INET
3187 if ((sctp_ifa->address.sa.sa_family == AF_INET) &&
3188 (prison_check_ip4(inp->ip_inp.inp.inp_cred,
3189 &sctp_ifa->address.sin.sin_addr) != 0)) {
3190 SCTPDBG(SCTP_DEBUG_OUTPUT2,"Jailed\n");
3191 continue;
3192 }
3193 #endif
3194 #ifdef INET6
3195 if ((sctp_ifa->address.sa.sa_family == AF_INET6) &&
3196 (prison_check_ip6(inp->ip_inp.inp.inp_cred,
3197 &sctp_ifa->address.sin6.sin6_addr) != 0)) {
3198 SCTPDBG(SCTP_DEBUG_OUTPUT2,"Jailed\n");
3199 continue;
3200 }
3201 #endif
3202 #endif
3203 if ((sctp_ifa->localifa_flagscxx . . $ sctp_ifa#localifa_flags. & SCTP_ADDR_DEFER_USEcxx . . $ `usrsctplib/netinet/sctp_pcb.h:102:9`!) &&
3204 (non_asoc_addr_ok == 0)) {
3205 SCTPDBGcxx . . $ `usrsctplib/netinet/sctp_os_userspace.h:591:9`!(SCTP_DEBUG_OUTPUT2cxx . . $ `usrsctplib/netinet/sctp_constants.h:644:9`!,"Defer\n");
3206 continue;
3207 }
3208 sifa = sctp_is_ifa_addr_acceptablecxx . . $ sctp_is_ifa_addr_acceptable(f5b285baa6f0444f).(sctp_ifa, dest_is_loop,
3209 dest_is_priv, fam);
3210 if (sifa == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!) {
3211 SCTPDBGcxx . . $ `usrsctplib/netinet/sctp_os_userspace.h:591:9`!(SCTP_DEBUG_OUTPUT2cxx . . $ `usrsctplib/netinet/sctp_constants.h:644:9`!, "IFA not acceptable\n");
3212 continue;
3213 }
3214 if (stcb) {
3215 if (sctp_is_address_in_scopecxx . . $ sctp_is_address_in_scope(1ddcbca5a886b8b1).(sifa, &stcb->asoccxx . . $ sctp_tcb#asoc..scopecxx . . $ sctp_association#scope., 0) == 0) {
3216 SCTPDBGcxx . . $ `usrsctplib/netinet/sctp_os_userspace.h:591:9`!(SCTP_DEBUG_OUTPUT2cxx . . $ `usrsctplib/netinet/sctp_constants.h:644:9`!, "NOT in scope\n");
3217 sifa = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!;
3218 continue;
3219 }
3220 if (((non_asoc_addr_ok == 0) &&
3221 (sctp_is_addr_restrictedcxx . . $ sctp_is_addr_restricted(c48a07521d21bc8a).(stcb, sifa))) ||
3222 (non_asoc_addr_ok &&
3223 (sctp_is_addr_restrictedcxx . . $ sctp_is_addr_restricted(c48a07521d21bc8a).(stcb, sifa)) &&
3224 (!sctp_is_addr_pendingcxx . . $ sctp_is_addr_pending(c48a07521d21bc8a).(stcb, sifa)))) {
3225 /*
3226 * It is restricted for some
3227 * reason.. probably not yet added.
3228 */
3229 SCTPDBGcxx . . $ `usrsctplib/netinet/sctp_os_userspace.h:591:9`!(SCTP_DEBUG_OUTPUT2cxx . . $ `usrsctplib/netinet/sctp_constants.h:644:9`!, "Its restricted\n");
3230 sifa = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!;
3231 continue;
3232 }
3233 }
3234 atomic_add_intcxx . . $ `usrsctplib/user_atomic.h:94:9`!(&sifa->refcount, 1);
3235 goto out;
3236 }
3237 plan_d:
3238 /*
3239 * plan_d: We are in trouble. No preferred address on the emit
3240 * interface. And not even a preferred address on all interfaces.
3241 * Go out and see if we can find an acceptable address somewhere
3242 * amongst all interfaces.
3243 */
3244 SCTPDBGcxx . . $ `usrsctplib/netinet/sctp_os_userspace.h:591:9`!(SCTP_DEBUG_OUTPUT2cxx . . $ `usrsctplib/netinet/sctp_constants.h:644:9`!, "Trying Plan D looked_at is %p\n", (void *)looked_at);
3245 LIST_FOREACHcxx . . $ `<external>/2546723208511035544/queue.h:134:9`!(sctp_ifn, &vrf->ifnlist, next_ifn) {
3246 if (dest_is_loop == 0 && SCTP_IFN_IS_IFT_LOOPcxx . . $ `usrsctplib/netinet/sctp_os_userspace.h:645:9`!(sctp_ifn)) {
3247 /* wrong base scope */
3248 continue;
3249 }
3250 LIST_FOREACHcxx . . $ `<external>/2546723208511035544/queue.h:134:9`!(sctp_ifa, &sctp_ifn->ifalist, next_ifa) {
3251 #if defined(__FreeBSD__) && !defined(__Userspace__cxx . . $ `<built-in>:442:9`!)
3252 #ifdef INET
3253 if ((sctp_ifa->address.sa.sa_family == AF_INET) &&
3254 (prison_check_ip4(inp->ip_inp.inp.inp_cred,
3255 &sctp_ifa->address.sin.sin_addr) != 0)) {
3256 continue;
3257 }
3258 #endif
3259 #ifdef INET6
3260 if ((sctp_ifa->address.sa.sa_family == AF_INET6) &&
3261 (prison_check_ip6(inp->ip_inp.inp.inp_cred,
3262 &sctp_ifa->address.sin6.sin6_addr) != 0)) {
3263 continue;
3264 }
3265 #endif
3266 #endif
3267 if ((sctp_ifa->localifa_flagscxx . . $ sctp_ifa#localifa_flags. & SCTP_ADDR_DEFER_USEcxx . . $ `usrsctplib/netinet/sctp_pcb.h:102:9`!) &&
3268 (non_asoc_addr_ok == 0))
3269 continue;
3270 sifa = sctp_is_ifa_addr_acceptablecxx . . $ sctp_is_ifa_addr_acceptable(f5b285baa6f0444f).(sctp_ifa,
3271 dest_is_loop,
3272 dest_is_priv, fam);
3273 if (sifa == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!)
3274 continue;
3275 if (stcb) {
3276 if (sctp_is_address_in_scopecxx . . $ sctp_is_address_in_scope(1ddcbca5a886b8b1).(sifa, &stcb->asoccxx . . $ sctp_tcb#asoc..scopecxx . . $ sctp_association#scope., 0) == 0) {
3277 sifa = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!;
3278 continue;
3279 }
3280 if (((non_asoc_addr_ok == 0) &&
3281 (sctp_is_addr_restrictedcxx . . $ sctp_is_addr_restricted(c48a07521d21bc8a).(stcb, sifa))) ||
3282 (non_asoc_addr_ok &&
3283 (sctp_is_addr_restrictedcxx . . $ sctp_is_addr_restricted(c48a07521d21bc8a).(stcb, sifa)) &&
3284 (!sctp_is_addr_pendingcxx . . $ sctp_is_addr_pending(c48a07521d21bc8a).(stcb, sifa)))) {
3285 /*
3286 * It is restricted for some
3287 * reason.. probably not yet added.
3288 */
3289 sifa = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!;
3290 continue;
3291 }
3292 }
3293 goto out;
3294 }
3295 }
3296 #ifdef INETcxx . . $ `<built-in>:431:9`!
3297 if (stcb) {
3298 if ((retried == 0) && (stcb->asoccxx . . $ sctp_tcb#asoc..scopecxx . . $ sctp_association#scope..ipv4_local_scopecxx . . $ sctp_scoping#ipv4_local_scope. == 0)) {
3299 stcb->asoccxx . . $ sctp_tcb#asoc..scopecxx . . $ sctp_association#scope..ipv4_local_scopecxx . . $ sctp_scoping#ipv4_local_scope. = 1;
3300 retried = 1;
3301 goto again_with_private_addresses_allowed;
3302 } else if (retried == 1) {
3303 stcb->asoccxx . . $ sctp_tcb#asoc..scopecxx . . $ sctp_association#scope..ipv4_local_scopecxx . . $ sctp_scoping#ipv4_local_scope. = 0;
3304 }
3305 }
3306 #endif
3307 out:
3308 #ifdef INETcxx . . $ `<built-in>:431:9`!
3309 if (sifa) {
3310 if (retried == 1) {
3311 LIST_FOREACHcxx . . $ `<external>/2546723208511035544/queue.h:134:9`!(sctp_ifn, &vrf->ifnlist, next_ifn) {
3312 if (dest_is_loop == 0 && SCTP_IFN_IS_IFT_LOOPcxx . . $ `usrsctplib/netinet/sctp_os_userspace.h:645:9`!(sctp_ifn)) {
3313 /* wrong base scope */
3314 continue;
3315 }
3316 LIST_FOREACHcxx . . $ `<external>/2546723208511035544/queue.h:134:9`!(sctp_ifa, &sctp_ifn->ifalist, next_ifa) {
3317 struct sctp_ifacxx . . $ sctp_ifa# *tmp_sifa;
3318
3319 #if defined(__FreeBSD__) && !defined(__Userspace__cxx . . $ `<built-in>:442:9`!)
3320 #ifdef INET
3321 if ((sctp_ifa->address.sa.sa_family == AF_INET) &&
3322 (prison_check_ip4(inp->ip_inp.inp.inp_cred,
3323 &sctp_ifa->address.sin.sin_addr) != 0)) {
3324 continue;
3325 }
3326 #endif
3327 #ifdef INET6
3328 if ((sctp_ifa->address.sa.sa_family == AF_INET6) &&
3329 (prison_check_ip6(inp->ip_inp.inp.inp_cred,
3330 &sctp_ifa->address.sin6.sin6_addr) != 0)) {
3331 continue;
3332 }
3333 #endif
3334 #endif
3335 if ((sctp_ifa->localifa_flagscxx . . $ sctp_ifa#localifa_flags. & SCTP_ADDR_DEFER_USEcxx . . $ `usrsctplib/netinet/sctp_pcb.h:102:9`!) &&
3336 (non_asoc_addr_ok == 0))
3337 continue;
3338 tmp_sifa = sctp_is_ifa_addr_acceptablecxx . . $ sctp_is_ifa_addr_acceptable(f5b285baa6f0444f).(sctp_ifa,
3339 dest_is_loop,
3340 dest_is_priv, fam);
3341 if (tmp_sifa == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!) {
3342 continue;
3343 }
3344 if (tmp_sifa == sifa) {
3345 continue;
3346 }
3347 if (stcb) {
3348 if (sctp_is_address_in_scopecxx . . $ sctp_is_address_in_scope(1ddcbca5a886b8b1).(tmp_sifa,
3349 &stcb->asoccxx . . $ sctp_tcb#asoc..scopecxx . . $ sctp_association#scope., 0) == 0) {
3350 continue;
3351 }
3352 if (((non_asoc_addr_ok == 0) &&
3353 (sctp_is_addr_restrictedcxx . . $ sctp_is_addr_restricted(c48a07521d21bc8a).(stcb, tmp_sifa))) ||
3354 (non_asoc_addr_ok &&
3355 (sctp_is_addr_restrictedcxx . . $ sctp_is_addr_restricted(c48a07521d21bc8a).(stcb, tmp_sifa)) &&
3356 (!sctp_is_addr_pendingcxx . . $ sctp_is_addr_pending(c48a07521d21bc8a).(stcb, tmp_sifa)))) {
3357 /*
3358 * It is restricted for some
3359 * reason.. probably not yet added.
3360 */
3361 continue;
3362 }
3363 }
3364 if ((tmp_sifa->addresscxx . . $ sctp_ifa#address..sin.sin_familycxx . . $ sockaddr_in#sin_family. == AF_INETcxx . . $ `<external>/8962547315054503424/socket.h:97:9`!) &&
3365 (IN4_ISPRIVATE_ADDRESScxx . . $ `usrsctplib/netinet/sctp_constants.h:972:9`!(&(tmp_sifa->address.sin.sin_addr)))) {
3366 sctp_add_local_addr_restrictedcxx . . $ sctp_add_local_addr_restricted(56107be0849d2d1a).(stcb, tmp_sifa);
3367 }
3368 }
3369 }
3370 }
3371 atomic_add_intcxx . . $ `usrsctplib/user_atomic.h:94:9`!(&sifa->refcount, 1);
3372 }
3373 #endif
3374 return (sifa);
3375 }
3376
3377 /* tcb may be NULL */
3378 struct sctp_ifacxx . . $ sctp_ifa# *
3379 sctp_source_address_selectioncxx . . $ sctp_source_address_selection(8ee075f20da66e1).(struct sctp_inpcbcxx . . $ sctp_inpcb# *inp,
3380 struct sctp_tcbcxx . . $ sctp_tcb# *stcb,
3381 sctp_route_tcxx . . $ sctp_route_t# *ro,
3382 struct sctp_netscxx . . $ sctp_nets# *net,
3383 int non_asoc_addr_ok, uint32_tcxx . . $ uint32_t# vrf_id)
3384 {
3385 struct sctp_ifacxx . . $ sctp_ifa# *answer;
3386 uint8_tcxx . . $ uint8_t# dest_is_priv, dest_is_loop;
3387 sa_family_tcxx . . $ sa_family_t# fam;
3388 #ifdef INETcxx . . $ `<built-in>:431:9`!
3389 struct sockaddr_incxx . . $ sockaddr_in# *to = (struct sockaddr_incxx . . $ sockaddr_in# *)&ro->ro_dstcxx . . $ sctp_route#ro_dst.;
3390 #endif
3391 #ifdef INET6cxx . . $ `<built-in>:432:9`!
3392 struct sockaddr_in6cxx . . $ sockaddr_in6# *to6 = (struct sockaddr_in6cxx . . $ sockaddr_in6# *)&ro->ro_dstcxx . . $ sctp_route#ro_dst.;
3393 #endif
3394
3395 /**
3396 * Rules:
3397 * - Find the route if needed, cache if I can.
3398 * - Look at interface address in route, Is it in the bound list. If so we
3399 * have the best source.
3400 * - If not we must rotate amongst the addresses.
3401 *
3402 * Cavets and issues
3403 *
3404 * Do we need to pay attention to scope. We can have a private address
3405 * or a global address we are sourcing or sending to. So if we draw
3406 * it out
3407 * zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz
3408 * For V4
3409 * ------------------------------------------
3410 * source * dest * result
3411 * -----------------------------------------
3412 * <a> Private * Global * NAT
3413 * -----------------------------------------
3414 * <b> Private * Private * No problem
3415 * -----------------------------------------
3416 * <c> Global * Private * Huh, How will this work?
3417 * -----------------------------------------
3418 * <d> Global * Global * No Problem
3419 *------------------------------------------
3420 * zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz
3421 * For V6
3422 *------------------------------------------
3423 * source * dest * result
3424 * -----------------------------------------
3425 * <a> Linklocal * Global *
3426 * -----------------------------------------
3427 * <b> Linklocal * Linklocal * No problem
3428 * -----------------------------------------
3429 * <c> Global * Linklocal * Huh, How will this work?
3430 * -----------------------------------------
3431 * <d> Global * Global * No Problem
3432 *------------------------------------------
3433 * zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz
3434 *
3435 * And then we add to that what happens if there are multiple addresses
3436 * assigned to an interface. Remember the ifa on a ifn is a linked
3437 * list of addresses. So one interface can have more than one IP
3438 * address. What happens if we have both a private and a global
3439 * address? Do we then use context of destination to sort out which
3440 * one is best? And what about NAT's sending P->G may get you a NAT
3441 * translation, or should you select the G thats on the interface in
3442 * preference.
3443 *
3444 * Decisions:
3445 *
3446 * - count the number of addresses on the interface.
3447 * - if it is one, no problem except case <c>.
3448 * For <a> we will assume a NAT out there.
3449 * - if there are more than one, then we need to worry about scope P
3450 * or G. We should prefer G -> G and P -> P if possible.
3451 * Then as a secondary fall back to mixed types G->P being a last
3452 * ditch one.
3453 * - The above all works for bound all, but bound specific we need to
3454 * use the same concept but instead only consider the bound
3455 * addresses. If the bound set is NOT assigned to the interface then
3456 * we must use rotation amongst the bound addresses..
3457 */
3458 #if defined(__FreeBSD__) && !defined(__Userspace__cxx . . $ `<built-in>:442:9`!)
3459 if (ro->ro_nh == NULL) {
3460 #else
3461 if (ro->ro_rtcxx . . $ sctp_route#ro_rt. == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!) {
3462 #endif
3463 /*
3464 * Need a route to cache.
3465 */
3466 SCTP_RTALLOCcxx . . $ `usrsctplib/netinet/sctp_os_userspace.h:860:9`!(ro, vrf_id, inp->fibnum);
3467 }
3468 #if defined(__FreeBSD__) && !defined(__Userspace__cxx . . $ `<built-in>:442:9`!)
3469 if (ro->ro_nh == NULL) {
3470 #else
3471 if (ro->ro_rtcxx . . $ sctp_route#ro_rt. == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!) {
3472 #endif
3473 return (NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!);
3474 }
3475 #if defined(_WIN32)
3476 /* On Windows the sa_family is U_SHORT or ADDRESS_FAMILY */
3477 fam = (sa_family_t)ro->ro_dst.sa_family;
3478 #else
3479 fam = ro->ro_dstcxx . . $ sctp_route#ro_dst..sa_familycxx . . $ sockaddr#sa_family.;
3480 #endif
3481 dest_is_priv = dest_is_loop = 0;
3482 /* Setup our scopes for the destination */
3483 switch (fam) {
3484 #ifdef INETcxx . . $ `<built-in>:431:9`!
3485 case AF_INETcxx . . $ `<external>/8962547315054503424/socket.h:97:9`!:
3486 /* Scope based on outbound address */
3487 if (IN4_ISLOOPBACK_ADDRESScxx . . $ `usrsctplib/netinet/sctp_constants.h:980:9`!(&to->sin_addr)) {
3488 dest_is_loop = 1;
3489 if (net != NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!) {
3490 /* mark it as local */
3491 net->addr_is_localcxx . . $ sctp_nets#addr_is_local. = 1;
3492 }
3493 } else if ((IN4_ISPRIVATE_ADDRESScxx . . $ `usrsctplib/netinet/sctp_constants.h:972:9`!(&to->sin_addr))) {
3494 dest_is_priv = 1;
3495 }
3496 break;
3497 #endif
3498 #ifdef INET6cxx . . $ `<built-in>:432:9`!
3499 case AF_INET6cxx . . $ `<external>/8962547315054503424/socket.h:105:9`!:
3500 /* Scope based on outbound address */
3501 #if defined(_WIN32)
3502 if (IN6_IS_ADDR_LOOPBACK(&to6->sin6_addr)) {
3503 #else
3504 if (IN6_IS_ADDR_LOOPBACKcxx . . $ `<external>/9581057695539925927/in.h:445:10`!(&to6->sin6_addr) ||
3505 SCTP_ROUTE_IS_REAL_LOOPcxx . . $ `usrsctplib/netinet/sctp_os_userspace.h:649:9`!(ro)) {
3506 #endif
3507 /*
3508 * If the address is a loopback address, which
3509 * consists of "::1" OR "fe80::1%lo0", we are loopback
3510 * scope. But we don't use dest_is_priv (link local
3511 * addresses).
3512 */
3513 dest_is_loop = 1;
3514 if (net != NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!) {
3515 /* mark it as local */
3516 net->addr_is_localcxx . . $ sctp_nets#addr_is_local. = 1;
3517 }
3518 } else if (IN6_IS_ADDR_LINKLOCALcxx . . $ `<external>/9581057695539925927/in.h:453:10`!(&to6->sin6_addr)) {
3519 dest_is_priv = 1;
3520 }
3521 break;
3522 #endif
3523 }
3524 SCTPDBGcxx . . $ `usrsctplib/netinet/sctp_os_userspace.h:591:9`!(SCTP_DEBUG_OUTPUT2cxx . . $ `usrsctplib/netinet/sctp_constants.h:644:9`!, "Select source addr for:");
3525 SCTPDBG_ADDRcxx . . $ `usrsctplib/netinet/sctp_os_userspace.h:599:9`!(SCTP_DEBUG_OUTPUT2cxx . . $ `usrsctplib/netinet/sctp_constants.h:644:9`!, (struct sockaddr *)&ro->ro_dst);
3526 SCTP_IPI_ADDR_RLOCKcxx . . $ `usrsctplib/netinet/sctp_process_lock.h:589:9`!();
3527 if (inp->sctp_flagscxx . . $ sctp_inpcb#sctp_flags. & SCTP_PCB_FLAGS_BOUNDALLcxx . . $ `usrsctplib/netinet/sctp.h:525:9`!) {
3528 /*
3529 * Bound all case
3530 */
3531 answer = sctp_choose_boundallcxx . . $ sctp_choose_boundall(8ad7c683279bfa89).(inp, stcb, net, ro, vrf_id,
3532 dest_is_priv, dest_is_loop,
3533 non_asoc_addr_ok, fam);
3534 SCTP_IPI_ADDR_RUNLOCKcxx . . $ `usrsctplib/netinet/sctp_process_lock.h:591:9`!();
3535 return (answer);
3536 }
3537 /*
3538 * Subset bound case
3539 */
3540 if (stcb) {
3541 answer = sctp_choose_boundspecific_stcbcxx . . $ sctp_choose_boundspecific_stcb(e69673cda45237de).(inp, stcb, ro,
3542 vrf_id, dest_is_priv,
3543 dest_is_loop,
3544 non_asoc_addr_ok, fam);
3545 } else {
3546 answer = sctp_choose_boundspecific_inpcxx . . $ sctp_choose_boundspecific_inp(b5cb8f7ca38bc87).(inp, ro, vrf_id,
3547 non_asoc_addr_ok,
3548 dest_is_priv,
3549 dest_is_loop, fam);
3550 }
3551 SCTP_IPI_ADDR_RUNLOCKcxx . . $ `usrsctplib/netinet/sctp_process_lock.h:591:9`!();
3552 return (answer);
3553 }
3554
3555 static int
3556 sctp_find_cmsgcxx . . $ sctp_find_cmsg(6b8ad251416065d1).(int c_type, void *data, struct mbufcxx . . $ mbuf# *control, size_t cpsize)
3557 {
3558 #if defined(_WIN32)
3559 WSACMSGHDR cmh;
3560 #else
3561 struct cmsghdrcxx . . $ cmsghdr# cmh;
3562 #endif
3563 struct sctp_sndinfo sndinfo;
3564 struct sctp_prinfo prinfo;
3565 struct sctp_authinfo authinfo;
3566 int tot_len, rem_len, cmsg_data_len, cmsg_data_off, off;
3567 int found;
3568
3569 /*
3570 * Independent of how many mbufs, find the c_type inside the control
3571 * structure and copy out the data.
3572 */
3573 found = 0;
3574 tot_len = SCTP_BUF_LENcxx . . $ `usrsctplib/netinet/sctp_os_userspace.h:790:9`!(control);
3575 for (off = 0; off < tot_len; off += CMSG_ALIGNcxx . . $ `<external>/8962547315054503424/socket.h:307:9`!(cmh.cmsg_len)) {
3576 rem_len = tot_len - off;
3577 if (rem_len < (int)CMSG_ALIGNcxx . . $ `<external>/8962547315054503424/socket.h:307:9`!(sizeof(cmh))) {
3578 /* There is not enough room for one more. */
3579 return (found);
3580 }
3581 m_copydatacxx . . $ m_copydata(fee92403c79d6892).(control, off, sizeof(cmh), (caddr_tcxx . . $ caddr_t#)&cmh);
3582 if (cmh.cmsg_lencxx . . $ cmsghdr#cmsg_len. < CMSG_ALIGNcxx . . $ `<external>/8962547315054503424/socket.h:307:9`!(sizeof(cmh))) {
3583 /* We dont't have a complete CMSG header. */
3584 return (found);
3585 }
3586 if ((cmh.cmsg_lencxx . . $ cmsghdr#cmsg_len. > INT_MAXcxx . . $ `<external>/67164224788392828/limits.h:120:9`!) || ((int)cmh.cmsg_lencxx . . $ cmsghdr#cmsg_len. > rem_len)) {
3587 /* We don't have the complete CMSG. */
3588 return (found);
3589 }
3590 cmsg_data_len = (int)cmh.cmsg_lencxx . . $ cmsghdr#cmsg_len. - CMSG_ALIGNcxx . . $ `<external>/8962547315054503424/socket.h:307:9`!(sizeof(cmh));
3591 cmsg_data_off = off + CMSG_ALIGNcxx . . $ `<external>/8962547315054503424/socket.h:307:9`!(sizeof(cmh));
3592 if ((cmh.cmsg_levelcxx . . $ cmsghdr#cmsg_level. == IPPROTO_SCTPcxx . . $ `<external>/9581057695539925927/in.h:87:9`!) &&
3593 ((c_type == cmh.cmsg_typecxx . . $ cmsghdr#cmsg_type.) ||
3594 ((c_type == SCTP_SNDRCVcxx . . $ `./netinet/sctp_uio.h:98:9`!) &&
3595 ((cmh.cmsg_typecxx . . $ cmsghdr#cmsg_type. == SCTP_SNDINFOcxx . . $ `./netinet/sctp_uio.h:100:9`!) ||
3596 (cmh.cmsg_typecxx . . $ cmsghdr#cmsg_type. == SCTP_PRINFOcxx . . $ `./netinet/sctp_uio.h:103:9`!) ||
3597 (cmh.cmsg_typecxx . . $ cmsghdr#cmsg_type. == SCTP_AUTHINFOcxx . . $ `./netinet/sctp_uio.h:104:9`!))))) {
3598 if (c_type == cmh.cmsg_typecxx . . $ cmsghdr#cmsg_type.) {
3599 if (cpsize > INT_MAXcxx . . $ `<external>/67164224788392828/limits.h:120:9`!) {
3600 return (found);
3601 }
3602 if (cmsg_data_len < (int)cpsize) {
3603 return (found);
3604 }
3605 /* It is exactly what we want. Copy it out. */
3606 m_copydatacxx . . $ m_copydata(fee92403c79d6892).(control, cmsg_data_off, (int)cpsize, (caddr_tcxx . . $ caddr_t#)data);
3607 return (1);
3608 } else {
3609 struct sctp_sndrcvinfo *sndrcvinfo;
3610
3611 sndrcvinfo = (struct sctp_sndrcvinfo *)data;
3612 if (found == 0) {
3613 if (cpsize < sizeof(struct sctp_sndrcvinfo)) {
3614 return (found);
3615 }
3616 memsetcxx . . $ memset(d1de1e4fb215f1c6).(sndrcvinfo, 0, sizeof(struct sctp_sndrcvinfo));
3617 }
3618 switch (cmh.cmsg_typecxx . . $ cmsghdr#cmsg_type.) {
3619 case SCTP_SNDINFOcxx . . $ `./netinet/sctp_uio.h:100:9`!:
3620 if (cmsg_data_len < (int)sizeof(struct sctp_sndinfo)) {
3621 return (found);
3622 }
3623 m_copydatacxx . . $ m_copydata(fee92403c79d6892).(control, cmsg_data_off, sizeof(struct sctp_sndinfo), (caddr_tcxx . . $ caddr_t#)&sndinfo);
3624 sndrcvinfo->sinfo_stream = sndinfo.snd_sid;
3625 sndrcvinfo->sinfo_flags = sndinfo.snd_flags;
3626 sndrcvinfo->sinfo_ppid = sndinfo.snd_ppid;
3627 sndrcvinfo->sinfo_context = sndinfo.snd_context;
3628 sndrcvinfo->sinfo_assoc_id = sndinfo.snd_assoc_id;
3629 break;
3630 case SCTP_PRINFOcxx . . $ `./netinet/sctp_uio.h:103:9`!:
3631 if (cmsg_data_len < (int)sizeof(struct sctp_prinfo)) {
3632 return (found);
3633 }
3634 m_copydatacxx . . $ m_copydata(fee92403c79d6892).(control, cmsg_data_off, sizeof(struct sctp_prinfo), (caddr_tcxx . . $ caddr_t#)&prinfo);
3635 if (prinfo.pr_policy != SCTP_PR_SCTP_NONEcxx . . $ `./netinet/sctp_uio.h:277:9`!) {
3636 sndrcvinfo->sinfo_timetolive = prinfo.pr_value;
3637 } else {
3638 sndrcvinfo->sinfo_timetolive = 0;
3639 }
3640 sndrcvinfo->sinfo_flags |= prinfo.pr_policy;
3641 break;
3642 case SCTP_AUTHINFOcxx . . $ `./netinet/sctp_uio.h:104:9`!:
3643 if (cmsg_data_len < (int)sizeof(struct sctp_authinfo)) {
3644 return (found);
3645 }
3646 m_copydatacxx . . $ m_copydata(fee92403c79d6892).(control, cmsg_data_off, sizeof(struct sctp_authinfo), (caddr_tcxx . . $ caddr_t#)&authinfo);
3647 sndrcvinfo->sinfo_keynumber_valid = 1;
3648 sndrcvinfo->sinfo_keynumber = authinfo.auth_keynumber;
3649 break;
3650 default:
3651 return (found);
3652 }
3653 found = 1;
3654 }
3655 }
3656 }
3657 return (found);
3658 }
3659
3660 static int
3661 sctp_process_cmsgs_for_initcxx . . $ sctp_process_cmsgs_for_init(da2a9b99f7879c8a).(struct sctp_tcbcxx . . $ sctp_tcb# *stcb, struct mbufcxx . . $ mbuf# *control, int *error)
3662 {
3663 #if defined(_WIN32)
3664 WSACMSGHDR cmh;
3665 #else
3666 struct cmsghdrcxx . . $ cmsghdr# cmh;
3667 #endif
3668 struct sctp_initmsg initmsg;
3669 #ifdef INETcxx . . $ `<built-in>:431:9`!
3670 struct sockaddr_incxx . . $ sockaddr_in# sin;
3671 #endif
3672 #ifdef INET6cxx . . $ `<built-in>:432:9`!
3673 struct sockaddr_in6cxx . . $ sockaddr_in6# sin6;
3674 #endif
3675 int tot_len, rem_len, cmsg_data_len, cmsg_data_off, off;
3676
3677 tot_len = SCTP_BUF_LENcxx . . $ `usrsctplib/netinet/sctp_os_userspace.h:790:9`!(control);
3678 for (off = 0; off < tot_len; off += CMSG_ALIGNcxx . . $ `<external>/8962547315054503424/socket.h:307:9`!(cmh.cmsg_len)) {
3679 rem_len = tot_len - off;
3680 if (rem_len < (int)CMSG_ALIGNcxx . . $ `<external>/8962547315054503424/socket.h:307:9`!(sizeof(cmh))) {
3681 /* There is not enough room for one more. */
3682 *error = EINVALcxx . . $ `<external>/8987895939074593727/errno-base.h:26:9`!;
3683 return (1);
3684 }
3685 m_copydatacxx . . $ m_copydata(fee92403c79d6892).(control, off, sizeof(cmh), (caddr_tcxx . . $ caddr_t#)&cmh);
3686 if (cmh.cmsg_lencxx . . $ cmsghdr#cmsg_len. < CMSG_ALIGNcxx . . $ `<external>/8962547315054503424/socket.h:307:9`!(sizeof(cmh))) {
3687 /* We dont't have a complete CMSG header. */
3688 *error = EINVALcxx . . $ `<external>/8987895939074593727/errno-base.h:26:9`!;
3689 return (1);
3690 }
3691 if ((cmh.cmsg_lencxx . . $ cmsghdr#cmsg_len. > INT_MAXcxx . . $ `<external>/67164224788392828/limits.h:120:9`!) || ((int)cmh.cmsg_lencxx . . $ cmsghdr#cmsg_len. > rem_len)) {
3692 /* We don't have the complete CMSG. */
3693 *error = EINVALcxx . . $ `<external>/8987895939074593727/errno-base.h:26:9`!;
3694 return (1);
3695 }
3696 cmsg_data_len = (int)cmh.cmsg_lencxx . . $ cmsghdr#cmsg_len. - CMSG_ALIGNcxx . . $ `<external>/8962547315054503424/socket.h:307:9`!(sizeof(cmh));
3697 cmsg_data_off = off + CMSG_ALIGNcxx . . $ `<external>/8962547315054503424/socket.h:307:9`!(sizeof(cmh));
3698 if (cmh.cmsg_levelcxx . . $ cmsghdr#cmsg_level. == IPPROTO_SCTPcxx . . $ `<external>/9581057695539925927/in.h:87:9`!) {
3699 switch (cmh.cmsg_typecxx . . $ cmsghdr#cmsg_type.) {
3700 case SCTP_INITcxx . . $ `./netinet/sctp_uio.h:97:9`!:
3701 if (cmsg_data_len < (int)sizeof(struct sctp_initmsg)) {
3702 *error = EINVALcxx . . $ `<external>/8987895939074593727/errno-base.h:26:9`!;
3703 return (1);
3704 }
3705 m_copydatacxx . . $ m_copydata(fee92403c79d6892).(control, cmsg_data_off, sizeof(struct sctp_initmsg), (caddr_tcxx . . $ caddr_t#)&initmsg);
3706 if (initmsg.sinit_max_attempts)
3707 stcb->asoccxx . . $ sctp_tcb#asoc..max_init_timescxx . . $ sctp_association#max_init_times. = initmsg.sinit_max_attempts;
3708 if (initmsg.sinit_num_ostreams)
3709 stcb->asoccxx . . $ sctp_tcb#asoc..pre_open_streamscxx . . $ sctp_association#pre_open_streams. = initmsg.sinit_num_ostreams;
3710 if (initmsg.sinit_max_instreams)
3711 stcb->asoccxx . . $ sctp_tcb#asoc..max_inbound_streamscxx . . $ sctp_association#max_inbound_streams. = initmsg.sinit_max_instreams;
3712 if (initmsg.sinit_max_init_timeo)
3713 stcb->asoccxx . . $ sctp_tcb#asoc..initial_init_rto_maxcxx . . $ sctp_association#initial_init_rto_max. = initmsg.sinit_max_init_timeo;
3714 if (stcb->asoccxx . . $ sctp_tcb#asoc..streamoutcntcxx . . $ sctp_association#streamoutcnt. < stcb->asoccxx . . $ sctp_tcb#asoc..pre_open_streamscxx . . $ sctp_association#pre_open_streams.) {
3715 struct sctp_stream_outcxx . . $ sctp_stream_out# *tmp_str;
3716 unsigned int i;
3717 #if defined(SCTP_DETAILED_STR_STATS)
3718 int j;
3719 #endif
3720
3721 /* Default is NOT correct */
3722 SCTPDBGcxx . . $ `usrsctplib/netinet/sctp_os_userspace.h:591:9`!(SCTP_DEBUG_OUTPUT1cxx . . $ `usrsctplib/netinet/sctp_constants.h:643:9`!, "Ok, default:%d pre_open:%d\n",
3723 stcb->asoc.streamoutcnt, stcb->asoc.pre_open_streams);
3724 SCTP_TCB_UNLOCKcxx . . $ `usrsctplib/netinet/sctp_process_lock.h:476:9`!(stcb);
3725 SCTP_MALLOCcxx . . $ `usrsctplib/netinet/sctp_os_userspace.h:663:9`!(tmp_str,
3726 struct sctp_stream_out *,
3727 (stcb->asoc.pre_open_streams * sizeof(struct sctp_stream_out)),
3728 SCTP_M_STRMO);
3729 SCTP_TCB_LOCKcxx . . $ `usrsctplib/netinet/sctp_process_lock.h:473:9`!(stcb);
3730 if (tmp_str != NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!) {
3731 SCTP_FREEcxx . . $ `usrsctplib/netinet/sctp_os_userspace.h:668:9`!(stcb->asoc.strmout, SCTP_M_STRMO);
3732 stcb->asoccxx . . $ sctp_tcb#asoc..strmoutcxx . . $ sctp_association#strmout. = tmp_str;
3733 stcb->asoccxx . . $ sctp_tcb#asoc..strm_realoutsizecxx . . $ sctp_association#strm_realoutsize. = stcb->asoccxx . . $ sctp_tcb#asoc..streamoutcntcxx . . $ sctp_association#streamoutcnt. = stcb->asoccxx . . $ sctp_tcb#asoc..pre_open_streamscxx . . $ sctp_association#pre_open_streams.;
3734 } else {
3735 stcb->asoccxx . . $ sctp_tcb#asoc..pre_open_streamscxx . . $ sctp_association#pre_open_streams. = stcb->asoccxx . . $ sctp_tcb#asoc..streamoutcntcxx . . $ sctp_association#streamoutcnt.;
3736 }
3737 for (i = 0; i < stcb->asoccxx . . $ sctp_tcb#asoc..streamoutcntcxx . . $ sctp_association#streamoutcnt.; i++) {
3738 TAILQ_INITcxx . . $ `<external>/2546723208511035544/queue.h:387:9`!(&stcb->asoc.strmout[i].outqueue);
3739 stcb->asoccxx . . $ sctp_tcb#asoc..strmoutcxx . . $ sctp_association#strmout.[i].chunks_on_queuescxx . . $ sctp_stream_out#chunks_on_queues. = 0;
3740 stcb->asoccxx . . $ sctp_tcb#asoc..strmoutcxx . . $ sctp_association#strmout.[i].next_mid_orderedcxx . . $ sctp_stream_out#next_mid_ordered. = 0;
3741 stcb->asoccxx . . $ sctp_tcb#asoc..strmoutcxx . . $ sctp_association#strmout.[i].next_mid_unorderedcxx . . $ sctp_stream_out#next_mid_unordered. = 0;
3742 #if defined(SCTP_DETAILED_STR_STATS)
3743 for (j = 0; j < SCTP_PR_SCTP_MAX + 1; j++) {
3744 stcb->asoc.strmout[i].abandoned_sent[j] = 0;
3745 stcb->asoc.strmout[i].abandoned_unsent[j] = 0;
3746 }
3747 #else
3748 stcb->asoccxx . . $ sctp_tcb#asoc..strmoutcxx . . $ sctp_association#strmout.[i].abandoned_sentcxx . . $ sctp_stream_out#abandoned_sent.[0] = 0;
3749 stcb->asoccxx . . $ sctp_tcb#asoc..strmoutcxx . . $ sctp_association#strmout.[i].abandoned_unsentcxx . . $ sctp_stream_out#abandoned_unsent.[0] = 0;
3750 #endif
3751 stcb->asoccxx . . $ sctp_tcb#asoc..strmoutcxx . . $ sctp_association#strmout.[i].sidcxx . . $ sctp_stream_out#sid. = i;
3752 stcb->asoccxx . . $ sctp_tcb#asoc..strmoutcxx . . $ sctp_association#strmout.[i].last_msg_incompletecxx . . $ sctp_stream_out#last_msg_incomplete. = 0;
3753 stcb->asoccxx . . $ sctp_tcb#asoc..strmoutcxx . . $ sctp_association#strmout.[i].statecxx . . $ sctp_stream_out#state. = SCTP_STREAM_OPENINGcxx . . $ `usrsctplib/netinet/sctp_structs.h:649:9`!;
3754 stcb->asoccxx . . $ sctp_tcb#asoc..ss_functionscxx . . $ sctp_association#ss_functions..sctp_ss_init_streamcxx . . $ sctp_ss_functions#sctp_ss_init_stream.(stcb, &stcb->asoccxx . . $ sctp_tcb#asoc..strmoutcxx . . $ sctp_association#strmout.[i], NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!);
3755 }
3756 }
3757 break;
3758 #ifdef INETcxx . . $ `<built-in>:431:9`!
3759 case SCTP_DSTADDRV4cxx . . $ `./netinet/sctp_uio.h:105:9`!:
3760 if (cmsg_data_len < (int)sizeof(struct in_addrcxx . . $ in_addr#)) {
3761 *error = EINVALcxx . . $ `<external>/8987895939074593727/errno-base.h:26:9`!;
3762 return (1);
3763 }
3764 memsetcxx . . $ memset(d1de1e4fb215f1c6).(&sin, 0, sizeof(struct sockaddr_incxx . . $ sockaddr_in#));
3765 sin.sin_familycxx . . $ sockaddr_in#sin_family. = AF_INETcxx . . $ `<external>/8962547315054503424/socket.h:97:9`!;
3766 #ifdef HAVE_SIN_LEN
3767 sin.sin_len = sizeof(struct sockaddr_in);
3768 #endif
3769 sin.sin_portcxx . . $ sockaddr_in#sin_port. = stcb->rportcxx . . $ sctp_tcb#rport.;
3770 m_copydatacxx . . $ m_copydata(fee92403c79d6892).(control, cmsg_data_off, sizeof(struct in_addrcxx . . $ in_addr#), (caddr_tcxx . . $ caddr_t#)&sin.sin_addrcxx . . $ sockaddr_in#sin_addr.);
3771 if ((sin.sin_addrcxx . . $ sockaddr_in#sin_addr..s_addrcxx . . $ in_addr#s_addr. == INADDR_ANYcxx . . $ `<external>/9581057695539925927/in.h:198:9`!) ||
3772 (sin.sin_addrcxx . . $ sockaddr_in#sin_addr..s_addrcxx . . $ in_addr#s_addr. == INADDR_BROADCASTcxx . . $ `<external>/9581057695539925927/in.h:200:9`!) ||
3773 IN_MULTICASTcxx . . $ `<external>/9581057695539925927/in.h:192:9`!(ntohl(sin.sin_addr.s_addr))) {
3774 *error = EINVALcxx . . $ `<external>/8987895939074593727/errno-base.h:26:9`!;
3775 return (1);
3776 }
3777 if (sctp_add_remote_addrcxx . . $ sctp_add_remote_addr(2130f96c5b688f48).(stcb, (struct sockaddrcxx . . $ sockaddr# *)&sin, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!, stcb->asoccxx . . $ sctp_tcb#asoc..portcxx . . $ sctp_association#port.,
3778 SCTP_DONOT_SETSCOPEcxx . . $ `usrsctplib/netinet/sctp_constants.h:826:9`!, SCTP_ADDR_IS_CONFIRMEDcxx . . $ `usrsctplib/netinet/sctp_constants.h:817:9`!)) {
3779 *error = ENOBUFScxx . . $ `<external>/17922322188510340118/errno.h:89:9`!;
3780 return (1);
3781 }
3782 break;
3783 #endif
3784 #ifdef INET6cxx . . $ `<built-in>:432:9`!
3785 case SCTP_DSTADDRV6cxx . . $ `./netinet/sctp_uio.h:106:9`!:
3786 if (cmsg_data_len < (int)sizeof(struct in6_addrcxx . . $ in6_addr#)) {
3787 *error = EINVALcxx . . $ `<external>/8987895939074593727/errno-base.h:26:9`!;
3788 return (1);
3789 }
3790 memsetcxx . . $ memset(d1de1e4fb215f1c6).(&sin6, 0, sizeof(struct sockaddr_in6cxx . . $ sockaddr_in6#));
3791 sin6.sin6_familycxx . . $ sockaddr_in6#sin6_family. = AF_INET6cxx . . $ `<external>/8962547315054503424/socket.h:105:9`!;
3792 #ifdef HAVE_SIN6_LEN
3793 sin6.sin6_len = sizeof(struct sockaddr_in6);
3794 #endif
3795 sin6.sin6_portcxx . . $ sockaddr_in6#sin6_port. = stcb->rportcxx . . $ sctp_tcb#rport.;
3796 m_copydatacxx . . $ m_copydata(fee92403c79d6892).(control, cmsg_data_off, sizeof(struct in6_addrcxx . . $ in6_addr#), (caddr_tcxx . . $ caddr_t#)&sin6.sin6_addrcxx . . $ sockaddr_in6#sin6_addr.);
3797 if (IN6_IS_ADDR_UNSPECIFIEDcxx . . $ `<external>/9581057695539925927/in.h:437:10`!(&sin6.sin6_addr) ||
3798 IN6_IS_ADDR_MULTICASTcxx . . $ `<external>/9581057695539925927/in.h:525:9`!(&sin6.sin6_addr)) {
3799 *error = EINVALcxx . . $ `<external>/8987895939074593727/errno-base.h:26:9`!;
3800 return (1);
3801 }
3802 #ifdef INETcxx . . $ `<built-in>:431:9`!
3803 if (IN6_IS_ADDR_V4MAPPEDcxx . . $ `<external>/9581057695539925927/in.h:463:10`!(&sin6.sin6_addr)) {
3804 in6_sin6_2_sincxx . . $ in6_sin6_2_sin(65922a4b0f886efe).(&sin, &sin6);
3805 if ((sin.sin_addrcxx . . $ sockaddr_in#sin_addr..s_addrcxx . . $ in_addr#s_addr. == INADDR_ANYcxx . . $ `<external>/9581057695539925927/in.h:198:9`!) ||
3806 (sin.sin_addrcxx . . $ sockaddr_in#sin_addr..s_addrcxx . . $ in_addr#s_addr. == INADDR_BROADCASTcxx . . $ `<external>/9581057695539925927/in.h:200:9`!) ||
3807 IN_MULTICASTcxx . . $ `<external>/9581057695539925927/in.h:192:9`!(ntohl(sin.sin_addr.s_addr))) {
3808 *error = EINVALcxx . . $ `<external>/8987895939074593727/errno-base.h:26:9`!;
3809 return (1);
3810 }
3811 if (sctp_add_remote_addrcxx . . $ sctp_add_remote_addr(2130f96c5b688f48).(stcb, (struct sockaddrcxx . . $ sockaddr# *)&sin, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!, stcb->asoccxx . . $ sctp_tcb#asoc..portcxx . . $ sctp_association#port.,
3812 SCTP_DONOT_SETSCOPEcxx . . $ `usrsctplib/netinet/sctp_constants.h:826:9`!, SCTP_ADDR_IS_CONFIRMEDcxx . . $ `usrsctplib/netinet/sctp_constants.h:817:9`!)) {
3813 *error = ENOBUFScxx . . $ `<external>/17922322188510340118/errno.h:89:9`!;
3814 return (1);
3815 }
3816 } else
3817 #endif
3818 if (sctp_add_remote_addrcxx . . $ sctp_add_remote_addr(2130f96c5b688f48).(stcb, (struct sockaddrcxx . . $ sockaddr# *)&sin6, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!, stcb->asoccxx . . $ sctp_tcb#asoc..portcxx . . $ sctp_association#port.,
3819 SCTP_DONOT_SETSCOPEcxx . . $ `usrsctplib/netinet/sctp_constants.h:826:9`!, SCTP_ADDR_IS_CONFIRMEDcxx . . $ `usrsctplib/netinet/sctp_constants.h:817:9`!)) {
3820 *error = ENOBUFScxx . . $ `<external>/17922322188510340118/errno.h:89:9`!;
3821 return (1);
3822 }
3823 break;
3824 #endif
3825 default:
3826 break;
3827 }
3828 }
3829 }
3830 return (0);
3831 }
3832
3833 #if defined(INETcxx . . $ `<built-in>:431:9`!) || defined(INET6cxx . . $ `<built-in>:432:9`!)
3834 static struct sctp_tcbcxx . . $ sctp_tcb# *
3835 sctp_findassociation_cmsgscxx . . $ sctp_findassociation_cmsgs(87f9494bfc331360).(struct sctp_inpcbcxx . . $ sctp_inpcb# **inp_p,
3836 uint16_tcxx . . $ uint16_t# port,
3837 struct mbufcxx . . $ mbuf# *control,
3838 struct sctp_netscxx . . $ sctp_nets# **net_p,
3839 int *error)
3840 {
3841 #if defined(_WIN32)
3842 WSACMSGHDR cmh;
3843 #else
3844 struct cmsghdrcxx . . $ cmsghdr# cmh;
3845 #endif
3846 struct sctp_tcbcxx . . $ sctp_tcb# *stcb;
3847 struct sockaddrcxx . . $ sockaddr# *addr;
3848 #ifdef INETcxx . . $ `<built-in>:431:9`!
3849 struct sockaddr_incxx . . $ sockaddr_in# sin;
3850 #endif
3851 #ifdef INET6cxx . . $ `<built-in>:432:9`!
3852 struct sockaddr_in6cxx . . $ sockaddr_in6# sin6;
3853 #endif
3854 int tot_len, rem_len, cmsg_data_len, cmsg_data_off, off;
3855
3856 tot_len = SCTP_BUF_LENcxx . . $ `usrsctplib/netinet/sctp_os_userspace.h:790:9`!(control);
3857 for (off = 0; off < tot_len; off += CMSG_ALIGNcxx . . $ `<external>/8962547315054503424/socket.h:307:9`!(cmh.cmsg_len)) {
3858 rem_len = tot_len - off;
3859 if (rem_len < (int)CMSG_ALIGNcxx . . $ `<external>/8962547315054503424/socket.h:307:9`!(sizeof(cmh))) {
3860 /* There is not enough room for one more. */
3861 *error = EINVALcxx . . $ `<external>/8987895939074593727/errno-base.h:26:9`!;
3862 return (NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!);
3863 }
3864 m_copydatacxx . . $ m_copydata(fee92403c79d6892).(control, off, sizeof(cmh), (caddr_tcxx . . $ caddr_t#)&cmh);
3865 if (cmh.cmsg_lencxx . . $ cmsghdr#cmsg_len. < CMSG_ALIGNcxx . . $ `<external>/8962547315054503424/socket.h:307:9`!(sizeof(cmh))) {
3866 /* We dont't have a complete CMSG header. */
3867 *error = EINVALcxx . . $ `<external>/8987895939074593727/errno-base.h:26:9`!;
3868 return (NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!);
3869 }
3870 if ((cmh.cmsg_lencxx . . $ cmsghdr#cmsg_len. > INT_MAXcxx . . $ `<external>/67164224788392828/limits.h:120:9`!) || ((int)cmh.cmsg_lencxx . . $ cmsghdr#cmsg_len. > rem_len)) {
3871 /* We don't have the complete CMSG. */
3872 *error = EINVALcxx . . $ `<external>/8987895939074593727/errno-base.h:26:9`!;
3873 return (NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!);
3874 }
3875 cmsg_data_len = (int)cmh.cmsg_lencxx . . $ cmsghdr#cmsg_len. - CMSG_ALIGNcxx . . $ `<external>/8962547315054503424/socket.h:307:9`!(sizeof(cmh));
3876 cmsg_data_off = off + CMSG_ALIGNcxx . . $ `<external>/8962547315054503424/socket.h:307:9`!(sizeof(cmh));
3877 if (cmh.cmsg_levelcxx . . $ cmsghdr#cmsg_level. == IPPROTO_SCTPcxx . . $ `<external>/9581057695539925927/in.h:87:9`!) {
3878 switch (cmh.cmsg_typecxx . . $ cmsghdr#cmsg_type.) {
3879 #ifdef INETcxx . . $ `<built-in>:431:9`!
3880 case SCTP_DSTADDRV4cxx . . $ `./netinet/sctp_uio.h:105:9`!:
3881 if (cmsg_data_len < (int)sizeof(struct in_addrcxx . . $ in_addr#)) {
3882 *error = EINVALcxx . . $ `<external>/8987895939074593727/errno-base.h:26:9`!;
3883 return (NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!);
3884 }
3885 memsetcxx . . $ memset(d1de1e4fb215f1c6).(&sin, 0, sizeof(struct sockaddr_incxx . . $ sockaddr_in#));
3886 sin.sin_familycxx . . $ sockaddr_in#sin_family. = AF_INETcxx . . $ `<external>/8962547315054503424/socket.h:97:9`!;
3887 #ifdef HAVE_SIN_LEN
3888 sin.sin_len = sizeof(struct sockaddr_in);
3889 #endif
3890 sin.sin_portcxx . . $ sockaddr_in#sin_port. = port;
3891 m_copydatacxx . . $ m_copydata(fee92403c79d6892).(control, cmsg_data_off, sizeof(struct in_addrcxx . . $ in_addr#), (caddr_tcxx . . $ caddr_t#)&sin.sin_addrcxx . . $ sockaddr_in#sin_addr.);
3892 addr = (struct sockaddrcxx . . $ sockaddr# *)&sin;
3893 break;
3894 #endif
3895 #ifdef INET6cxx . . $ `<built-in>:432:9`!
3896 case SCTP_DSTADDRV6cxx . . $ `./netinet/sctp_uio.h:106:9`!:
3897 if (cmsg_data_len < (int)sizeof(struct in6_addrcxx . . $ in6_addr#)) {
3898 *error = EINVALcxx . . $ `<external>/8987895939074593727/errno-base.h:26:9`!;
3899 return (NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!);
3900 }
3901 memsetcxx . . $ memset(d1de1e4fb215f1c6).(&sin6, 0, sizeof(struct sockaddr_in6cxx . . $ sockaddr_in6#));
3902 sin6.sin6_familycxx . . $ sockaddr_in6#sin6_family. = AF_INET6cxx . . $ `<external>/8962547315054503424/socket.h:105:9`!;
3903 #ifdef HAVE_SIN6_LEN
3904 sin6.sin6_len = sizeof(struct sockaddr_in6);
3905 #endif
3906 sin6.sin6_portcxx . . $ sockaddr_in6#sin6_port. = port;
3907 m_copydatacxx . . $ m_copydata(fee92403c79d6892).(control, cmsg_data_off, sizeof(struct in6_addrcxx . . $ in6_addr#), (caddr_tcxx . . $ caddr_t#)&sin6.sin6_addrcxx . . $ sockaddr_in6#sin6_addr.);
3908 #ifdef INETcxx . . $ `<built-in>:431:9`!
3909 if (IN6_IS_ADDR_V4MAPPEDcxx . . $ `<external>/9581057695539925927/in.h:463:10`!(&sin6.sin6_addr)) {
3910 in6_sin6_2_sincxx . . $ in6_sin6_2_sin(65922a4b0f886efe).(&sin, &sin6);
3911 addr = (struct sockaddrcxx . . $ sockaddr# *)&sin;
3912 } else
3913 #endif
3914 addr = (struct sockaddrcxx . . $ sockaddr# *)&sin6;
3915 break;
3916 #endif
3917 default:
3918 addr = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!;
3919 break;
3920 }
3921 if (addr) {
3922 stcb = sctp_findassociation_ep_addrcxx . . $ sctp_findassociation_ep_addr(c9fc63f2d9c07946).(inp_p, addr, net_p, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!);
3923 if (stcb != NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!) {
3924 return (stcb);
3925 }
3926 }
3927 }
3928 }
3929 return (NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!);
3930 }
3931 #endif
3932
3933 static struct mbufcxx . . $ mbuf# *
3934 sctp_add_cookiecxx . . $ sctp_add_cookie(b9db52938457bd6).(struct mbufcxx . . $ mbuf# *init, int init_offset,
3935 struct mbufcxx . . $ mbuf# *initack, int initack_offset, struct sctp_state_cookiecxx . . $ sctp_state_cookie# *stc_in, uint8_tcxx . . $ uint8_t# **signature)
3936 {
3937 struct mbufcxx . . $ mbuf# *copy_init, *copy_initack, *m_at, *sig, *mret;
3938 struct sctp_state_cookiecxx . . $ sctp_state_cookie# *stc;
3939 struct sctp_paramhdrcxx . . $ sctp_paramhdr# *ph;
3940 uint16_tcxx . . $ uint16_t# cookie_sz;
3941
3942 mret = sctp_get_mbuf_for_msgcxx . . $ sctp_get_mbuf_for_msg(c7c30fc329598377).((sizeof(struct sctp_state_cookiecxx . . $ sctp_state_cookie#) +
3943 sizeof(struct sctp_paramhdrcxx . . $ sctp_paramhdr#)), 0,
3944 M_NOWAITcxx . . $ `usrsctplib/user_malloc.h:60:9`!, 1, MT_DATAcxx . . $ `usrsctplib/user_mbuf.h:289:9`!);
3945 if (mret == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!) {
3946 return (NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!);
3947 }
3948 copy_init = SCTP_M_COPYMcxx . . $ `usrsctplib/netinet/sctp_os_userspace.h:759:9`!(init, init_offset, M_COPYALLcxx . . $ `usrsctplib/user_mbuf.h:75:9`!, M_NOWAITcxx . . $ `usrsctplib/user_malloc.h:60:9`!);
3949 if (copy_init == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!) {
3950 sctp_m_freemcxx . . $ `usrsctplib/netinet/sctputil.h:57:9`!(mret);
3951 return (NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!);
3952 }
3953 #ifdef SCTP_MBUF_LOGGING
3954 if (SCTP_BASE_SYSCTL(sctp_logging_level) & SCTP_MBUF_LOGGING_ENABLE) {
3955 sctp_log_mbc(copy_init, SCTP_MBUF_ICOPY);
3956 }
3957 #endif
3958 copy_initack = SCTP_M_COPYMcxx . . $ `usrsctplib/netinet/sctp_os_userspace.h:759:9`!(initack, initack_offset, M_COPYALLcxx . . $ `usrsctplib/user_mbuf.h:75:9`!,
3959 M_NOWAITcxx . . $ `usrsctplib/user_malloc.h:60:9`!);
3960 if (copy_initack == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!) {
3961 sctp_m_freemcxx . . $ `usrsctplib/netinet/sctputil.h:57:9`!(mret);
3962 sctp_m_freemcxx . . $ `usrsctplib/netinet/sctputil.h:57:9`!(copy_init);
3963 return (NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!);
3964 }
3965 #ifdef SCTP_MBUF_LOGGING
3966 if (SCTP_BASE_SYSCTL(sctp_logging_level) & SCTP_MBUF_LOGGING_ENABLE) {
3967 sctp_log_mbc(copy_initack, SCTP_MBUF_ICOPY);
3968 }
3969 #endif
3970 /* easy side we just drop it on the end */
3971 ph = mtodcxx . . $ `usrsctplib/user_mbuf.h:96:9`!(mret, struct sctp_paramhdr *);
3972 SCTP_BUF_LENcxx . . $ `usrsctplib/netinet/sctp_os_userspace.h:790:9`!(mret) = sizeof(struct sctp_state_cookiecxx . . $ sctp_state_cookie#) +
3973 sizeof(struct sctp_paramhdrcxx . . $ sctp_paramhdr#);
3974 stc = (struct sctp_state_cookiecxx . . $ sctp_state_cookie# *)((caddr_tcxx . . $ caddr_t#)ph +
3975 sizeof(struct sctp_paramhdrcxx . . $ sctp_paramhdr#));
3976 ph->param_typecxx . . $ sctp_paramhdr#param_type. = htonscxx . . $ htons(a18c05e4017afb3d).(SCTP_STATE_COOKIEcxx . . $ `usrsctplib/netinet/sctp_constants.h:401:9`!);
3977 ph->param_lengthcxx . . $ sctp_paramhdr#param_length. = 0; /* fill in at the end */
3978 /* Fill in the stc cookie data */
3979 memcpycxx . . $ memcpy(cc817cb175f282d).(stc, stc_in, sizeof(struct sctp_state_cookiecxx . . $ sctp_state_cookie#));
3980
3981 /* tack the INIT and then the INIT-ACK onto the chain */
3982 cookie_sz = 0;
3983 for (m_at = mret; m_at; m_at = SCTP_BUF_NEXTcxx . . $ `usrsctplib/netinet/sctp_os_userspace.h:791:9`!(m_at)) {
3984 cookie_sz += SCTP_BUF_LENcxx . . $ `usrsctplib/netinet/sctp_os_userspace.h:790:9`!(m_at);
3985 if (SCTP_BUF_NEXTcxx . . $ `usrsctplib/netinet/sctp_os_userspace.h:791:9`!(m_at) == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!) {
3986 SCTP_BUF_NEXTcxx . . $ `usrsctplib/netinet/sctp_os_userspace.h:791:9`!(m_at) = copy_init;
3987 break;
3988 }
3989 }
3990 for (m_at = copy_init; m_at; m_at = SCTP_BUF_NEXTcxx . . $ `usrsctplib/netinet/sctp_os_userspace.h:791:9`!(m_at)) {
3991 cookie_sz += SCTP_BUF_LENcxx . . $ `usrsctplib/netinet/sctp_os_userspace.h:790:9`!(m_at);
3992 if (SCTP_BUF_NEXTcxx . . $ `usrsctplib/netinet/sctp_os_userspace.h:791:9`!(m_at) == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!) {
3993 SCTP_BUF_NEXTcxx . . $ `usrsctplib/netinet/sctp_os_userspace.h:791:9`!(m_at) = copy_initack;
3994 break;
3995 }
3996 }
3997 for (m_at = copy_initack; m_at; m_at = SCTP_BUF_NEXTcxx . . $ `usrsctplib/netinet/sctp_os_userspace.h:791:9`!(m_at)) {
3998 cookie_sz += SCTP_BUF_LENcxx . . $ `usrsctplib/netinet/sctp_os_userspace.h:790:9`!(m_at);
3999 if (SCTP_BUF_NEXTcxx . . $ `usrsctplib/netinet/sctp_os_userspace.h:791:9`!(m_at) == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!) {
4000 break;
4001 }
4002 }
4003 sig = sctp_get_mbuf_for_msgcxx . . $ sctp_get_mbuf_for_msg(c7c30fc329598377).(SCTP_SIGNATURE_SIZEcxx . . $ `usrsctplib/netinet/sctp_constants.h:305:9`!, 0, M_NOWAITcxx . . $ `usrsctplib/user_malloc.h:60:9`!, 1, MT_DATAcxx . . $ `usrsctplib/user_mbuf.h:289:9`!);
4004 if (sig == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!) {
4005 /* no space, so free the entire chain */
4006 sctp_m_freemcxx . . $ `usrsctplib/netinet/sctputil.h:57:9`!(mret);
4007 return (NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!);
4008 }
4009 SCTP_BUF_NEXTcxx . . $ `usrsctplib/netinet/sctp_os_userspace.h:791:9`!(m_at) = sig;
4010 SCTP_BUF_LENcxx . . $ `usrsctplib/netinet/sctp_os_userspace.h:790:9`!(sig) = SCTP_SIGNATURE_SIZEcxx . . $ `usrsctplib/netinet/sctp_constants.h:305:9`!;
4011 cookie_sz += SCTP_SIGNATURE_SIZEcxx . . $ `usrsctplib/netinet/sctp_constants.h:305:9`!;
4012 ph->param_lengthcxx . . $ sctp_paramhdr#param_length. = htonscxx . . $ htons(a18c05e4017afb3d).(cookie_sz);
4013 *signature = (uint8_tcxx . . $ uint8_t# *)mtodcxx . . $ `usrsctplib/user_mbuf.h:96:9`!(sig, caddr_t);
4014 memsetcxx . . $ memset(d1de1e4fb215f1c6).(*signature, 0, SCTP_SIGNATURE_SIZEcxx . . $ `usrsctplib/netinet/sctp_constants.h:305:9`!);
4015 return (mret);
4016 }
4017
4018 static uint8_tcxx . . $ uint8_t#
4019 sctp_get_ectcxx . . $ sctp_get_ect(fb1f252870490d40).(struct sctp_tcbcxx . . $ sctp_tcb# *stcb)
4020 {
4021 if ((stcb != NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!) && (stcb->asoccxx . . $ sctp_tcb#asoc..ecn_supportedcxx . . $ sctp_association#ecn_supported. == 1)) {
4022 return (SCTP_ECT0_BITcxx . . $ `usrsctplib/netinet/sctp_constants.h:446:9`!);
4023 } else {
4024 return (0);
4025 }
4026 }
4027
4028 #if defined(INETcxx . . $ `<built-in>:431:9`!) || defined(INET6cxx . . $ `<built-in>:432:9`!)
4029 static void
4030 sctp_handle_no_routecxx . . $ sctp_handle_no_route(406952e61e1e418d).(struct sctp_tcbcxx . . $ sctp_tcb# *stcb,
4031 struct sctp_netscxx . . $ sctp_nets# *net,
4032 int so_locked)
4033 {
4034 SCTPDBGcxx . . $ `usrsctplib/netinet/sctp_os_userspace.h:591:9`!(SCTP_DEBUG_OUTPUT1cxx . . $ `usrsctplib/netinet/sctp_constants.h:643:9`!, "dropped packet - no valid source addr\n");
4035
4036 if (net) {
4037 SCTPDBGcxx . . $ `usrsctplib/netinet/sctp_os_userspace.h:591:9`!(SCTP_DEBUG_OUTPUT1cxx . . $ `usrsctplib/netinet/sctp_constants.h:643:9`!, "Destination was ");
4038 SCTPDBG_ADDRcxx . . $ `usrsctplib/netinet/sctp_os_userspace.h:599:9`!(SCTP_DEBUG_OUTPUT1cxx . . $ `usrsctplib/netinet/sctp_constants.h:643:9`!, &net->ro._l_addr.sa);
4039 if (net->dest_statecxx . . $ sctp_nets#dest_state. & SCTP_ADDR_CONFIRMEDcxx . . $ `./netinet/sctp_uio.h:365:9`!) {
4040 if ((net->dest_statecxx . . $ sctp_nets#dest_state. & SCTP_ADDR_REACHABLEcxx . . $ `usrsctplib/netinet/sctp_constants.h:486:9`!) && stcb) {
4041 SCTPDBGcxx . . $ `usrsctplib/netinet/sctp_os_userspace.h:591:9`!(SCTP_DEBUG_OUTPUT1cxx . . $ `usrsctplib/netinet/sctp_constants.h:643:9`!, "no route takes interface %p down\n", (void *)net);
4042 sctp_ulp_notifycxx . . $ sctp_ulp_notify(3afdda356f374736).(SCTP_NOTIFY_INTERFACE_DOWNcxx . . $ `usrsctplib/netinet/sctp_constants.h:712:9`!,
4043 stcb, 0,
4044 (void *)net,
4045 so_locked);
4046 net->dest_statecxx . . $ sctp_nets#dest_state. &= ~SCTP_ADDR_REACHABLEcxx . . $ `usrsctplib/netinet/sctp_constants.h:486:9`!;
4047 net->dest_statecxx . . $ sctp_nets#dest_state. &= ~SCTP_ADDR_PFcxx . . $ `usrsctplib/netinet/sctp_constants.h:495:9`!;
4048 }
4049 }
4050 if (stcb) {
4051 if (net == stcb->asoccxx . . $ sctp_tcb#asoc..primary_destinationcxx . . $ sctp_association#primary_destination.) {
4052 /* need a new primary */
4053 struct sctp_netscxx . . $ sctp_nets# *alt;
4054
4055 alt = sctp_find_alternate_netcxx . . $ sctp_find_alternate_net(654363bae23dcddb).(stcb, net, 0);
4056 if (alt != net) {
4057 if (stcb->asoccxx . . $ sctp_tcb#asoc..alternatecxx . . $ sctp_association#alternate.) {
4058 sctp_free_remote_addrcxx . . $ `usrsctplib/netinet/sctp_var.h:229:9`!(stcb->asoc.alternate);
4059 }
4060 stcb->asoccxx . . $ sctp_tcb#asoc..alternatecxx . . $ sctp_association#alternate. = alt;
4061 atomic_add_intcxx . . $ `usrsctplib/user_atomic.h:94:9`!(&stcb->asoc.alternate->ref_count, 1);
4062 if (net->rocxx . . $ sctp_nets#ro.._s_addrcxx . . $ sctp_net_route#_s_addr.) {
4063 sctp_free_ifacxx . . $ sctp_free_ifa(e5ce6e4bf5862a47).(net->rocxx . . $ sctp_nets#ro.._s_addrcxx . . $ sctp_net_route#_s_addr.);
4064 net->rocxx . . $ sctp_nets#ro.._s_addrcxx . . $ sctp_net_route#_s_addr. = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!;
4065 }
4066 net->src_addr_selectedcxx . . $ sctp_nets#src_addr_selected. = 0;
4067 }
4068 }
4069 }
4070 }
4071 }
4072 #endif
4073
4074 static int
4075 sctp_lowlevel_chunk_outputcxx . . $ sctp_lowlevel_chunk_output(4859f95fdecd7401).(struct sctp_inpcbcxx . . $ sctp_inpcb# *inp,
4076 struct sctp_tcbcxx . . $ sctp_tcb# *stcb, /* may be NULL */
4077 struct sctp_netscxx . . $ sctp_nets# *net,
4078 struct sockaddrcxx . . $ sockaddr# *to,
4079 struct mbufcxx . . $ mbuf# *m,
4080 uint32_tcxx . . $ uint32_t# auth_offset,
4081 struct sctp_auth_chunkcxx . . $ sctp_auth_chunk# *auth,
4082 uint16_tcxx . . $ uint16_t# auth_keyid,
4083 int nofragment_flag,
4084 int ecn_ok,
4085 int out_of_asoc_ok,
4086 uint16_tcxx . . $ uint16_t# src_port,
4087 uint16_tcxx . . $ uint16_t# dest_port,
4088 uint32_tcxx . . $ uint32_t# v_tag,
4089 uint16_tcxx . . $ uint16_t# port,
4090 union sctp_sockstore *over_addr,
4091 #if defined(__FreeBSD__) && !defined(__Userspace__cxx . . $ `<built-in>:442:9`!)
4092 uint8_t mflowtype, uint32_t mflowid,
4093 #endif
4094 int so_locked)
4095 /* nofragment_flag to tell if IP_DF should be set (IPv4 only) */
4096 {
4097 /**
4098 * Given a mbuf chain (via SCTP_BUF_NEXT()) that holds a packet header
4099 * WITH an SCTPHDR but no IP header, endpoint inp and sa structure:
4100 * - fill in the HMAC digest of any AUTH chunk in the packet.
4101 * - calculate and fill in the SCTP checksum.
4102 * - prepend an IP address header.
4103 * - if boundall use INADDR_ANY.
4104 * - if boundspecific do source address selection.
4105 * - set fragmentation option for ipV4.
4106 * - On return from IP output, check/adjust mtu size of output
4107 * interface and smallest_mtu size as well.
4108 */
4109 /* Will need ifdefs around this */
4110 struct mbufcxx . . $ mbuf# *newm;
4111 struct sctphdrcxx . . $ sctphdr# *sctphdr;
4112 int packet_length;
4113 int ret;
4114 #if defined(INETcxx . . $ `<built-in>:431:9`!) || defined(INET6cxx . . $ `<built-in>:432:9`!)
4115 uint32_tcxx . . $ uint32_t# vrf_id;
4116 #endif
4117 #if defined(INETcxx . . $ `<built-in>:431:9`!) || defined(INET6cxx . . $ `<built-in>:432:9`!)
4118 struct mbufcxx . . $ mbuf# *o_pak;
4119 sctp_route_tcxx . . $ sctp_route_t# *ro = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!;
4120 struct udphdrcxx . . $ udphdr# *udp = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!;
4121 #endif
4122 uint8_tcxx . . $ uint8_t# tos_value;
4123 #if defined(__APPLE__) && !defined(__Userspace__cxx . . $ `<built-in>:442:9`!)
4124 struct socket *so = NULL;
4125 #endif
4126
4127 #if defined(__APPLE__) && !defined(__Userspace__cxx . . $ `<built-in>:442:9`!)
4128 if (so_locked) {
4129 sctp_lock_assert(SCTP_INP_SO(inp));
4130 SCTP_TCB_LOCK_ASSERT(stcb);
4131 } else {
4132 sctp_unlock_assert(SCTP_INP_SO(inp));
4133 }
4134 #endif
4135 if ((net) && (net->dest_statecxx . . $ sctp_nets#dest_state. & SCTP_ADDR_OUT_OF_SCOPEcxx . . $ `usrsctplib/netinet/sctp_constants.h:491:9`!)) {
4136 SCTP_LTRACE_ERR_RET_PKTcxx . . $ `usrsctplib/netinet/sctp_os_userspace.h:628:9`!(m, inp, stcb, net, SCTP_FROM_SCTP_OUTPUT, EFAULT);
4137 sctp_m_freemcxx . . $ `usrsctplib/netinet/sctputil.h:57:9`!(m);
4138 return (EFAULTcxx . . $ `<external>/8987895939074593727/errno-base.h:18:9`!);
4139 }
4140 #if defined(INETcxx . . $ `<built-in>:431:9`!) || defined(INET6cxx . . $ `<built-in>:432:9`!)
4141 if (stcb) {
4142 vrf_id = stcb->asoccxx . . $ sctp_tcb#asoc..vrf_idcxx . . $ sctp_association#vrf_id.;
4143 } else {
4144 vrf_id = inp->def_vrf_idcxx . . $ sctp_inpcb#def_vrf_id.;
4145 }
4146 #endif
4147 /* fill in the HMAC digest for any AUTH chunk in the packet */
4148 if ((auth != NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!) && (stcb != NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!)) {
4149 sctp_fill_hmac_digest_mcxx . . $ sctp_fill_hmac_digest_m(4d6b6b55076d042c).(m, auth_offset, auth, stcb, auth_keyid);
4150 }
4151
4152 if (net) {
4153 tos_value = net->dscpcxx . . $ sctp_nets#dscp.;
4154 } else if (stcb) {
4155 tos_value = stcb->asoccxx . . $ sctp_tcb#asoc..default_dscpcxx . . $ sctp_association#default_dscp.;
4156 } else {
4157 tos_value = inp->sctp_epcxx . . $ sctp_inpcb#sctp_ep..default_dscpcxx . . $ sctp_pcb#default_dscp.;
4158 }
4159
4160 switch (to->sa_familycxx . . $ sockaddr#sa_family.) {
4161 #ifdef INETcxx . . $ `<built-in>:431:9`!
4162 case AF_INETcxx . . $ `<external>/8962547315054503424/socket.h:97:9`!:
4163 {
4164 struct ipcxx . . $ ip# *ip = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!;
4165 sctp_route_tcxx . . $ sctp_route_t# iproute;
4166 int len;
4167
4168 len = SCTP_MIN_V4_OVERHEADcxx . . $ `usrsctplib/netinet/sctp_header.h:585:9`!;
4169 if (port) {
4170 len += sizeof(struct udphdrcxx . . $ udphdr#);
4171 }
4172 newm = sctp_get_mbuf_for_msgcxx . . $ sctp_get_mbuf_for_msg(c7c30fc329598377).(len, 1, M_NOWAITcxx . . $ `usrsctplib/user_malloc.h:60:9`!, 1, MT_DATAcxx . . $ `usrsctplib/user_mbuf.h:289:9`!);
4173 if (newm == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!) {
4174 sctp_m_freemcxx . . $ `usrsctplib/netinet/sctputil.h:57:9`!(m);
4175 SCTP_LTRACE_ERR_RETcxx . . $ `usrsctplib/netinet/sctp_os_userspace.h:629:9`!(inp, stcb, NULL, SCTP_FROM_SCTP_OUTPUT, ENOMEM);
4176 return (ENOMEMcxx . . $ `<external>/8987895939074593727/errno-base.h:16:9`!);
4177 }
4178 SCTP_ALIGN_TO_ENDcxx . . $ `usrsctplib/netinet/sctp_os_userspace.h:801:9`!(newm, len);
4179 SCTP_BUF_LENcxx . . $ `usrsctplib/netinet/sctp_os_userspace.h:790:9`!(newm) = len;
4180 SCTP_BUF_NEXTcxx . . $ `usrsctplib/netinet/sctp_os_userspace.h:791:9`!(newm) = m;
4181 m = newm;
4182 #if defined(__FreeBSD__) && !defined(__Userspace__cxx . . $ `<built-in>:442:9`!)
4183 if (net != NULL) {
4184 m->m_pkthdr.flowid = net->flowid;
4185 M_HASHTYPE_SET(m, net->flowtype);
4186 } else {
4187 m->m_pkthdr.flowid = mflowid;
4188 M_HASHTYPE_SET(m, mflowtype);
4189 }
4190 #endif
4191 packet_length = sctp_calculate_lencxx . . $ sctp_calculate_len(ffa3bcd30533ce4c).(m);
4192 ip = mtodcxx . . $ `usrsctplib/user_mbuf.h:96:9`!(m, struct ip *);
4193 ip->ip_vcxx . . $ ip#ip_v. = IPVERSIONcxx . . $ `<external>/4481066469753325646/ip.h:151:9`!;
4194 ip->ip_hlcxx . . $ ip#ip_hl. = (sizeof(struct ipcxx . . $ ip#) >> 2);
4195 if (tos_value == 0) {
4196 /*
4197 * This means especially, that it is not set at the
4198 * SCTP layer. So use the value from the IP layer.
4199 */
4200 tos_value = inp->ip_inpcxx . . $ sctp_inpcb#ip_inp..inpcxx . . $ sctp_inpcb#$anonymous_type_7#inp..inp_ip_toscxx . . $ `usrsctplib/user_inpcb.h:148:9`!;
4201 }
4202 tos_value &= 0xfc;
4203 if (ecn_ok) {
4204 tos_value |= sctp_get_ectcxx . . $ sctp_get_ect(fb1f252870490d40).(stcb);
4205 }
4206 if ((nofragment_flag) && (port == 0)) {
4207 #if defined(__FreeBSD__) && !defined(__Userspace__cxx . . $ `<built-in>:442:9`!)
4208 ip->ip_off = htons(IP_DF);
4209 #elif defined(WITH_CONVERT_IP_OFF) || defined(__APPLE__)
4210 ip->ip_off = IP_DF;
4211 #else
4212 ip->ip_offcxx . . $ ip#ip_off. = htonscxx . . $ htons(a18c05e4017afb3d).(IP_DFcxx . . $ `<external>/4481066469753325646/ip.h:122:9`!);
4213 #endif
4214 } else {
4215 #if defined(__FreeBSD__) && !defined(__Userspace__cxx . . $ `<built-in>:442:9`!)
4216 ip->ip_off = htons(0);
4217 #else
4218 ip->ip_offcxx . . $ ip#ip_off. = 0;
4219 #endif
4220 }
4221 #if defined(__Userspace__cxx . . $ `<built-in>:442:9`!)
4222 ip->ip_idcxx . . $ ip#ip_id. = htonscxx . . $ htons(a18c05e4017afb3d).(SCTP_IP_IDcxx . . $ `usrsctplib/netinet/sctp_os_userspace.h:1029:9`!(inp)++);
4223 #elif defined(__FreeBSD__)
4224 /* FreeBSD has a function for ip_id's */
4225 ip_fillid(ip);
4226 #elif defined(__APPLE__)
4227 #if RANDOM_IP_ID
4228 ip->ip_id = ip_randomid();
4229 #else
4230 ip->ip_id = htons(ip_id++);
4231 #endif
4232 #else
4233 ip->ip_id = SCTP_IP_ID(inp)++;
4234 #endif
4235
4236 ip->ip_ttlcxx . . $ ip#ip_ttl. = inp->ip_inpcxx . . $ sctp_inpcb#ip_inp..inpcxx . . $ sctp_inpcb#$anonymous_type_7#inp..inp_ip_ttlcxx . . $ inpcb#inp_ip_ttl.;
4237 #if defined(__FreeBSD__) && !defined(__Userspace__cxx . . $ `<built-in>:442:9`!)
4238 ip->ip_len = htons(packet_length);
4239 #else
4240 ip->ip_lencxx . . $ ip#ip_len. = packet_length;
4241 #endif
4242 ip->ip_toscxx . . $ ip#ip_tos. = tos_value;
4243 if (port) {
4244 ip->ip_pcxx . . $ ip#ip_p. = IPPROTO_UDPcxx . . $ `<external>/9581057695539925927/in.h:57:9`!;
4245 } else {
4246 ip->ip_pcxx . . $ ip#ip_p. = IPPROTO_SCTPcxx . . $ `<external>/9581057695539925927/in.h:87:9`!;
4247 }
4248 ip->ip_sumcxx . . $ ip#ip_sum. = 0;
4249 if (net == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!) {
4250 ro = &iproute;
4251 memsetcxx . . $ memset(d1de1e4fb215f1c6).(&iproute, 0, sizeof(iproute));
4252 #ifdef HAVE_SA_LEN
4253 memcpy(&ro->ro_dst, to, to->sa_len);
4254 #else
4255 memcpycxx . . $ memcpy(cc817cb175f282d).(&ro->ro_dstcxx . . $ sctp_route#ro_dst., to, sizeof(struct sockaddr_incxx . . $ sockaddr_in#));
4256 #endif
4257 } else {
4258 ro = (sctp_route_tcxx . . $ sctp_route_t# *)&net->rocxx . . $ sctp_nets#ro.;
4259 }
4260 /* Now the address selection part */
4261 ip->ip_dstcxx . . $ ip#ip_dst..s_addrcxx . . $ in_addr#s_addr. = ((struct sockaddr_incxx . . $ sockaddr_in# *)to)->sin_addrcxx . . $ sockaddr_in#sin_addr..s_addrcxx . . $ in_addr#s_addr.;
4262
4263 /* call the routine to select the src address */
4264 if (net && out_of_asoc_ok == 0) {
4265 if (net->rocxx . . $ sctp_nets#ro.._s_addrcxx . . $ sctp_net_route#_s_addr. && (net->rocxx . . $ sctp_nets#ro.._s_addrcxx . . $ sctp_net_route#_s_addr.->localifa_flagscxx . . $ sctp_ifa#localifa_flags. & (SCTP_BEING_DELETEDcxx . . $ `usrsctplib/netinet/sctp_pcb.h:95:9`!|SCTP_ADDR_IFA_UNUSEABLEcxx . . $ `usrsctplib/netinet/sctp_pcb.h:103:9`!))) {
4266 sctp_free_ifacxx . . $ sctp_free_ifa(e5ce6e4bf5862a47).(net->rocxx . . $ sctp_nets#ro.._s_addrcxx . . $ sctp_net_route#_s_addr.);
4267 net->rocxx . . $ sctp_nets#ro.._s_addrcxx . . $ sctp_net_route#_s_addr. = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!;
4268 net->src_addr_selectedcxx . . $ sctp_nets#src_addr_selected. = 0;
4269 #if defined(__FreeBSD__) && !defined(__Userspace__cxx . . $ `<built-in>:442:9`!)
4270 RO_NHFREE(ro);
4271 #else
4272 if (ro->ro_rtcxx . . $ sctp_route#ro_rt.) {
4273 RTFREEcxx . . $ `usrsctplib/user_route.h:126:9`!(ro->ro_rt);
4274 ro->ro_rtcxx . . $ sctp_route#ro_rt. = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!;
4275 }
4276 #endif
4277 }
4278 if (net->src_addr_selectedcxx . . $ sctp_nets#src_addr_selected. == 0) {
4279 /* Cache the source address */
4280 net->rocxx . . $ sctp_nets#ro.._s_addrcxx . . $ sctp_net_route#_s_addr. = sctp_source_address_selectioncxx . . $ sctp_source_address_selection(8ee075f20da66e1).(inp,stcb,
4281 ro, net, 0,
4282 vrf_id);
4283 net->src_addr_selectedcxx . . $ sctp_nets#src_addr_selected. = 1;
4284 }
4285 if (net->rocxx . . $ sctp_nets#ro.._s_addrcxx . . $ sctp_net_route#_s_addr. == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!) {
4286 /* No route to host */
4287 net->src_addr_selectedcxx . . $ sctp_nets#src_addr_selected. = 0;
4288 sctp_handle_no_routecxx . . $ sctp_handle_no_route(406952e61e1e418d).(stcb, net, so_locked);
4289 SCTP_LTRACE_ERR_RET_PKTcxx . . $ `usrsctplib/netinet/sctp_os_userspace.h:628:9`!(m, inp, stcb, NULL, SCTP_FROM_SCTP_OUTPUT, EHOSTUNREACH);
4290 sctp_m_freemcxx . . $ `usrsctplib/netinet/sctputil.h:57:9`!(m);
4291 return (EHOSTUNREACHcxx . . $ `<external>/17922322188510340118/errno.h:97:9`!);
4292 }
4293 ip->ip_srccxx . . $ ip#ip_src. = net->rocxx . . $ sctp_nets#ro.._s_addrcxx . . $ sctp_net_route#_s_addr.->addresscxx . . $ sctp_ifa#address..sin.sin_addrcxx . . $ sockaddr_in#sin_addr.;
4294 } else {
4295 if (over_addr == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!) {
4296 struct sctp_ifacxx . . $ sctp_ifa# *_lsrc;
4297
4298 _lsrc = sctp_source_address_selectioncxx . . $ sctp_source_address_selection(8ee075f20da66e1).(inp, stcb, ro,
4299 net,
4300 out_of_asoc_ok,
4301 vrf_id);
4302 if (_lsrc == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!) {
4303 sctp_handle_no_routecxx . . $ sctp_handle_no_route(406952e61e1e418d).(stcb, net, so_locked);
4304 SCTP_LTRACE_ERR_RET_PKTcxx . . $ `usrsctplib/netinet/sctp_os_userspace.h:628:9`!(m, inp, stcb, NULL, SCTP_FROM_SCTP_OUTPUT, EHOSTUNREACH);
4305 sctp_m_freemcxx . . $ `usrsctplib/netinet/sctputil.h:57:9`!(m);
4306 return (EHOSTUNREACHcxx . . $ `<external>/17922322188510340118/errno.h:97:9`!);
4307 }
4308 ip->ip_srccxx . . $ ip#ip_src. = _lsrc->addresscxx . . $ sctp_ifa#address..sin.sin_addrcxx . . $ sockaddr_in#sin_addr.;
4309 sctp_free_ifacxx . . $ sctp_free_ifa(e5ce6e4bf5862a47).(_lsrc);
4310 } else {
4311 ip->ip_srccxx . . $ ip#ip_src. = over_addr->sin.sin_addrcxx . . $ sockaddr_in#sin_addr.;
4312 SCTP_RTALLOCcxx . . $ `usrsctplib/netinet/sctp_os_userspace.h:860:9`!(ro, vrf_id, inp->fibnum);
4313 }
4314 }
4315 if (port) {
4316 if (htonscxx . . $ htons(a18c05e4017afb3d).(SCTP_BASE_SYSCTLcxx . . $ `usrsctplib/netinet/sctp_os_userspace.h:579:9`!(sctp_udp_tunneling_port)) == 0) {
4317 sctp_handle_no_routecxx . . $ sctp_handle_no_route(406952e61e1e418d).(stcb, net, so_locked);
4318 SCTP_LTRACE_ERR_RET_PKTcxx . . $ `usrsctplib/netinet/sctp_os_userspace.h:628:9`!(m, inp, stcb, NULL, SCTP_FROM_SCTP_OUTPUT, EHOSTUNREACH);
4319 sctp_m_freemcxx . . $ `usrsctplib/netinet/sctputil.h:57:9`!(m);
4320 return (EHOSTUNREACHcxx . . $ `<external>/17922322188510340118/errno.h:97:9`!);
4321 }
4322 udp = (struct udphdrcxx . . $ udphdr# *)((caddr_tcxx . . $ caddr_t#)ip + sizeof(struct ipcxx . . $ ip#));
4323 udp->uh_sportcxx . . $ udphdr#$anonymous_type_0#$anonymous_type_1#uh_sport. = htonscxx . . $ htons(a18c05e4017afb3d).(SCTP_BASE_SYSCTLcxx . . $ `usrsctplib/netinet/sctp_os_userspace.h:579:9`!(sctp_udp_tunneling_port));
4324 udp->uh_dportcxx . . $ udphdr#$anonymous_type_0#$anonymous_type_1#uh_dport. = port;
4325 udp->uh_ulencxx . . $ udphdr#$anonymous_type_0#$anonymous_type_1#uh_ulen. = htonscxx . . $ htons(a18c05e4017afb3d).((uint16_tcxx . . $ uint16_t#)(packet_length - sizeof(struct ipcxx . . $ ip#)));
4326 #if !defined(__Userspace__cxx . . $ `<built-in>:442:9`!)
4327 #if defined(__FreeBSD__)
4328 if (V_udp_cksum) {
4329 udp->uh_sum = in_pseudo(ip->ip_src.s_addr, ip->ip_dst.s_addr, udp->uh_ulen + htons(IPPROTO_UDP));
4330 } else {
4331 udp->uh_sum = 0;
4332 }
4333 #else
4334 udp->uh_sum = in_pseudo(ip->ip_src.s_addr, ip->ip_dst.s_addr, udp->uh_ulen + htons(IPPROTO_UDP));
4335 #endif
4336 #else
4337 udp->uh_sumcxx . . $ udphdr#$anonymous_type_0#$anonymous_type_1#uh_sum. = 0;
4338 #endif
4339 sctphdr = (struct sctphdrcxx . . $ sctphdr# *)((caddr_tcxx . . $ caddr_t#)udp + sizeof(struct udphdrcxx . . $ udphdr#));
4340 } else {
4341 sctphdr = (struct sctphdrcxx . . $ sctphdr# *)((caddr_tcxx . . $ caddr_t#)ip + sizeof(struct ipcxx . . $ ip#));
4342 }
4343
4344 sctphdr->src_portcxx . . $ sctphdr#src_port. = src_port;
4345 sctphdr->dest_portcxx . . $ sctphdr#dest_port. = dest_port;
4346 sctphdr->v_tagcxx . . $ sctphdr#v_tag. = v_tag;
4347 sctphdr->checksumcxx . . $ sctphdr#checksum. = 0;
4348
4349 /*
4350 * If source address selection fails and we find no route
4351 * then the ip_output should fail as well with a
4352 * NO_ROUTE_TO_HOST type error. We probably should catch
4353 * that somewhere and abort the association right away
4354 * (assuming this is an INIT being sent).
4355 */
4356 #if defined(__FreeBSD__) && !defined(__Userspace__cxx . . $ `<built-in>:442:9`!)
4357 if (ro->ro_nh == NULL) {
4358 #else
4359 if (ro->ro_rtcxx . . $ sctp_route#ro_rt. == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!) {
4360 #endif
4361 /*
4362 * src addr selection failed to find a route (or
4363 * valid source addr), so we can't get there from
4364 * here (yet)!
4365 */
4366 sctp_handle_no_routecxx . . $ sctp_handle_no_route(406952e61e1e418d).(stcb, net, so_locked);
4367 SCTP_LTRACE_ERR_RET_PKTcxx . . $ `usrsctplib/netinet/sctp_os_userspace.h:628:9`!(m, inp, stcb, NULL, SCTP_FROM_SCTP_OUTPUT, EHOSTUNREACH);
4368 sctp_m_freemcxx . . $ `usrsctplib/netinet/sctputil.h:57:9`!(m);
4369 return (EHOSTUNREACHcxx . . $ `<external>/17922322188510340118/errno.h:97:9`!);
4370 }
4371 if (ro != &iproute) {
4372 memcpycxx . . $ memcpy(cc817cb175f282d).(&iproute, ro, sizeof(*ro));
4373 }
4374 SCTPDBGcxx . . $ `usrsctplib/netinet/sctp_os_userspace.h:591:9`!(SCTP_DEBUG_OUTPUT3cxx . . $ `usrsctplib/netinet/sctp_constants.h:645:9`!, "Calling ipv4 output routine from low level src addr:%x\n",
4375 (uint32_t) (ntohl(ip->ip_src.s_addr)));
4376 SCTPDBGcxx . . $ `usrsctplib/netinet/sctp_os_userspace.h:591:9`!(SCTP_DEBUG_OUTPUT3cxx . . $ `usrsctplib/netinet/sctp_constants.h:645:9`!, "Destination is %x\n",
4377 (uint32_t)(ntohl(ip->ip_dst.s_addr)));
4378 #if defined(__FreeBSD__) && !defined(__Userspace__cxx . . $ `<built-in>:442:9`!)
4379 SCTPDBG(SCTP_DEBUG_OUTPUT3, "RTP route is %p through\n",
4380 (void *)ro->ro_nh);
4381 #else
4382 SCTPDBGcxx . . $ `usrsctplib/netinet/sctp_os_userspace.h:591:9`!(SCTP_DEBUG_OUTPUT3cxx . . $ `usrsctplib/netinet/sctp_constants.h:645:9`!, "RTP route is %p through\n",
4383 (void *)ro->ro_rt);
4384 #endif
4385
4386 if (SCTP_GET_HEADER_FOR_OUTPUTcxx . . $ `usrsctplib/netinet/sctp_os_userspace.h:913:9`!(o_pak)) {
4387 /* failed to prepend data, give up */
4388 SCTP_LTRACE_ERR_RET_PKTcxx . . $ `usrsctplib/netinet/sctp_os_userspace.h:628:9`!(m, inp, stcb, NULL, SCTP_FROM_SCTP_OUTPUT, ENOMEM);
4389 sctp_m_freemcxx . . $ `usrsctplib/netinet/sctputil.h:57:9`!(m);
4390 return (ENOMEMcxx . . $ `<external>/8987895939074593727/errno-base.h:16:9`!);
4391 }
4392 SCTP_ATTACH_CHAINcxx . . $ `usrsctplib/netinet/sctp_os_userspace.h:922:9`!(o_pak, m, packet_length);
4393 if (port) {
4394 sctphdr->checksumcxx . . $ sctphdr#checksum. = sctp_calculate_cksumcxx . . $ sctp_calculate_cksum(ee29b78d597cafbf).(m, sizeof(struct ipcxx . . $ ip#) + sizeof(struct udphdrcxx . . $ udphdr#));
4395 SCTP_STAT_INCRcxx . . $ `./netinet/sctp_uio.h:1111:9`!(sctps_sendswcrc);
4396 #if !defined(__Userspace__cxx . . $ `<built-in>:442:9`!)
4397 #if defined(__FreeBSD__)
4398 if (V_udp_cksum) {
4399 SCTP_ENABLE_UDP_CSUM(o_pak);
4400 }
4401 #else
4402 SCTP_ENABLE_UDP_CSUM(o_pak);
4403 #endif
4404 #endif
4405 } else {
4406 #if defined(__FreeBSD__) && !defined(__Userspace__cxx . . $ `<built-in>:442:9`!)
4407 m->m_pkthdr.csum_flags = CSUM_SCTP;
4408 m->m_pkthdr.csum_data = offsetof(struct sctphdr, checksum);
4409 SCTP_STAT_INCR(sctps_sendhwcrc);
4410 #else
4411 if (!(SCTP_BASE_SYSCTLcxx . . $ `usrsctplib/netinet/sctp_os_userspace.h:579:9`!(sctp_no_csum_on_loopback) &&
4412 (stcb) && (stcb->asoccxx . . $ sctp_tcb#asoc..scopecxx . . $ sctp_association#scope..loopback_scopecxx . . $ sctp_scoping#loopback_scope.))) {
4413 sctphdr->checksumcxx . . $ sctphdr#checksum. = sctp_calculate_cksumcxx . . $ sctp_calculate_cksum(ee29b78d597cafbf).(m, sizeof(struct ipcxx . . $ ip#));
4414 SCTP_STAT_INCRcxx . . $ `./netinet/sctp_uio.h:1111:9`!(sctps_sendswcrc);
4415 } else {
4416 SCTP_STAT_INCRcxx . . $ `./netinet/sctp_uio.h:1111:9`!(sctps_sendhwcrc);
4417 }
4418 #endif
4419 }
4420 #ifdef SCTP_PACKET_LOGGING
4421 if (SCTP_BASE_SYSCTL(sctp_logging_level) & SCTP_LAST_PACKET_TRACING)
4422 sctp_packet_log(o_pak);
4423 #endif
4424 /* send it out. table id is taken from stcb */
4425 #if defined(__APPLE__) && !defined(__Userspace__cxx . . $ `<built-in>:442:9`!)
4426 if ((SCTP_BASE_SYSCTL(sctp_output_unlocked)) && (so_locked)) {
4427 so = SCTP_INP_SO(inp);
4428 SCTP_SOCKET_UNLOCK(so, 0);
4429 }
4430 #endif
4431 #if defined(__FreeBSD__) && !defined(__Userspace__cxx . . $ `<built-in>:442:9`!)
4432 SCTP_PROBE5(send, NULL, stcb, ip, stcb, sctphdr);
4433 #endif
4434 SCTP_IP_OUTPUTcxx . . $ `usrsctplib/netinet/sctp_os_userspace.h:1037:9`!(ret, o_pak, ro, stcb, vrf_id);
4435 #if defined(__APPLE__) && !defined(__Userspace__cxx . . $ `<built-in>:442:9`!)
4436 if ((SCTP_BASE_SYSCTL(sctp_output_unlocked)) && (so_locked)) {
4437 atomic_add_int(&stcb->asoc.refcnt, 1);
4438 SCTP_TCB_UNLOCK(stcb);
4439 SCTP_SOCKET_LOCK(so, 0);
4440 SCTP_TCB_LOCK(stcb);
4441 atomic_subtract_int(&stcb->asoc.refcnt, 1);
4442 }
4443 #endif
4444 #if defined(__FreeBSD__) && !defined(__Userspace__cxx . . $ `<built-in>:442:9`!)
4445 if (port) {
4446 UDPSTAT_INC(udps_opackets);
4447 }
4448 #endif
4449 SCTP_STAT_INCRcxx . . $ `./netinet/sctp_uio.h:1111:9`!(sctps_sendpackets);
4450 SCTP_STAT_INCR_COUNTER64cxx . . $ `./netinet/sctp_uio.h:1127:9`!(sctps_outpackets);
4451 if (ret)
4452 SCTP_STAT_INCRcxx . . $ `./netinet/sctp_uio.h:1111:9`!(sctps_senderrors);
4453
4454 SCTPDBGcxx . . $ `usrsctplib/netinet/sctp_os_userspace.h:591:9`!(SCTP_DEBUG_OUTPUT3cxx . . $ `usrsctplib/netinet/sctp_constants.h:645:9`!, "IP output returns %d\n", ret);
4455 if (net == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!) {
4456 /* free tempy routes */
4457 #if defined(__FreeBSD__) && !defined(__Userspace__cxx . . $ `<built-in>:442:9`!)
4458 RO_NHFREE(ro);
4459 #else
4460 if (ro->ro_rtcxx . . $ sctp_route#ro_rt.) {
4461 RTFREEcxx . . $ `usrsctplib/user_route.h:126:9`!(ro->ro_rt);
4462 ro->ro_rtcxx . . $ sctp_route#ro_rt. = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!;
4463 }
4464 #endif
4465 } else {
4466 #if defined(__FreeBSD__) && !defined(__Userspace__cxx . . $ `<built-in>:442:9`!)
4467 if ((ro->ro_nh != NULL) && (net->ro._s_addr) &&
4468 #else
4469 if ((ro->ro_rtcxx . . $ sctp_route#ro_rt. != NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!) && (net->rocxx . . $ sctp_nets#ro.._s_addrcxx . . $ sctp_net_route#_s_addr.) &&
4470 #endif
4471 ((net->dest_statecxx . . $ sctp_nets#dest_state. & SCTP_ADDR_NO_PMTUDcxx . . $ `usrsctplib/netinet/sctp_constants.h:487:9`!) == 0)) {
4472 uint32_tcxx . . $ uint32_t# mtu;
4473
4474 #if defined(__FreeBSD__) && !defined(__Userspace__cxx . . $ `<built-in>:442:9`!)
4475 mtu = SCTP_GATHER_MTU_FROM_ROUTE(net->ro._s_addr, &net->ro._l_addr.sa, ro->ro_nh);
4476 #else
4477 mtu = SCTP_GATHER_MTU_FROM_ROUTEcxx . . $ `usrsctplib/netinet/sctp_os_userspace.h:883:9`!(net->ro._s_addr, &net->ro._l_addr.sa, ro->ro_rt);
4478 #endif
4479 if (mtu > 0) {
4480 if (net->portcxx . . $ sctp_nets#port.) {
4481 mtu -= sizeof(struct udphdrcxx . . $ udphdr#);
4482 }
4483 if (mtu < net->mtucxx . . $ sctp_nets#mtu.) {
4484 if ((stcb != NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!) && (stcb->asoccxx . . $ sctp_tcb#asoc..smallest_mtucxx . . $ sctp_association#smallest_mtu. > mtu)) {
4485 sctp_mtu_size_resetcxx . . $ sctp_mtu_size_reset(3f17faeebe465efe).(inp, &stcb->asoccxx . . $ sctp_tcb#asoc., mtu);
4486 }
4487 net->mtucxx . . $ sctp_nets#mtu. = mtu;
4488 }
4489 }
4490 #if defined(__FreeBSD__) && !defined(__Userspace__cxx . . $ `<built-in>:442:9`!)
4491 } else if (ro->ro_nh == NULL) {
4492 #else
4493 } else if (ro->ro_rtcxx . . $ sctp_route#ro_rt. == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!) {
4494 #endif
4495 /* route was freed */
4496 if (net->rocxx . . $ sctp_nets#ro.._s_addrcxx . . $ sctp_net_route#_s_addr. &&
4497 net->src_addr_selectedcxx . . $ sctp_nets#src_addr_selected.) {
4498 sctp_free_ifacxx . . $ sctp_free_ifa(e5ce6e4bf5862a47).(net->rocxx . . $ sctp_nets#ro.._s_addrcxx . . $ sctp_net_route#_s_addr.);
4499 net->rocxx . . $ sctp_nets#ro.._s_addrcxx . . $ sctp_net_route#_s_addr. = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!;
4500 }
4501 net->src_addr_selectedcxx . . $ sctp_nets#src_addr_selected. = 0;
4502 }
4503 }
4504 return (ret);
4505 }
4506 #endif
4507 #ifdef INET6cxx . . $ `<built-in>:432:9`!
4508 case AF_INET6cxx . . $ `<external>/8962547315054503424/socket.h:105:9`!:
4509 {
4510 uint32_tcxx . . $ uint32_t# flowlabel, flowinfo;
4511 struct ip6_hdrcxx . . $ ip6_hdr# *ip6h;
4512 struct route_in6cxx . . $ route_in6# ip6route;
4513 #if !defined(__Userspace__cxx . . $ `<built-in>:442:9`!)
4514 struct ifnet *ifp;
4515 #endif
4516 struct sockaddr_in6cxx . . $ sockaddr_in6# *sin6, tmp, *lsa6, lsa6_tmp;
4517 int prev_scope = 0;
4518 #ifdef SCTP_EMBEDDED_V6_SCOPE
4519 struct sockaddr_in6 lsa6_storage;
4520 int error;
4521 #endif
4522 u_shortcxx . . $ u_short# prev_port = 0;
4523 int len;
4524
4525 if (net) {
4526 flowlabel = net->flowlabelcxx . . $ sctp_nets#flowlabel.;
4527 } else if (stcb) {
4528 flowlabel = stcb->asoccxx . . $ sctp_tcb#asoc..default_flowlabelcxx . . $ sctp_association#default_flowlabel.;
4529 } else {
4530 flowlabel = inp->sctp_epcxx . . $ sctp_inpcb#sctp_ep..default_flowlabelcxx . . $ sctp_pcb#default_flowlabel.;
4531 }
4532 if (flowlabel == 0) {
4533 /*
4534 * This means especially, that it is not set at the
4535 * SCTP layer. So use the value from the IP layer.
4536 */
4537 #if defined(__APPLE__) && !defined(__Userspace__cxx . . $ `<built-in>:442:9`!) && (!defined(APPLE_LEOPARD) && !defined(APPLE_SNOWLEOPARD) && !defined(APPLE_LION) && !defined(APPLE_MOUNTAINLION))
4538 flowlabel = ntohl(inp->ip_inp.inp.inp_flow);
4539 #else
4540 flowlabel = ntohlcxx . . $ ntohl(2141b656ce2cc063).(((struct inpcbcxx . . $ inpcb# *)inp)->inp_flowcxx . . $ inpcb#inp_flow.);
4541 #endif
4542 }
4543 flowlabel &= 0x000fffff;
4544 len = SCTP_MIN_OVERHEADcxx . . $ `usrsctplib/netinet/sctp_header.h:561:9`!;
4545 if (port) {
4546 len += sizeof(struct udphdrcxx . . $ udphdr#);
4547 }
4548 newm = sctp_get_mbuf_for_msgcxx . . $ sctp_get_mbuf_for_msg(c7c30fc329598377).(len, 1, M_NOWAITcxx . . $ `usrsctplib/user_malloc.h:60:9`!, 1, MT_DATAcxx . . $ `usrsctplib/user_mbuf.h:289:9`!);
4549 if (newm == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!) {
4550 sctp_m_freemcxx . . $ `usrsctplib/netinet/sctputil.h:57:9`!(m);
4551 SCTP_LTRACE_ERR_RETcxx . . $ `usrsctplib/netinet/sctp_os_userspace.h:629:9`!(inp, stcb, NULL, SCTP_FROM_SCTP_OUTPUT, ENOMEM);
4552 return (ENOMEMcxx . . $ `<external>/8987895939074593727/errno-base.h:16:9`!);
4553 }
4554 SCTP_ALIGN_TO_ENDcxx . . $ `usrsctplib/netinet/sctp_os_userspace.h:801:9`!(newm, len);
4555 SCTP_BUF_LENcxx . . $ `usrsctplib/netinet/sctp_os_userspace.h:790:9`!(newm) = len;
4556 SCTP_BUF_NEXTcxx . . $ `usrsctplib/netinet/sctp_os_userspace.h:791:9`!(newm) = m;
4557 m = newm;
4558 #if defined(__FreeBSD__) && !defined(__Userspace__cxx . . $ `<built-in>:442:9`!)
4559 if (net != NULL) {
4560 m->m_pkthdr.flowid = net->flowid;
4561 M_HASHTYPE_SET(m, net->flowtype);
4562 } else {
4563 m->m_pkthdr.flowid = mflowid;
4564 M_HASHTYPE_SET(m, mflowtype);
4565 }
4566 #endif
4567 packet_length = sctp_calculate_lencxx . . $ sctp_calculate_len(ffa3bcd30533ce4c).(m);
4568
4569 ip6h = mtodcxx . . $ `usrsctplib/user_mbuf.h:96:9`!(m, struct ip6_hdr *);
4570 /* protect *sin6 from overwrite */
4571 sin6 = (struct sockaddr_in6cxx . . $ sockaddr_in6# *)to;
4572 tmp = *sin6;
4573 sin6 = &tmp;
4574
4575 #ifdef SCTP_EMBEDDED_V6_SCOPE
4576 /* KAME hack: embed scopeid */
4577 #if defined(__APPLE__) && !defined(__Userspace__)
4578 #if defined(APPLE_LEOPARD) || defined(APPLE_SNOWLEOPARD)
4579 if (in6_embedscope(&sin6->sin6_addr, sin6, NULL, NULL) != 0)
4580 #else
4581 if (in6_embedscope(&sin6->sin6_addr, sin6, NULL, NULL, NULL) != 0)
4582 #endif
4583 #elif defined(SCTP_KAME)
4584 if (sa6_embedscope(sin6, MODULE_GLOBAL(ip6_use_defzone)) != 0)
4585 #else
4586 if (in6_embedscope(&sin6->sin6_addr, sin6) != 0)
4587 #endif
4588 {
4589 SCTP_LTRACE_ERR_RET_PKT(m, inp, stcb, net, SCTP_FROM_SCTP_OUTPUT, EINVAL);
4590 sctp_m_freem(m);
4591 return (EINVAL);
4592 }
4593 #endif /* SCTP_EMBEDDED_V6_SCOPE */
4594 if (net == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!) {
4595 memsetcxx . . $ memset(d1de1e4fb215f1c6).(&ip6route, 0, sizeof(ip6route));
4596 ro = (sctp_route_tcxx . . $ sctp_route_t# *)&ip6route;
4597 #ifdef HAVE_SIN6_LEN
4598 memcpy(&ro->ro_dst, sin6, sin6->sin6_len);
4599 #else
4600 memcpycxx . . $ memcpy(cc817cb175f282d).(&ro->ro_dstcxx . . $ sctp_route#ro_dst., sin6, sizeof(struct sockaddr_in6cxx . . $ sockaddr_in6#));
4601 #endif
4602 } else {
4603 ro = (sctp_route_tcxx . . $ sctp_route_t# *)&net->rocxx . . $ sctp_nets#ro.;
4604 }
4605 /*
4606 * We assume here that inp_flow is in host byte order within
4607 * the TCB!
4608 */
4609 if (tos_value == 0) {
4610 /*
4611 * This means especially, that it is not set at the
4612 * SCTP layer. So use the value from the IP layer.
4613 */
4614 #if defined(__APPLE__) && !defined(__Userspace__cxx . . $ `<built-in>:442:9`!) && (!defined(APPLE_LEOPARD) && !defined(APPLE_SNOWLEOPARD) && !defined(APPLE_LION) && !defined(APPLE_MOUNTAINLION))
4615 tos_value = (ntohl(inp->ip_inp.inp.inp_flow) >> 20) & 0xff;
4616 #else
4617 tos_value = (ntohlcxx . . $ ntohl(2141b656ce2cc063).(((struct inpcbcxx . . $ inpcb# *)inp)->inp_flowcxx . . $ inpcb#inp_flow.) >> 20) & 0xff;
4618 #endif
4619 }
4620 tos_value &= 0xfc;
4621 if (ecn_ok) {
4622 tos_value |= sctp_get_ectcxx . . $ sctp_get_ect(fb1f252870490d40).(stcb);
4623 }
4624 flowinfo = 0x06;
4625 flowinfo <<= 8;
4626 flowinfo |= tos_value;
4627 flowinfo <<= 20;
4628 flowinfo |= flowlabel;
4629 ip6h->ip6_flowcxx . . $ `<external>/1166123355531259342/ip6.h:43:9`! = htonlcxx . . $ htonl(2141b656ce2cc063).(flowinfo);
4630 if (port) {
4631 ip6h->ip6_nxtcxx . . $ `<external>/1166123355531259342/ip6.h:45:9`! = IPPROTO_UDPcxx . . $ `<external>/9581057695539925927/in.h:57:9`!;
4632 } else {
4633 ip6h->ip6_nxtcxx . . $ `<external>/1166123355531259342/ip6.h:45:9`! = IPPROTO_SCTPcxx . . $ `<external>/9581057695539925927/in.h:87:9`!;
4634 }
4635 ip6h->ip6_plencxx . . $ `<external>/1166123355531259342/ip6.h:44:9`! = htonscxx . . $ htons(a18c05e4017afb3d).((uint16_tcxx . . $ uint16_t#)(packet_length - sizeof(struct ip6_hdrcxx . . $ ip6_hdr#)));
4636 ip6h->ip6_dstcxx . . $ ip6_hdr#ip6_dst. = sin6->sin6_addrcxx . . $ sockaddr_in6#sin6_addr.;
4637
4638 /*
4639 * Add SRC address selection here: we can only reuse to a
4640 * limited degree the kame src-addr-sel, since we can try
4641 * their selection but it may not be bound.
4642 */
4643 memsetcxx . . $ memset(d1de1e4fb215f1c6).(&lsa6_tmp, 0, sizeof(lsa6_tmp));
4644 lsa6_tmp.sin6_familycxx . . $ sockaddr_in6#sin6_family. = AF_INET6cxx . . $ `<external>/8962547315054503424/socket.h:105:9`!;
4645 #ifdef HAVE_SIN6_LEN
4646 lsa6_tmp.sin6_len = sizeof(lsa6_tmp);
4647 #endif
4648 lsa6 = &lsa6_tmp;
4649 if (net && out_of_asoc_ok == 0) {
4650 if (net->rocxx . . $ sctp_nets#ro.._s_addrcxx . . $ sctp_net_route#_s_addr. && (net->rocxx . . $ sctp_nets#ro.._s_addrcxx . . $ sctp_net_route#_s_addr.->localifa_flagscxx . . $ sctp_ifa#localifa_flags. & (SCTP_BEING_DELETEDcxx . . $ `usrsctplib/netinet/sctp_pcb.h:95:9`!|SCTP_ADDR_IFA_UNUSEABLEcxx . . $ `usrsctplib/netinet/sctp_pcb.h:103:9`!))) {
4651 sctp_free_ifacxx . . $ sctp_free_ifa(e5ce6e4bf5862a47).(net->rocxx . . $ sctp_nets#ro.._s_addrcxx . . $ sctp_net_route#_s_addr.);
4652 net->rocxx . . $ sctp_nets#ro.._s_addrcxx . . $ sctp_net_route#_s_addr. = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!;
4653 net->src_addr_selectedcxx . . $ sctp_nets#src_addr_selected. = 0;
4654 #if defined(__FreeBSD__) && !defined(__Userspace__cxx . . $ `<built-in>:442:9`!)
4655 RO_NHFREE(ro);
4656 #else
4657 if (ro->ro_rtcxx . . $ sctp_route#ro_rt.) {
4658 RTFREEcxx . . $ `usrsctplib/user_route.h:126:9`!(ro->ro_rt);
4659 ro->ro_rtcxx . . $ sctp_route#ro_rt. = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!;
4660 }
4661 #endif
4662 }
4663 if (net->src_addr_selectedcxx . . $ sctp_nets#src_addr_selected. == 0) {
4664 #ifdef SCTP_EMBEDDED_V6_SCOPE
4665 sin6 = (struct sockaddr_in6 *)&net->ro._l_addr;
4666 /* KAME hack: embed scopeid */
4667 #if defined(__APPLE__) && !defined(__Userspace__)
4668 #if defined(APPLE_LEOPARD) || defined(APPLE_SNOWLEOPARD)
4669 if (in6_embedscope(&sin6->sin6_addr, sin6, NULL, NULL) != 0)
4670 #else
4671 if (in6_embedscope(&sin6->sin6_addr, sin6, NULL, NULL, NULL) != 0)
4672 #endif
4673 #elif defined(SCTP_KAME)
4674 if (sa6_embedscope(sin6, MODULE_GLOBAL(ip6_use_defzone)) != 0)
4675 #else
4676 if (in6_embedscope(&sin6->sin6_addr, sin6) != 0)
4677 #endif
4678 {
4679 SCTP_LTRACE_ERR_RET_PKT(m, inp, stcb, net, SCTP_FROM_SCTP_OUTPUT, EINVAL);
4680 sctp_m_freem(m);
4681 return (EINVAL);
4682 }
4683 #endif /* SCTP_EMBEDDED_V6_SCOPE */
4684 /* Cache the source address */
4685 net->rocxx . . $ sctp_nets#ro.._s_addrcxx . . $ sctp_net_route#_s_addr. = sctp_source_address_selectioncxx . . $ sctp_source_address_selection(8ee075f20da66e1).(inp,
4686 stcb,
4687 ro,
4688 net,
4689 0,
4690 vrf_id);
4691 #ifdef SCTP_EMBEDDED_V6_SCOPE
4692 #ifdef SCTP_KAME
4693 (void)sa6_recoverscope(sin6);
4694 #else
4695 (void)in6_recoverscope(sin6, &sin6->sin6_addr, NULL);
4696 #endif /* SCTP_KAME */
4697 #endif /* SCTP_EMBEDDED_V6_SCOPE */
4698 net->src_addr_selectedcxx . . $ sctp_nets#src_addr_selected. = 1;
4699 }
4700 if (net->rocxx . . $ sctp_nets#ro.._s_addrcxx . . $ sctp_net_route#_s_addr. == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!) {
4701 SCTPDBGcxx . . $ `usrsctplib/netinet/sctp_os_userspace.h:591:9`!(SCTP_DEBUG_OUTPUT3cxx . . $ `usrsctplib/netinet/sctp_constants.h:645:9`!, "V6:No route to host\n");
4702 net->src_addr_selectedcxx . . $ sctp_nets#src_addr_selected. = 0;
4703 sctp_handle_no_routecxx . . $ sctp_handle_no_route(406952e61e1e418d).(stcb, net, so_locked);
4704 SCTP_LTRACE_ERR_RET_PKTcxx . . $ `usrsctplib/netinet/sctp_os_userspace.h:628:9`!(m, inp, stcb, NULL, SCTP_FROM_SCTP_OUTPUT, EHOSTUNREACH);
4705 sctp_m_freemcxx . . $ `usrsctplib/netinet/sctputil.h:57:9`!(m);
4706 return (EHOSTUNREACHcxx . . $ `<external>/17922322188510340118/errno.h:97:9`!);
4707 }
4708 lsa6->sin6_addrcxx . . $ sockaddr_in6#sin6_addr. = net->rocxx . . $ sctp_nets#ro.._s_addrcxx . . $ sctp_net_route#_s_addr.->addresscxx . . $ sctp_ifa#address..sin6.sin6_addrcxx . . $ sockaddr_in6#sin6_addr.;
4709 } else {
4710 #ifdef SCTP_EMBEDDED_V6_SCOPE
4711 sin6 = (struct sockaddr_in6 *)&ro->ro_dst;
4712 /* KAME hack: embed scopeid */
4713 #if defined(__APPLE__) && !defined(__Userspace__)
4714 #if defined(APPLE_LEOPARD) || defined(APPLE_SNOWLEOPARD)
4715 if (in6_embedscope(&sin6->sin6_addr, sin6, NULL, NULL) != 0)
4716 #else
4717 if (in6_embedscope(&sin6->sin6_addr, sin6, NULL, NULL, NULL) != 0)
4718 #endif
4719 #elif defined(SCTP_KAME)
4720 if (sa6_embedscope(sin6, MODULE_GLOBAL(ip6_use_defzone)) != 0)
4721 #else
4722 if (in6_embedscope(&sin6->sin6_addr, sin6) != 0)
4723 #endif
4724 {
4725 SCTP_LTRACE_ERR_RET_PKT(m, inp, stcb, net, SCTP_FROM_SCTP_OUTPUT, EINVAL);
4726 sctp_m_freem(m);
4727 return (EINVAL);
4728 }
4729 #endif /* SCTP_EMBEDDED_V6_SCOPE */
4730 if (over_addr == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!) {
4731 struct sctp_ifacxx . . $ sctp_ifa# *_lsrc;
4732
4733 _lsrc = sctp_source_address_selectioncxx . . $ sctp_source_address_selection(8ee075f20da66e1).(inp, stcb, ro,
4734 net,
4735 out_of_asoc_ok,
4736 vrf_id);
4737 if (_lsrc == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!) {
4738 sctp_handle_no_routecxx . . $ sctp_handle_no_route(406952e61e1e418d).(stcb, net, so_locked);
4739 SCTP_LTRACE_ERR_RET_PKTcxx . . $ `usrsctplib/netinet/sctp_os_userspace.h:628:9`!(m, inp, stcb, NULL, SCTP_FROM_SCTP_OUTPUT, EHOSTUNREACH);
4740 sctp_m_freemcxx . . $ `usrsctplib/netinet/sctputil.h:57:9`!(m);
4741 return (EHOSTUNREACHcxx . . $ `<external>/17922322188510340118/errno.h:97:9`!);
4742 }
4743 lsa6->sin6_addrcxx . . $ sockaddr_in6#sin6_addr. = _lsrc->addresscxx . . $ sctp_ifa#address..sin6.sin6_addrcxx . . $ sockaddr_in6#sin6_addr.;
4744 sctp_free_ifacxx . . $ sctp_free_ifa(e5ce6e4bf5862a47).(_lsrc);
4745 } else {
4746 lsa6->sin6_addrcxx . . $ sockaddr_in6#sin6_addr. = over_addr->sin6.sin6_addrcxx . . $ sockaddr_in6#sin6_addr.;
4747 SCTP_RTALLOCcxx . . $ `usrsctplib/netinet/sctp_os_userspace.h:860:9`!(ro, vrf_id, inp->fibnum);
4748 }
4749 #ifdef SCTP_EMBEDDED_V6_SCOPE
4750 #ifdef SCTP_KAME
4751 (void)sa6_recoverscope(sin6);
4752 #else
4753 (void)in6_recoverscope(sin6, &sin6->sin6_addr, NULL);
4754 #endif /* SCTP_KAME */
4755 #endif /* SCTP_EMBEDDED_V6_SCOPE */
4756 }
4757 lsa6->sin6_portcxx . . $ sockaddr_in6#sin6_port. = inp->sctp_lportcxx . . $ `usrsctplib/netinet/sctp_pcb.h:430:9`!;
4758
4759 #if defined(__FreeBSD__) && !defined(__Userspace__cxx . . $ `<built-in>:442:9`!)
4760 if (ro->ro_nh == NULL) {
4761 #else
4762 if (ro->ro_rtcxx . . $ sctp_route#ro_rt. == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!) {
4763 #endif
4764 /*
4765 * src addr selection failed to find a route (or
4766 * valid source addr), so we can't get there from
4767 * here!
4768 */
4769 sctp_handle_no_routecxx . . $ sctp_handle_no_route(406952e61e1e418d).(stcb, net, so_locked);
4770 SCTP_LTRACE_ERR_RET_PKTcxx . . $ `usrsctplib/netinet/sctp_os_userspace.h:628:9`!(m, inp, stcb, NULL, SCTP_FROM_SCTP_OUTPUT, EHOSTUNREACH);
4771 sctp_m_freemcxx . . $ `usrsctplib/netinet/sctputil.h:57:9`!(m);
4772 return (EHOSTUNREACHcxx . . $ `<external>/17922322188510340118/errno.h:97:9`!);
4773 }
4774 #ifndef SCOPEDROUTING
4775 #ifdef SCTP_EMBEDDED_V6_SCOPE
4776 /*
4777 * XXX: sa6 may not have a valid sin6_scope_id in the
4778 * non-SCOPEDROUTING case.
4779 */
4780 memset(&lsa6_storage, 0, sizeof(lsa6_storage));
4781 lsa6_storage.sin6_family = AF_INET6;
4782 #ifdef HAVE_SIN6_LEN
4783 lsa6_storage.sin6_len = sizeof(lsa6_storage);
4784 #endif
4785 #ifdef SCTP_KAME
4786 lsa6_storage.sin6_addr = lsa6->sin6_addr;
4787 if ((error = sa6_recoverscope(&lsa6_storage)) != 0) {
4788 #else
4789 if ((error = in6_recoverscope(&lsa6_storage, &lsa6->sin6_addr,
4790 NULL)) != 0) {
4791 #endif /* SCTP_KAME */
4792 SCTPDBG(SCTP_DEBUG_OUTPUT3, "recover scope fails error %d\n", error);
4793 sctp_m_freem(m);
4794 return (error);
4795 }
4796 /* XXX */
4797 lsa6_storage.sin6_addr = lsa6->sin6_addr;
4798 lsa6_storage.sin6_port = inp->sctp_lport;
4799 lsa6 = &lsa6_storage;
4800 #endif /* SCTP_EMBEDDED_V6_SCOPE */
4801 #endif /* SCOPEDROUTING */
4802 ip6h->ip6_srccxx . . $ ip6_hdr#ip6_src. = lsa6->sin6_addrcxx . . $ sockaddr_in6#sin6_addr.;
4803
4804 if (port) {
4805 if (htonscxx . . $ htons(a18c05e4017afb3d).(SCTP_BASE_SYSCTLcxx . . $ `usrsctplib/netinet/sctp_os_userspace.h:579:9`!(sctp_udp_tunneling_port)) == 0) {
4806 sctp_handle_no_routecxx . . $ sctp_handle_no_route(406952e61e1e418d).(stcb, net, so_locked);
4807 SCTP_LTRACE_ERR_RET_PKTcxx . . $ `usrsctplib/netinet/sctp_os_userspace.h:628:9`!(m, inp, stcb, NULL, SCTP_FROM_SCTP_OUTPUT, EHOSTUNREACH);
4808 sctp_m_freemcxx . . $ `usrsctplib/netinet/sctputil.h:57:9`!(m);
4809 return (EHOSTUNREACHcxx . . $ `<external>/17922322188510340118/errno.h:97:9`!);
4810 }
4811 udp = (struct udphdrcxx . . $ udphdr# *)((caddr_tcxx . . $ caddr_t#)ip6h + sizeof(struct ip6_hdrcxx . . $ ip6_hdr#));
4812 udp->uh_sportcxx . . $ udphdr#$anonymous_type_0#$anonymous_type_1#uh_sport. = htonscxx . . $ htons(a18c05e4017afb3d).(SCTP_BASE_SYSCTLcxx . . $ `usrsctplib/netinet/sctp_os_userspace.h:579:9`!(sctp_udp_tunneling_port));
4813 udp->uh_dportcxx . . $ udphdr#$anonymous_type_0#$anonymous_type_1#uh_dport. = port;
4814 udp->uh_ulencxx . . $ udphdr#$anonymous_type_0#$anonymous_type_1#uh_ulen. = htonscxx . . $ htons(a18c05e4017afb3d).((uint16_tcxx . . $ uint16_t#)(packet_length - sizeof(struct ip6_hdrcxx . . $ ip6_hdr#)));
4815 udp->uh_sumcxx . . $ udphdr#$anonymous_type_0#$anonymous_type_1#uh_sum. = 0;
4816 sctphdr = (struct sctphdrcxx . . $ sctphdr# *)((caddr_tcxx . . $ caddr_t#)udp + sizeof(struct udphdrcxx . . $ udphdr#));
4817 } else {
4818 sctphdr = (struct sctphdrcxx . . $ sctphdr# *)((caddr_tcxx . . $ caddr_t#)ip6h + sizeof(struct ip6_hdrcxx . . $ ip6_hdr#));
4819 }
4820
4821 sctphdr->src_portcxx . . $ sctphdr#src_port. = src_port;
4822 sctphdr->dest_portcxx . . $ sctphdr#dest_port. = dest_port;
4823 sctphdr->v_tagcxx . . $ sctphdr#v_tag. = v_tag;
4824 sctphdr->checksumcxx . . $ sctphdr#checksum. = 0;
4825
4826 /*
4827 * We set the hop limit now since there is a good chance
4828 * that our ro pointer is now filled
4829 */
4830 ip6h->ip6_hlimcxx . . $ `<external>/1166123355531259342/ip6.h:46:9`! = SCTP_GET_HLIMcxx . . $ `usrsctplib/netinet/sctp_os_userspace.h:941:9`!(inp, ro);
4831 #if !defined(__Userspace__cxx . . $ `<built-in>:442:9`!)
4832 ifp = SCTP_GET_IFN_VOID_FROM_ROUTE(ro);
4833 #endif
4834
4835 #ifdef SCTP_DEBUGcxx . . $ `<built-in>:430:9`!
4836 /* Copy to be sure something bad is not happening */
4837 sin6->sin6_addrcxx . . $ sockaddr_in6#sin6_addr. = ip6h->ip6_dstcxx . . $ ip6_hdr#ip6_dst.;
4838 lsa6->sin6_addrcxx . . $ sockaddr_in6#sin6_addr. = ip6h->ip6_srccxx . . $ ip6_hdr#ip6_src.;
4839 #endif
4840
4841 SCTPDBGcxx . . $ `usrsctplib/netinet/sctp_os_userspace.h:591:9`!(SCTP_DEBUG_OUTPUT3cxx . . $ `usrsctplib/netinet/sctp_constants.h:645:9`!, "Calling ipv6 output routine from low level\n");
4842 SCTPDBGcxx . . $ `usrsctplib/netinet/sctp_os_userspace.h:591:9`!(SCTP_DEBUG_OUTPUT3cxx . . $ `usrsctplib/netinet/sctp_constants.h:645:9`!, "src: ");
4843 SCTPDBG_ADDRcxx . . $ `usrsctplib/netinet/sctp_os_userspace.h:599:9`!(SCTP_DEBUG_OUTPUT3cxx . . $ `usrsctplib/netinet/sctp_constants.h:645:9`!, (struct sockaddr *)lsa6);
4844 SCTPDBGcxx . . $ `usrsctplib/netinet/sctp_os_userspace.h:591:9`!(SCTP_DEBUG_OUTPUT3cxx . . $ `usrsctplib/netinet/sctp_constants.h:645:9`!, "dst: ");
4845 SCTPDBG_ADDRcxx . . $ `usrsctplib/netinet/sctp_os_userspace.h:599:9`!(SCTP_DEBUG_OUTPUT3cxx . . $ `usrsctplib/netinet/sctp_constants.h:645:9`!, (struct sockaddr *)sin6);
4846 if (net) {
4847 sin6 = (struct sockaddr_in6cxx . . $ sockaddr_in6# *)&net->rocxx . . $ sctp_nets#ro.._l_addrcxx . . $ sctp_net_route#_l_addr.;
4848 /* preserve the port and scope for link local send */
4849 prev_scope = sin6->sin6_scope_idcxx . . $ sockaddr_in6#sin6_scope_id.;
4850 prev_port = sin6->sin6_portcxx . . $ sockaddr_in6#sin6_port.;
4851 }
4852
4853 if (SCTP_GET_HEADER_FOR_OUTPUTcxx . . $ `usrsctplib/netinet/sctp_os_userspace.h:913:9`!(o_pak)) {
4854 /* failed to prepend data, give up */
4855 sctp_m_freemcxx . . $ `usrsctplib/netinet/sctputil.h:57:9`!(m);
4856 SCTP_LTRACE_ERR_RETcxx . . $ `usrsctplib/netinet/sctp_os_userspace.h:629:9`!(inp, stcb, NULL, SCTP_FROM_SCTP_OUTPUT, ENOMEM);
4857 return (ENOMEMcxx . . $ `<external>/8987895939074593727/errno-base.h:16:9`!);
4858 }
4859 SCTP_ATTACH_CHAINcxx . . $ `usrsctplib/netinet/sctp_os_userspace.h:922:9`!(o_pak, m, packet_length);
4860 if (port) {
4861 sctphdr->checksumcxx . . $ sctphdr#checksum. = sctp_calculate_cksumcxx . . $ sctp_calculate_cksum(ee29b78d597cafbf).(m, sizeof(struct ip6_hdrcxx . . $ ip6_hdr#) + sizeof(struct udphdrcxx . . $ udphdr#));
4862 SCTP_STAT_INCRcxx . . $ `./netinet/sctp_uio.h:1111:9`!(sctps_sendswcrc);
4863 #if !defined(__Userspace__cxx . . $ `<built-in>:442:9`!)
4864 #if defined(_WIN32)
4865 udp->uh_sum = 0;
4866 #else
4867 if ((udp->uh_sum = in6_cksum(o_pak, IPPROTO_UDP, sizeof(struct ip6_hdr), packet_length - sizeof(struct ip6_hdr))) == 0) {
4868 udp->uh_sum = 0xffff;
4869 }
4870 #endif
4871 #endif
4872 } else {
4873 #if defined(__FreeBSD__) && !defined(__Userspace__cxx . . $ `<built-in>:442:9`!)
4874 m->m_pkthdr.csum_flags = CSUM_SCTP_IPV6;
4875 m->m_pkthdr.csum_data = offsetof(struct sctphdr, checksum);
4876 SCTP_STAT_INCR(sctps_sendhwcrc);
4877 #else
4878 if (!(SCTP_BASE_SYSCTLcxx . . $ `usrsctplib/netinet/sctp_os_userspace.h:579:9`!(sctp_no_csum_on_loopback) &&
4879 (stcb) && (stcb->asoccxx . . $ sctp_tcb#asoc..scopecxx . . $ sctp_association#scope..loopback_scopecxx . . $ sctp_scoping#loopback_scope.))) {
4880 sctphdr->checksumcxx . . $ sctphdr#checksum. = sctp_calculate_cksumcxx . . $ sctp_calculate_cksum(ee29b78d597cafbf).(m, sizeof(struct ip6_hdrcxx . . $ ip6_hdr#));
4881 SCTP_STAT_INCRcxx . . $ `./netinet/sctp_uio.h:1111:9`!(sctps_sendswcrc);
4882 } else {
4883 SCTP_STAT_INCRcxx . . $ `./netinet/sctp_uio.h:1111:9`!(sctps_sendhwcrc);
4884 }
4885 #endif
4886 }
4887 /* send it out. table id is taken from stcb */
4888 #if defined(__APPLE__) && !defined(__Userspace__cxx . . $ `<built-in>:442:9`!)
4889 if ((SCTP_BASE_SYSCTL(sctp_output_unlocked)) && (so_locked)) {
4890 so = SCTP_INP_SO(inp);
4891 SCTP_SOCKET_UNLOCK(so, 0);
4892 }
4893 #endif
4894 #ifdef SCTP_PACKET_LOGGING
4895 if (SCTP_BASE_SYSCTL(sctp_logging_level) & SCTP_LAST_PACKET_TRACING)
4896 sctp_packet_log(o_pak);
4897 #endif
4898 #if !defined(__Userspace__cxx . . $ `<built-in>:442:9`!)
4899 #if defined(__FreeBSD__)
4900 SCTP_PROBE5(send, NULL, stcb, ip6h, stcb, sctphdr);
4901 #endif
4902 SCTP_IP6_OUTPUT(ret, o_pak, (struct route_in6 *)ro, &ifp, stcb, vrf_id);
4903 #else
4904 SCTP_IP6_OUTPUTcxx . . $ `usrsctplib/netinet/sctp_os_userspace.h:1043:9`!(ret, o_pak, (struct route_in6 *)ro, NULL, stcb, vrf_id);
4905 #endif
4906 #if defined(__APPLE__) && !defined(__Userspace__cxx . . $ `<built-in>:442:9`!)
4907 if ((SCTP_BASE_SYSCTL(sctp_output_unlocked)) && (so_locked)) {
4908 atomic_add_int(&stcb->asoc.refcnt, 1);
4909 SCTP_TCB_UNLOCK(stcb);
4910 SCTP_SOCKET_LOCK(so, 0);
4911 SCTP_TCB_LOCK(stcb);
4912 atomic_subtract_int(&stcb->asoc.refcnt, 1);
4913 }
4914 #endif
4915 if (net) {
4916 /* for link local this must be done */
4917 sin6->sin6_scope_idcxx . . $ sockaddr_in6#sin6_scope_id. = prev_scope;
4918 sin6->sin6_portcxx . . $ sockaddr_in6#sin6_port. = prev_port;
4919 }
4920 SCTPDBGcxx . . $ `usrsctplib/netinet/sctp_os_userspace.h:591:9`!(SCTP_DEBUG_OUTPUT3cxx . . $ `usrsctplib/netinet/sctp_constants.h:645:9`!, "return from send is %d\n", ret);
4921 #if defined(__FreeBSD__) && !defined(__Userspace__cxx . . $ `<built-in>:442:9`!)
4922 if (port) {
4923 UDPSTAT_INC(udps_opackets);
4924 }
4925 #endif
4926 SCTP_STAT_INCRcxx . . $ `./netinet/sctp_uio.h:1111:9`!(sctps_sendpackets);
4927 SCTP_STAT_INCR_COUNTER64cxx . . $ `./netinet/sctp_uio.h:1127:9`!(sctps_outpackets);
4928 if (ret) {
4929 SCTP_STAT_INCRcxx . . $ `./netinet/sctp_uio.h:1111:9`!(sctps_senderrors);
4930 }
4931 if (net == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!) {
4932 /* Now if we had a temp route free it */
4933 #if defined(__FreeBSD__) && !defined(__Userspace__cxx . . $ `<built-in>:442:9`!)
4934 RO_NHFREE(ro);
4935 #else
4936 if (ro->ro_rtcxx . . $ sctp_route#ro_rt.) {
4937 RTFREEcxx . . $ `usrsctplib/user_route.h:126:9`!(ro->ro_rt);
4938 ro->ro_rtcxx . . $ sctp_route#ro_rt. = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!;
4939 }
4940 #endif
4941 } else {
4942 /* PMTU check versus smallest asoc MTU goes here */
4943 #if defined(__FreeBSD__) && !defined(__Userspace__cxx . . $ `<built-in>:442:9`!)
4944 if (ro->ro_nh == NULL) {
4945 #else
4946 if (ro->ro_rtcxx . . $ sctp_route#ro_rt. == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!) {
4947 #endif
4948 /* Route was freed */
4949 if (net->rocxx . . $ sctp_nets#ro.._s_addrcxx . . $ sctp_net_route#_s_addr. &&
4950 net->src_addr_selectedcxx . . $ sctp_nets#src_addr_selected.) {
4951 sctp_free_ifacxx . . $ sctp_free_ifa(e5ce6e4bf5862a47).(net->rocxx . . $ sctp_nets#ro.._s_addrcxx . . $ sctp_net_route#_s_addr.);
4952 net->rocxx . . $ sctp_nets#ro.._s_addrcxx . . $ sctp_net_route#_s_addr. = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!;
4953 }
4954 net->src_addr_selectedcxx . . $ sctp_nets#src_addr_selected. = 0;
4955 }
4956 #if defined(__FreeBSD__) && !defined(__Userspace__cxx . . $ `<built-in>:442:9`!)
4957 if ((ro->ro_nh != NULL) && (net->ro._s_addr) &&
4958 #else
4959 if ((ro->ro_rtcxx . . $ sctp_route#ro_rt. != NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!) && (net->rocxx . . $ sctp_nets#ro.._s_addrcxx . . $ sctp_net_route#_s_addr.) &&
4960 #endif
4961 ((net->dest_statecxx . . $ sctp_nets#dest_state. & SCTP_ADDR_NO_PMTUDcxx . . $ `usrsctplib/netinet/sctp_constants.h:487:9`!) == 0)) {
4962 uint32_tcxx . . $ uint32_t# mtu;
4963
4964 #if defined(__FreeBSD__) && !defined(__Userspace__cxx . . $ `<built-in>:442:9`!)
4965 mtu = SCTP_GATHER_MTU_FROM_ROUTE(net->ro._s_addr, &net->ro._l_addr.sa, ro->ro_nh);
4966 #else
4967 mtu = SCTP_GATHER_MTU_FROM_ROUTEcxx . . $ `usrsctplib/netinet/sctp_os_userspace.h:883:9`!(net->ro._s_addr, &net->ro._l_addr.sa, ro->ro_rt);
4968 #endif
4969 if (mtu > 0) {
4970 if (net->portcxx . . $ sctp_nets#port.) {
4971 mtu -= sizeof(struct udphdrcxx . . $ udphdr#);
4972 }
4973 if (mtu < net->mtucxx . . $ sctp_nets#mtu.) {
4974 if ((stcb != NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!) && (stcb->asoccxx . . $ sctp_tcb#asoc..smallest_mtucxx . . $ sctp_association#smallest_mtu. > mtu)) {
4975 sctp_mtu_size_resetcxx . . $ sctp_mtu_size_reset(3f17faeebe465efe).(inp, &stcb->asoccxx . . $ sctp_tcb#asoc., mtu);
4976 }
4977 net->mtucxx . . $ sctp_nets#mtu. = mtu;
4978 }
4979 }
4980 }
4981 #if !defined(__Userspace__cxx . . $ `<built-in>:442:9`!)
4982 else if (ifp) {
4983 #if defined(_WIN32)
4984 #define ND_IFINFO(ifp) (ifp)
4985 #define linkmtu if_mtu
4986 #endif
4987 if (ND_IFINFO(ifp)->linkmtu &&
4988 (stcb->asoc.smallest_mtu > ND_IFINFO(ifp)->linkmtu)) {
4989 sctp_mtu_size_reset(inp,
4990 &stcb->asoc,
4991 ND_IFINFO(ifp)->linkmtu);
4992 }
4993 }
4994 #endif
4995 }
4996 return (ret);
4997 }
4998 #endif
4999 #if defined(__Userspace__cxx . . $ `<built-in>:442:9`!)
5000 case AF_CONNcxx . . $ `usrsctplib/netinet/sctp_os_userspace.h:995:9`!:
5001 {
5002 char *buffer;
5003 struct sockaddr_conncxx . . $ sockaddr_conn# *sconn;
5004 int len;
5005
5006 sconn = (struct sockaddr_conncxx . . $ sockaddr_conn# *)to;
5007 len = sizeof(struct sctphdrcxx . . $ sctphdr#);
5008 newm = sctp_get_mbuf_for_msgcxx . . $ sctp_get_mbuf_for_msg(c7c30fc329598377).(len, 1, M_NOWAITcxx . . $ `usrsctplib/user_malloc.h:60:9`!, 1, MT_DATAcxx . . $ `usrsctplib/user_mbuf.h:289:9`!);
5009 if (newm == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!) {
5010 sctp_m_freemcxx . . $ `usrsctplib/netinet/sctputil.h:57:9`!(m);
5011 SCTP_LTRACE_ERR_RETcxx . . $ `usrsctplib/netinet/sctp_os_userspace.h:629:9`!(inp, stcb, NULL, SCTP_FROM_SCTP_OUTPUT, ENOMEM);
5012 return (ENOMEMcxx . . $ `<external>/8987895939074593727/errno-base.h:16:9`!);
5013 }
5014 SCTP_ALIGN_TO_ENDcxx . . $ `usrsctplib/netinet/sctp_os_userspace.h:801:9`!(newm, len);
5015 SCTP_BUF_LENcxx . . $ `usrsctplib/netinet/sctp_os_userspace.h:790:9`!(newm) = len;
5016 SCTP_BUF_NEXTcxx . . $ `usrsctplib/netinet/sctp_os_userspace.h:791:9`!(newm) = m;
5017 m = newm;
5018 packet_length = sctp_calculate_lencxx . . $ sctp_calculate_len(ffa3bcd30533ce4c).(m);
5019 sctphdr = mtodcxx . . $ `usrsctplib/user_mbuf.h:96:9`!(m, struct sctphdr *);
5020 sctphdr->src_portcxx . . $ sctphdr#src_port. = src_port;
5021 sctphdr->dest_portcxx . . $ sctphdr#dest_port. = dest_port;
5022 sctphdr->v_tagcxx . . $ sctphdr#v_tag. = v_tag;
5023 sctphdr->checksumcxx . . $ sctphdr#checksum. = 0;
5024 if (SCTP_BASE_VARcxx . . $ `usrsctplib/netinet/sctp_os_userspace.h:580:9`!(crc32c_offloaded) == 0) {
5025 sctphdr->checksumcxx . . $ sctphdr#checksum. = sctp_calculate_cksumcxx . . $ sctp_calculate_cksum(ee29b78d597cafbf).(m, 0);
5026 SCTP_STAT_INCRcxx . . $ `./netinet/sctp_uio.h:1111:9`!(sctps_sendswcrc);
5027 } else {
5028 SCTP_STAT_INCRcxx . . $ `./netinet/sctp_uio.h:1111:9`!(sctps_sendhwcrc);
5029 }
5030 if (tos_value == 0) {
5031 tos_value = inp->ip_inpcxx . . $ sctp_inpcb#ip_inp..inpcxx . . $ sctp_inpcb#$anonymous_type_7#inp..inp_ip_toscxx . . $ `usrsctplib/user_inpcb.h:148:9`!;
5032 }
5033 tos_value &= 0xfc;
5034 if (ecn_ok) {
5035 tos_value |= sctp_get_ectcxx . . $ sctp_get_ect(fb1f252870490d40).(stcb);
5036 }
5037 /* Don't alloc/free for each packet */
5038 if ((buffer = malloccxx . . $ malloc(bfcfa4d6b7f7ef64).(packet_length)) != NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!) {
5039 m_copydatacxx . . $ m_copydata(fee92403c79d6892).(m, 0, packet_length, buffer);
5040 ret = SCTP_BASE_VARcxx . . $ `usrsctplib/netinet/sctp_os_userspace.h:580:9`!(conn_output)(sconn->sconn_addrcxx . . $ sockaddr_conn#sconn_addr., buffer, packet_length, tos_value, nofragment_flag);
5041 freecxx . . $ free(5d22bdacc48458e8).(buffer);
5042 } else {
5043 ret = ENOMEMcxx . . $ `<external>/8987895939074593727/errno-base.h:16:9`!;
5044 }
5045 sctp_m_freemcxx . . $ `usrsctplib/netinet/sctputil.h:57:9`!(m);
5046 return (ret);
5047 }
5048 #endif
5049 default:
5050 SCTPDBGcxx . . $ `usrsctplib/netinet/sctp_os_userspace.h:591:9`!(SCTP_DEBUG_OUTPUT1cxx . . $ `usrsctplib/netinet/sctp_constants.h:643:9`!, "Unknown protocol (TSNH) type %d\n",
5051 ((struct sockaddr *)to)->sa_family);
5052 sctp_m_freemcxx . . $ `usrsctplib/netinet/sctputil.h:57:9`!(m);
5053 SCTP_LTRACE_ERR_RET_PKTcxx . . $ `usrsctplib/netinet/sctp_os_userspace.h:628:9`!(m, inp, stcb, net, SCTP_FROM_SCTP_OUTPUT, EFAULT);
5054 return (EFAULTcxx . . $ `<external>/8987895939074593727/errno-base.h:18:9`!);
5055 }
5056 }
5057
5058 void
5059 sctp_send_initiatecxx . . $ sctp_send_initiate(a11f8a89c1538453).(struct sctp_inpcbcxx . . $ sctp_inpcb# *inp, struct sctp_tcbcxx . . $ sctp_tcb# *stcb, int so_locked)
5060 {
5061 struct mbufcxx . . $ mbuf# *m, *m_last;
5062 struct sctp_netscxx . . $ sctp_nets# *net;
5063 struct sctp_init_chunkcxx . . $ sctp_init_chunk# *init;
5064 struct sctp_supported_addr_paramcxx . . $ sctp_supported_addr_param# *sup_addr;
5065 struct sctp_adaptation_layer_indicationcxx . . $ sctp_adaptation_layer_indication# *ali;
5066 struct sctp_supported_chunk_types_paramcxx . . $ sctp_supported_chunk_types_param# *pr_supported;
5067 struct sctp_paramhdrcxx . . $ sctp_paramhdr# *ph;
5068 int cnt_inits_to = 0;
5069 int error;
5070 uint16_tcxx . . $ uint16_t# num_ext, chunk_len, padding_len, parameter_len;
5071
5072 #if defined(__APPLE__) && !defined(__Userspace__cxx . . $ `<built-in>:442:9`!)
5073 if (so_locked) {
5074 sctp_lock_assert(SCTP_INP_SO(inp));
5075 } else {
5076 sctp_unlock_assert(SCTP_INP_SO(inp));
5077 }
5078 #endif
5079 /* INIT's always go to the primary (and usually ONLY address) */
5080 net = stcb->asoccxx . . $ sctp_tcb#asoc..primary_destinationcxx . . $ sctp_association#primary_destination.;
5081 if (net == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!) {
5082 net = TAILQ_FIRSTcxx . . $ `<external>/2546723208511035544/queue.h:458:9`!(&stcb->asoc.nets);
5083 if (net == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!) {
5084 /* TSNH */
5085 return;
5086 }
5087 /* we confirm any address we send an INIT to */
5088 net->dest_statecxx . . $ sctp_nets#dest_state. &= ~SCTP_ADDR_UNCONFIRMEDcxx . . $ `usrsctplib/netinet/sctp_constants.h:492:9`!;
5089 (void)sctp_set_primary_addrcxx . . $ sctp_set_primary_addr(5293f138e739c026).(stcb, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!, net);
5090 } else {
5091 /* we confirm any address we send an INIT to */
5092 net->dest_statecxx . . $ sctp_nets#dest_state. &= ~SCTP_ADDR_UNCONFIRMEDcxx . . $ `usrsctplib/netinet/sctp_constants.h:492:9`!;
5093 }
5094 SCTPDBGcxx . . $ `usrsctplib/netinet/sctp_os_userspace.h:591:9`!(SCTP_DEBUG_OUTPUT4cxx . . $ `usrsctplib/netinet/sctp_constants.h:646:9`!, "Sending INIT\n");
5095 #ifdef INET6cxx . . $ `<built-in>:432:9`!
5096 if (net->rocxx . . $ sctp_nets#ro.._l_addrcxx . . $ sctp_net_route#_l_addr..sa.sa_familycxx . . $ sockaddr#sa_family. == AF_INET6cxx . . $ `<external>/8962547315054503424/socket.h:105:9`!) {
5097 /*
5098 * special hook, if we are sending to link local it will not
5099 * show up in our private address count.
5100 */
5101 if (IN6_IS_ADDR_LINKLOCALcxx . . $ `<external>/9581057695539925927/in.h:453:10`!(&net->ro._l_addr.sin6.sin6_addr))
5102 cnt_inits_to = 1;
5103 }
5104 #endif
5105 if (SCTP_OS_TIMER_PENDINGcxx . . $ `usrsctplib/netinet/sctp_callout.h:107:9`!(&net->rxt_timer.timer)) {
5106 /* This case should not happen */
5107 SCTPDBGcxx . . $ `usrsctplib/netinet/sctp_os_userspace.h:591:9`!(SCTP_DEBUG_OUTPUT4cxx . . $ `usrsctplib/netinet/sctp_constants.h:646:9`!, "Sending INIT - failed timer?\n");
5108 return;
5109 }
5110 /* start the INIT timer */
5111 sctp_timer_startcxx . . $ sctp_timer_start(73c9263bfa4b937d).(SCTP_TIMER_TYPE_INITcxx . . $ `usrsctplib/netinet/sctp_constants.h:538:9`!, inp, stcb, net);
5112
5113 m = sctp_get_mbuf_for_msgcxx . . $ sctp_get_mbuf_for_msg(c7c30fc329598377).(MCLBYTEScxx . . $ `usrsctplib/user_mbuf.h:51:9`!, 1, M_NOWAITcxx . . $ `usrsctplib/user_malloc.h:60:9`!, 1, MT_DATAcxx . . $ `usrsctplib/user_mbuf.h:289:9`!);
5114 if (m == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!) {
5115 /* No memory, INIT timer will re-attempt. */
5116 SCTPDBGcxx . . $ `usrsctplib/netinet/sctp_os_userspace.h:591:9`!(SCTP_DEBUG_OUTPUT4cxx . . $ `usrsctplib/netinet/sctp_constants.h:646:9`!, "Sending INIT - mbuf?\n");
5117 return;
5118 }
5119 chunk_len = (uint16_tcxx . . $ uint16_t#)sizeof(struct sctp_init_chunkcxx . . $ sctp_init_chunk#);
5120 padding_len = 0;
5121 /* Now lets put the chunk header in place */
5122 init = mtodcxx . . $ `usrsctplib/user_mbuf.h:96:9`!(m, struct sctp_init_chunk *);
5123 /* now the chunk header */
5124 init->chcxx . . $ sctp_init_chunk#ch..chunk_typecxx . . $ sctp_chunkhdr#chunk_type. = SCTP_INITIATIONcxx . . $ `usrsctplib/netinet/sctp.h:450:9`!;
5125 init->chcxx . . $ sctp_init_chunk#ch..chunk_flagscxx . . $ sctp_chunkhdr#chunk_flags. = 0;
5126 /* fill in later from mbuf we build */
5127 init->chcxx . . $ sctp_init_chunk#ch..chunk_lengthcxx . . $ sctp_chunkhdr#chunk_length. = 0;
5128 /* place in my tag */
5129 init->initcxx . . $ sctp_init_chunk#init..initiate_tagcxx . . $ sctp_init#initiate_tag. = htonlcxx . . $ htonl(2141b656ce2cc063).(stcb->asoccxx . . $ sctp_tcb#asoc..my_vtagcxx . . $ sctp_association#my_vtag.);
5130 /* set up some of the credits. */
5131 init->initcxx . . $ sctp_init_chunk#init..a_rwndcxx . . $ sctp_init#a_rwnd. = htonlcxx . . $ htonl(2141b656ce2cc063).(maxcxx . . $ `usrsctplib/user_environment.h:67:9`!(inp->sctp_socket?SCTP_SB_LIMIT_RCVcxx . . $ `usrsctplib/netinet/sctp_os_userspace.h:964:9`!(inp->sctp_socket):0,
5132 SCTP_MINIMAL_RWNDcxx . . $ `usrsctplib/netinet/sctp_constants.h:634:9`!));
5133 init->initcxx . . $ sctp_init_chunk#init..num_outbound_streamscxx . . $ sctp_init#num_outbound_streams. = htonscxx . . $ htons(a18c05e4017afb3d).(stcb->asoccxx . . $ sctp_tcb#asoc..pre_open_streamscxx . . $ sctp_association#pre_open_streams.);
5134 init->initcxx . . $ sctp_init_chunk#init..num_inbound_streamscxx . . $ sctp_init#num_inbound_streams. = htonscxx . . $ htons(a18c05e4017afb3d).(stcb->asoccxx . . $ sctp_tcb#asoc..max_inbound_streamscxx . . $ sctp_association#max_inbound_streams.);
5135 init->initcxx . . $ sctp_init_chunk#init..initial_tsncxx . . $ sctp_init#initial_tsn. = htonlcxx . . $ htonl(2141b656ce2cc063).(stcb->asoccxx . . $ sctp_tcb#asoc..init_seq_numbercxx . . $ sctp_association#init_seq_number.);
5136
5137 /* Adaptation layer indication parameter */
5138 if (inp->sctp_epcxx . . $ sctp_inpcb#sctp_ep..adaptation_layer_indicator_providedcxx . . $ sctp_pcb#adaptation_layer_indicator_provided.) {
5139 parameter_len = (uint16_tcxx . . $ uint16_t#)sizeof(struct sctp_adaptation_layer_indicationcxx . . $ sctp_adaptation_layer_indication#);
5140 ali = (struct sctp_adaptation_layer_indicationcxx . . $ sctp_adaptation_layer_indication# *)(mtodcxx . . $ `usrsctplib/user_mbuf.h:96:9`!(m, caddr_t) + chunk_len);
5141 ali->phcxx . . $ sctp_adaptation_layer_indication#ph..param_typecxx . . $ sctp_paramhdr#param_type. = htonscxx . . $ htons(a18c05e4017afb3d).(SCTP_ULP_ADAPTATIONcxx . . $ `usrsctplib/netinet/sctp_constants.h:440:9`!);
5142 ali->phcxx . . $ sctp_adaptation_layer_indication#ph..param_lengthcxx . . $ sctp_paramhdr#param_length. = htonscxx . . $ htons(a18c05e4017afb3d).(parameter_len);
5143 ali->indicationcxx . . $ sctp_adaptation_layer_indication#indication. = htonlcxx . . $ htonl(2141b656ce2cc063).(inp->sctp_epcxx . . $ sctp_inpcb#sctp_ep..adaptation_layer_indicatorcxx . . $ sctp_pcb#adaptation_layer_indicator.);
5144 chunk_len += parameter_len;
5145 }
5146
5147 /* ECN parameter */
5148 if (stcb->asoccxx . . $ sctp_tcb#asoc..ecn_supportedcxx . . $ sctp_association#ecn_supported. == 1) {
5149 parameter_len = (uint16_tcxx . . $ uint16_t#)sizeof(struct sctp_paramhdrcxx . . $ sctp_paramhdr#);
5150 ph = (struct sctp_paramhdrcxx . . $ sctp_paramhdr# *)(mtodcxx . . $ `usrsctplib/user_mbuf.h:96:9`!(m, caddr_t) + chunk_len);
5151 ph->param_typecxx . . $ sctp_paramhdr#param_type. = htonscxx . . $ htons(a18c05e4017afb3d).(SCTP_ECN_CAPABLEcxx . . $ `usrsctplib/netinet/sctp_constants.h:421:9`!);
5152 ph->param_lengthcxx . . $ sctp_paramhdr#param_length. = htonscxx . . $ htons(a18c05e4017afb3d).(parameter_len);
5153 chunk_len += parameter_len;
5154 }
5155
5156 /* PR-SCTP supported parameter */
5157 if (stcb->asoccxx . . $ sctp_tcb#asoc..prsctp_supportedcxx . . $ sctp_association#prsctp_supported. == 1) {
5158 parameter_len = (uint16_tcxx . . $ uint16_t#)sizeof(struct sctp_paramhdrcxx . . $ sctp_paramhdr#);
5159 ph = (struct sctp_paramhdrcxx . . $ sctp_paramhdr# *)(mtodcxx . . $ `usrsctplib/user_mbuf.h:96:9`!(m, caddr_t) + chunk_len);
5160 ph->param_typecxx . . $ sctp_paramhdr#param_type. = htonscxx . . $ htons(a18c05e4017afb3d).(SCTP_PRSCTP_SUPPORTEDcxx . . $ `usrsctplib/netinet/sctp_constants.h:433:9`!);
5161 ph->param_lengthcxx . . $ sctp_paramhdr#param_length. = htonscxx . . $ htons(a18c05e4017afb3d).(parameter_len);
5162 chunk_len += parameter_len;
5163 }
5164
5165 /* Add NAT friendly parameter. */
5166 if (SCTP_BASE_SYSCTLcxx . . $ `usrsctplib/netinet/sctp_os_userspace.h:579:9`!(sctp_inits_include_nat_friendly)) {
5167 parameter_len = (uint16_tcxx . . $ uint16_t#)sizeof(struct sctp_paramhdrcxx . . $ sctp_paramhdr#);
5168 ph = (struct sctp_paramhdrcxx . . $ sctp_paramhdr# *)(mtodcxx . . $ `usrsctplib/user_mbuf.h:96:9`!(m, caddr_t) + chunk_len);
5169 ph->param_typecxx . . $ sctp_paramhdr#param_type. = htonscxx . . $ htons(a18c05e4017afb3d).(SCTP_HAS_NAT_SUPPORTcxx . . $ `usrsctplib/netinet/sctp_constants.h:442:9`!);
5170 ph->param_lengthcxx . . $ sctp_paramhdr#param_length. = htonscxx . . $ htons(a18c05e4017afb3d).(parameter_len);
5171 chunk_len += parameter_len;
5172 }
5173
5174 /* And now tell the peer which extensions we support */
5175 num_ext = 0;
5176 pr_supported = (struct sctp_supported_chunk_types_paramcxx . . $ sctp_supported_chunk_types_param# *)(mtodcxx . . $ `usrsctplib/user_mbuf.h:96:9`!(m, caddr_t) + chunk_len);
5177 if (stcb->asoccxx . . $ sctp_tcb#asoc..prsctp_supportedcxx . . $ sctp_association#prsctp_supported. == 1) {
5178 pr_supported->chunk_typescxx . . $ sctp_supported_chunk_types_param#chunk_types.[num_ext++] = SCTP_FORWARD_CUM_TSNcxx . . $ `usrsctplib/netinet/sctp.h:482:9`!;
5179 if (stcb->asoccxx . . $ sctp_tcb#asoc..idata_supportedcxx . . $ sctp_association#idata_supported.) {
5180 pr_supported->chunk_typescxx . . $ sctp_supported_chunk_types_param#chunk_types.[num_ext++] = SCTP_IFORWARD_CUM_TSNcxx . . $ `usrsctplib/netinet/sctp.h:485:9`!;
5181 }
5182 }
5183 if (stcb->asoccxx . . $ sctp_tcb#asoc..auth_supportedcxx . . $ sctp_association#auth_supported. == 1) {
5184 pr_supported->chunk_typescxx . . $ sctp_supported_chunk_types_param#chunk_types.[num_ext++] = SCTP_AUTHENTICATIONcxx . . $ `usrsctplib/netinet/sctp.h:465:9`!;
5185 }
5186 if (stcb->asoccxx . . $ sctp_tcb#asoc..asconf_supportedcxx . . $ sctp_association#asconf_supported. == 1) {
5187 pr_supported->chunk_typescxx . . $ sctp_supported_chunk_types_param#chunk_types.[num_ext++] = SCTP_ASCONFcxx . . $ `usrsctplib/netinet/sctp.h:484:9`!;
5188 pr_supported->chunk_typescxx . . $ sctp_supported_chunk_types_param#chunk_types.[num_ext++] = SCTP_ASCONF_ACKcxx . . $ `usrsctplib/netinet/sctp.h:472:9`!;
5189 }
5190 if (stcb->asoccxx . . $ sctp_tcb#asoc..reconfig_supportedcxx . . $ sctp_association#reconfig_supported. == 1) {
5191 pr_supported->chunk_typescxx . . $ sctp_supported_chunk_types_param#chunk_types.[num_ext++] = SCTP_STREAM_RESETcxx . . $ `usrsctplib/netinet/sctp.h:476:9`!;
5192 }
5193 if (stcb->asoccxx . . $ sctp_tcb#asoc..idata_supportedcxx . . $ sctp_association#idata_supported.) {
5194 pr_supported->chunk_typescxx . . $ sctp_supported_chunk_types_param#chunk_types.[num_ext++] = SCTP_IDATAcxx . . $ `usrsctplib/netinet/sctp.h:469:9`!;
5195 }
5196 if (stcb->asoccxx . . $ sctp_tcb#asoc..nrsack_supportedcxx . . $ sctp_association#nrsack_supported. == 1) {
5197 pr_supported->chunk_typescxx . . $ sctp_supported_chunk_types_param#chunk_types.[num_ext++] = SCTP_NR_SELECTIVE_ACKcxx . . $ `usrsctplib/netinet/sctp.h:467:9`!;
5198 }
5199 if (stcb->asoccxx . . $ sctp_tcb#asoc..pktdrop_supportedcxx . . $ sctp_association#pktdrop_supported. == 1) {
5200 pr_supported->chunk_typescxx . . $ sctp_supported_chunk_types_param#chunk_types.[num_ext++] = SCTP_PACKET_DROPPEDcxx . . $ `usrsctplib/netinet/sctp.h:474:9`!;
5201 }
5202 if (num_ext > 0) {
5203 parameter_len = (uint16_tcxx . . $ uint16_t#)sizeof(struct sctp_supported_chunk_types_paramcxx . . $ sctp_supported_chunk_types_param#) + num_ext;
5204 pr_supported->phcxx . . $ sctp_supported_chunk_types_param#ph..param_typecxx . . $ sctp_paramhdr#param_type. = htonscxx . . $ htons(a18c05e4017afb3d).(SCTP_SUPPORTED_CHUNK_EXTcxx . . $ `usrsctplib/netinet/sctp_constants.h:430:9`!);
5205 pr_supported->phcxx . . $ sctp_supported_chunk_types_param#ph..param_lengthcxx . . $ sctp_paramhdr#param_length. = htonscxx . . $ htons(a18c05e4017afb3d).(parameter_len);
5206 padding_len = SCTP_SIZE32cxx . . $ `usrsctplib/netinet/sctp_constants.h:388:9`!(parameter_len) - parameter_len;
5207 chunk_len += parameter_len;
5208 }
5209 /* add authentication parameters */
5210 if (stcb->asoccxx . . $ sctp_tcb#asoc..auth_supportedcxx . . $ sctp_association#auth_supported.) {
5211 /* attach RANDOM parameter, if available */
5212 if (stcb->asoccxx . . $ sctp_tcb#asoc..authinfocxx . . $ sctp_association#authinfo..randomcxx . . $ sctp_authinformation#random. != NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!) {
5213 struct sctp_auth_randomcxx . . $ sctp_auth_random# *randp;
5214
5215 if (padding_len > 0) {
5216 memsetcxx . . $ memset(d1de1e4fb215f1c6).(mtodcxx . . $ `usrsctplib/user_mbuf.h:96:9`!(m, caddr_t) + chunk_len, 0, padding_len);
5217 chunk_len += padding_len;
5218 padding_len = 0;
5219 }
5220 randp = (struct sctp_auth_randomcxx . . $ sctp_auth_random# *)(mtodcxx . . $ `usrsctplib/user_mbuf.h:96:9`!(m, caddr_t) + chunk_len);
5221 parameter_len = (uint16_tcxx . . $ uint16_t#)sizeof(struct sctp_auth_randomcxx . . $ sctp_auth_random#) + stcb->asoccxx . . $ sctp_tcb#asoc..authinfocxx . . $ sctp_association#authinfo..random_lencxx . . $ sctp_authinformation#random_len.;
5222 /* random key already contains the header */
5223 memcpycxx . . $ memcpy(cc817cb175f282d).(randp, stcb->asoccxx . . $ sctp_tcb#asoc..authinfocxx . . $ sctp_association#authinfo..randomcxx . . $ sctp_authinformation#random.->keycxx . . $ sctp_key#key., parameter_len);
5224 padding_len = SCTP_SIZE32cxx . . $ `usrsctplib/netinet/sctp_constants.h:388:9`!(parameter_len) - parameter_len;
5225 chunk_len += parameter_len;
5226 }
5227 /* add HMAC_ALGO parameter */
5228 if (stcb->asoccxx . . $ sctp_tcb#asoc..local_hmacscxx . . $ sctp_association#local_hmacs. != NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!) {
5229 struct sctp_auth_hmac_algocxx . . $ sctp_auth_hmac_algo# *hmacs;
5230
5231 if (padding_len > 0) {
5232 memsetcxx . . $ memset(d1de1e4fb215f1c6).(mtodcxx . . $ `usrsctplib/user_mbuf.h:96:9`!(m, caddr_t) + chunk_len, 0, padding_len);
5233 chunk_len += padding_len;
5234 padding_len = 0;
5235 }
5236 hmacs = (struct sctp_auth_hmac_algocxx . . $ sctp_auth_hmac_algo# *)(mtodcxx . . $ `usrsctplib/user_mbuf.h:96:9`!(m, caddr_t) + chunk_len);
5237 parameter_len = (uint16_tcxx . . $ uint16_t#)(sizeof(struct sctp_auth_hmac_algocxx . . $ sctp_auth_hmac_algo#) +
5238 stcb->asoccxx . . $ sctp_tcb#asoc..local_hmacscxx . . $ sctp_association#local_hmacs.->num_algocxx . . $ sctp_hmaclist#num_algo. * sizeof(uint16_tcxx . . $ uint16_t#));
5239 hmacs->phcxx . . $ sctp_auth_hmac_algo#ph..param_typecxx . . $ sctp_paramhdr#param_type. = htonscxx . . $ htons(a18c05e4017afb3d).(SCTP_HMAC_LISTcxx . . $ `usrsctplib/netinet/sctp_constants.h:426:9`!);
5240 hmacs->phcxx . . $ sctp_auth_hmac_algo#ph..param_lengthcxx . . $ sctp_paramhdr#param_length. = htonscxx . . $ htons(a18c05e4017afb3d).(parameter_len);
5241 sctp_serialize_hmaclistcxx . . $ sctp_serialize_hmaclist(efcf6ebc6065f5a8).(stcb->asoccxx . . $ sctp_tcb#asoc..local_hmacscxx . . $ sctp_association#local_hmacs., (uint8_tcxx . . $ uint8_t# *)hmacs->hmac_idscxx . . $ sctp_auth_hmac_algo#hmac_ids.);
5242 padding_len = SCTP_SIZE32cxx . . $ `usrsctplib/netinet/sctp_constants.h:388:9`!(parameter_len) - parameter_len;
5243 chunk_len += parameter_len;
5244 }
5245 /* add CHUNKS parameter */
5246 if (stcb->asoccxx . . $ sctp_tcb#asoc..local_auth_chunkscxx . . $ sctp_association#local_auth_chunks. != NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!) {
5247 struct sctp_auth_chunk_listcxx . . $ sctp_auth_chunk_list# *chunks;
5248
5249 if (padding_len > 0) {
5250 memsetcxx . . $ memset(d1de1e4fb215f1c6).(mtodcxx . . $ `usrsctplib/user_mbuf.h:96:9`!(m, caddr_t) + chunk_len, 0, padding_len);
5251 chunk_len += padding_len;
5252 padding_len = 0;
5253 }
5254 chunks = (struct sctp_auth_chunk_listcxx . . $ sctp_auth_chunk_list# *)(mtodcxx . . $ `usrsctplib/user_mbuf.h:96:9`!(m, caddr_t) + chunk_len);
5255 parameter_len = (uint16_tcxx . . $ uint16_t#)(sizeof(struct sctp_auth_chunk_listcxx . . $ sctp_auth_chunk_list#) +
5256 sctp_auth_get_chklist_sizecxx . . $ sctp_auth_get_chklist_size(f8ed72e0197ad1e2).(stcb->asoccxx . . $ sctp_tcb#asoc..local_auth_chunkscxx . . $ sctp_association#local_auth_chunks.));
5257 chunks->phcxx . . $ sctp_auth_chunk_list#ph..param_typecxx . . $ sctp_paramhdr#param_type. = htonscxx . . $ htons(a18c05e4017afb3d).(SCTP_CHUNK_LISTcxx . . $ `usrsctplib/netinet/sctp_constants.h:425:9`!);
5258 chunks->phcxx . . $ sctp_auth_chunk_list#ph..param_lengthcxx . . $ sctp_paramhdr#param_length. = htonscxx . . $ htons(a18c05e4017afb3d).(parameter_len);
5259 sctp_serialize_auth_chunkscxx . . $ sctp_serialize_auth_chunks(589238950b692487).(stcb->asoccxx . . $ sctp_tcb#asoc..local_auth_chunkscxx . . $ sctp_association#local_auth_chunks., chunks->chunk_typescxx . . $ sctp_auth_chunk_list#chunk_types.);
5260 padding_len = SCTP_SIZE32cxx . . $ `usrsctplib/netinet/sctp_constants.h:388:9`!(parameter_len) - parameter_len;
5261 chunk_len += parameter_len;
5262 }
5263 }
5264
5265 /* now any cookie time extensions */
5266 if (stcb->asoccxx . . $ sctp_tcb#asoc..cookie_preserve_reqcxx . . $ sctp_association#cookie_preserve_req. > 0) {
5267 struct sctp_cookie_perserve_paramcxx . . $ sctp_cookie_perserve_param# *cookie_preserve;
5268
5269 if (padding_len > 0) {
5270 memsetcxx . . $ memset(d1de1e4fb215f1c6).(mtodcxx . . $ `usrsctplib/user_mbuf.h:96:9`!(m, caddr_t) + chunk_len, 0, padding_len);
5271 chunk_len += padding_len;
5272 padding_len = 0;
5273 }
5274 parameter_len = (uint16_tcxx . . $ uint16_t#)sizeof(struct sctp_cookie_perserve_paramcxx . . $ sctp_cookie_perserve_param#);
5275 cookie_preserve = (struct sctp_cookie_perserve_paramcxx . . $ sctp_cookie_perserve_param# *)(mtodcxx . . $ `usrsctplib/user_mbuf.h:96:9`!(m, caddr_t) + chunk_len);
5276 cookie_preserve->phcxx . . $ sctp_cookie_perserve_param#ph..param_typecxx . . $ sctp_paramhdr#param_type. = htonscxx . . $ htons(a18c05e4017afb3d).(SCTP_COOKIE_PRESERVEcxx . . $ `usrsctplib/netinet/sctp_constants.h:403:9`!);
5277 cookie_preserve->phcxx . . $ sctp_cookie_perserve_param#ph..param_lengthcxx . . $ sctp_paramhdr#param_length. = htonscxx . . $ htons(a18c05e4017afb3d).(parameter_len);
5278 cookie_preserve->timecxx . . $ sctp_cookie_perserve_param#time. = htonlcxx . . $ htonl(2141b656ce2cc063).(stcb->asoccxx . . $ sctp_tcb#asoc..cookie_preserve_reqcxx . . $ sctp_association#cookie_preserve_req.);
5279 stcb->asoccxx . . $ sctp_tcb#asoc..cookie_preserve_reqcxx . . $ sctp_association#cookie_preserve_req. = 0;
5280 chunk_len += parameter_len;
5281 }
5282
5283 if (stcb->asoccxx . . $ sctp_tcb#asoc..scopecxx . . $ sctp_association#scope..ipv4_addr_legalcxx . . $ sctp_scoping#ipv4_addr_legal. || stcb->asoccxx . . $ sctp_tcb#asoc..scopecxx . . $ sctp_association#scope..ipv6_addr_legalcxx . . $ sctp_scoping#ipv6_addr_legal.) {
5284 uint8_tcxx . . $ uint8_t# i;
5285
5286 if (padding_len > 0) {
5287 memsetcxx . . $ memset(d1de1e4fb215f1c6).(mtodcxx . . $ `usrsctplib/user_mbuf.h:96:9`!(m, caddr_t) + chunk_len, 0, padding_len);
5288 chunk_len += padding_len;
5289 padding_len = 0;
5290 }
5291 parameter_len = (uint16_tcxx . . $ uint16_t#)sizeof(struct sctp_paramhdrcxx . . $ sctp_paramhdr#);
5292 if (stcb->asoccxx . . $ sctp_tcb#asoc..scopecxx . . $ sctp_association#scope..ipv4_addr_legalcxx . . $ sctp_scoping#ipv4_addr_legal.) {
5293 parameter_len += (uint16_tcxx . . $ uint16_t#)sizeof(uint16_tcxx . . $ uint16_t#);
5294 }
5295 if (stcb->asoccxx . . $ sctp_tcb#asoc..scopecxx . . $ sctp_association#scope..ipv6_addr_legalcxx . . $ sctp_scoping#ipv6_addr_legal.) {
5296 parameter_len += (uint16_tcxx . . $ uint16_t#)sizeof(uint16_tcxx . . $ uint16_t#);
5297 }
5298 sup_addr = (struct sctp_supported_addr_paramcxx . . $ sctp_supported_addr_param# *)(mtodcxx . . $ `usrsctplib/user_mbuf.h:96:9`!(m, caddr_t) + chunk_len);
5299 sup_addr->phcxx . . $ sctp_supported_addr_param#ph..param_typecxx . . $ sctp_paramhdr#param_type. = htonscxx . . $ htons(a18c05e4017afb3d).(SCTP_SUPPORTED_ADDRTYPEcxx . . $ `usrsctplib/netinet/sctp_constants.h:405:9`!);
5300 sup_addr->phcxx . . $ sctp_supported_addr_param#ph..param_lengthcxx . . $ sctp_paramhdr#param_length. = htonscxx . . $ htons(a18c05e4017afb3d).(parameter_len);
5301 i = 0;
5302 if (stcb->asoccxx . . $ sctp_tcb#asoc..scopecxx . . $ sctp_association#scope..ipv4_addr_legalcxx . . $ sctp_scoping#ipv4_addr_legal.) {
5303 sup_addr->addr_typecxx . . $ sctp_supported_addr_param#addr_type.[i++] = htonscxx . . $ htons(a18c05e4017afb3d).(SCTP_IPV4_ADDRESScxx . . $ `usrsctplib/netinet/sctp_constants.h:399:9`!);
5304 }
5305 if (stcb->asoccxx . . $ sctp_tcb#asoc..scopecxx . . $ sctp_association#scope..ipv6_addr_legalcxx . . $ sctp_scoping#ipv6_addr_legal.) {
5306 sup_addr->addr_typecxx . . $ sctp_supported_addr_param#addr_type.[i++] = htonscxx . . $ htons(a18c05e4017afb3d).(SCTP_IPV6_ADDRESScxx . . $ `usrsctplib/netinet/sctp_constants.h:400:9`!);
5307 }
5308 padding_len = 4 - 2 * i;
5309 chunk_len += parameter_len;
5310 }
5311
5312 SCTP_BUF_LENcxx . . $ `usrsctplib/netinet/sctp_os_userspace.h:790:9`!(m) = chunk_len;
5313 /* now the addresses */
5314 /* To optimize this we could put the scoping stuff
5315 * into a structure and remove the individual uint8's from
5316 * the assoc structure. Then we could just sifa in the
5317 * address within the stcb. But for now this is a quick
5318 * hack to get the address stuff teased apart.
5319 */
5320 m_last = sctp_add_addresses_to_i_iacxx . . $ sctp_add_addresses_to_i_ia(9e6c56b7dd223edd).(inp, stcb, &stcb->asoccxx . . $ sctp_tcb#asoc..scopecxx . . $ sctp_association#scope.,
5321 m, cnt_inits_to,
5322 &padding_len, &chunk_len);
5323
5324 init->chcxx . . $ sctp_init_chunk#ch..chunk_lengthcxx . . $ sctp_chunkhdr#chunk_length. = htonscxx . . $ htons(a18c05e4017afb3d).(chunk_len);
5325 if (padding_len > 0) {
5326 if (sctp_add_pad_tombufcxx . . $ sctp_add_pad_tombuf(78d6dcf03d579fb3).(m_last, padding_len) == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!) {
5327 sctp_m_freemcxx . . $ `usrsctplib/netinet/sctputil.h:57:9`!(m);
5328 return;
5329 }
5330 }
5331 SCTPDBGcxx . . $ `usrsctplib/netinet/sctp_os_userspace.h:591:9`!(SCTP_DEBUG_OUTPUT4cxx . . $ `usrsctplib/netinet/sctp_constants.h:646:9`!, "Sending INIT - calls lowlevel_output\n");
5332 if ((error = sctp_lowlevel_chunk_outputcxx . . $ sctp_lowlevel_chunk_output(4859f95fdecd7401).(inp, stcb, net,
5333 (struct sockaddrcxx . . $ sockaddr# *)&net->rocxx . . $ sctp_nets#ro.._l_addrcxx . . $ sctp_net_route#_l_addr.,
5334 m, 0, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!, 0, 0, 0, 0,
5335 inp->sctp_lportcxx . . $ `usrsctplib/netinet/sctp_pcb.h:430:9`!, stcb->rportcxx . . $ sctp_tcb#rport., htonlcxx . . $ htonl(2141b656ce2cc063).(0),
5336 net->portcxx . . $ sctp_nets#port., NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!,
5337 #if defined(__FreeBSD__) && !defined(__Userspace__cxx . . $ `<built-in>:442:9`!)
5338 0, 0,
5339 #endif
5340 so_locked))) {
5341 SCTPDBGcxx . . $ `usrsctplib/netinet/sctp_os_userspace.h:591:9`!(SCTP_DEBUG_OUTPUT4cxx . . $ `usrsctplib/netinet/sctp_constants.h:646:9`!, "Gak send error %d\n", error);
5342 if (error == ENOBUFScxx . . $ `<external>/17922322188510340118/errno.h:89:9`!) {
5343 stcb->asoccxx . . $ sctp_tcb#asoc..ifp_had_enobufcxx . . $ sctp_association#ifp_had_enobuf. = 1;
5344 SCTP_STAT_INCRcxx . . $ `./netinet/sctp_uio.h:1111:9`!(sctps_lowlevelerr);
5345 }
5346 } else {
5347 stcb->asoccxx . . $ sctp_tcb#asoc..ifp_had_enobufcxx . . $ sctp_association#ifp_had_enobuf. = 0;
5348 }
5349 SCTP_STAT_INCR_COUNTER64cxx . . $ `./netinet/sctp_uio.h:1127:9`!(sctps_outcontrolchunks);
5350 (void)SCTP_GETTIME_TIMEVALcxx . . $ `usrsctplib/netinet/sctp_constants.h:995:9`!(&net->last_sent_time);
5351 }
5352
5353 struct mbufcxx . . $ mbuf# *
5354 sctp_arethere_unrecognized_parameterscxx . . $ sctp_arethere_unrecognized_parameters(769374a5071e409f).(struct mbufcxx . . $ mbuf# *in_initpkt,
5355 int param_offset, int *abort_processing,
5356 struct sctp_chunkhdrcxx . . $ sctp_chunkhdr# *cp,
5357 int *nat_friendly,
5358 int *cookie_found)
5359 {
5360 /*
5361 * Given a mbuf containing an INIT or INIT-ACK with the param_offset
5362 * being equal to the beginning of the params i.e. (iphlen +
5363 * sizeof(struct sctp_init_msg) parse through the parameters to the
5364 * end of the mbuf verifying that all parameters are known.
5365 *
5366 * For unknown parameters build and return a mbuf with
5367 * UNRECOGNIZED_PARAMETER errors. If the flags indicate to stop
5368 * processing this chunk stop, and set *abort_processing to 1.
5369 *
5370 * By having param_offset be pre-set to where parameters begin it is
5371 * hoped that this routine may be reused in the future by new
5372 * features.
5373 */
5374 struct sctp_paramhdrcxx . . $ sctp_paramhdr# *phdr, params;
5375
5376 struct mbufcxx . . $ mbuf# *mat, *m_tmp, *op_err, *op_err_last;
5377 int at, limit, pad_needed;
5378 uint16_tcxx . . $ uint16_t# ptype, plen, padded_size;
5379
5380 *abort_processing = 0;
5381 if (cookie_found != NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!) {
5382 *cookie_found = 0;
5383 }
5384 mat = in_initpkt;
5385 limit = ntohscxx . . $ ntohs(a18c05e4017afb3d).(cp->chunk_lengthcxx . . $ sctp_chunkhdr#chunk_length.) - sizeof(struct sctp_init_chunkcxx . . $ sctp_init_chunk#);
5386 at = param_offset;
5387 op_err = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!;
5388 op_err_last = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!;
5389 pad_needed = 0;
5390 SCTPDBGcxx . . $ `usrsctplib/netinet/sctp_os_userspace.h:591:9`!(SCTP_DEBUG_OUTPUT1cxx . . $ `usrsctplib/netinet/sctp_constants.h:643:9`!, "Check for unrecognized param's\n");
5391 phdr = sctp_get_next_paramcxx . . $ sctp_get_next_param(db742a953aea46f4).(mat, at, &params, sizeof(params));
5392 while ((phdr != NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!) && ((size_t)limit >= sizeof(struct sctp_paramhdrcxx . . $ sctp_paramhdr#))) {
5393 ptype = ntohscxx . . $ ntohs(a18c05e4017afb3d).(phdr->param_typecxx . . $ sctp_paramhdr#param_type.);
5394 plen = ntohscxx . . $ ntohs(a18c05e4017afb3d).(phdr->param_lengthcxx . . $ sctp_paramhdr#param_length.);
5395 if ((plen > limit) || (plen < sizeof(struct sctp_paramhdrcxx . . $ sctp_paramhdr#))) {
5396 /* wacked parameter */
5397 SCTPDBGcxx . . $ `usrsctplib/netinet/sctp_os_userspace.h:591:9`!(SCTP_DEBUG_OUTPUT1cxx . . $ `usrsctplib/netinet/sctp_constants.h:643:9`!, "Invalid size - error %d\n", plen);
5398 goto invalid_size;
5399 }
5400 limit -= SCTP_SIZE32cxx . . $ `usrsctplib/netinet/sctp_constants.h:388:9`!(plen);
5401 /*-
5402 * All parameters for all chunks that we know/understand are
5403 * listed here. We process them other places and make
5404 * appropriate stop actions per the upper bits. However this
5405 * is the generic routine processor's can call to get back
5406 * an operr.. to either incorporate (init-ack) or send.
5407 */
5408 padded_size = SCTP_SIZE32cxx . . $ `usrsctplib/netinet/sctp_constants.h:388:9`!(plen);
5409 switch (ptype) {
5410 /* Param's with variable size */
5411 case SCTP_HEARTBEAT_INFOcxx . . $ `usrsctplib/netinet/sctp_constants.h:395:9`!:
5412 case SCTP_UNRECOG_PARAMcxx . . $ `usrsctplib/netinet/sctp_constants.h:402:9`!:
5413 case SCTP_ERROR_CAUSE_INDcxx . . $ `usrsctplib/netinet/sctp_constants.h:437:9`!:
5414 /* ok skip fwd */
5415 at += padded_size;
5416 break;
5417 case SCTP_STATE_COOKIEcxx . . $ `usrsctplib/netinet/sctp_constants.h:401:9`!:
5418 if (cookie_found != NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!) {
5419 *cookie_found = 1;
5420 }
5421 at += padded_size;
5422 break;
5423 /* Param's with variable size within a range */
5424 case SCTP_CHUNK_LISTcxx . . $ `usrsctplib/netinet/sctp_constants.h:425:9`!:
5425 case SCTP_SUPPORTED_CHUNK_EXTcxx . . $ `usrsctplib/netinet/sctp_constants.h:430:9`!:
5426 if (padded_size > (sizeof(struct sctp_supported_chunk_types_paramcxx . . $ sctp_supported_chunk_types_param#) + (sizeof(uint8_tcxx . . $ uint8_t#) * SCTP_MAX_SUPPORTED_EXTcxx . . $ `usrsctplib/netinet/sctp_header.h:140:9`!))) {
5427 SCTPDBGcxx . . $ `usrsctplib/netinet/sctp_os_userspace.h:591:9`!(SCTP_DEBUG_OUTPUT1cxx . . $ `usrsctplib/netinet/sctp_constants.h:643:9`!, "Invalid size - error chklist %d\n", plen);
5428 goto invalid_size;
5429 }
5430 at += padded_size;
5431 break;
5432 case SCTP_SUPPORTED_ADDRTYPEcxx . . $ `usrsctplib/netinet/sctp_constants.h:405:9`!:
5433 if (padded_size > SCTP_MAX_ADDR_PARAMS_SIZEcxx . . $ `usrsctplib/netinet/sctp_header.h:91:9`!) {
5434 SCTPDBGcxx . . $ `usrsctplib/netinet/sctp_os_userspace.h:591:9`!(SCTP_DEBUG_OUTPUT1cxx . . $ `usrsctplib/netinet/sctp_constants.h:643:9`!, "Invalid size - error supaddrtype %d\n", plen);
5435 goto invalid_size;
5436 }
5437 at += padded_size;
5438 break;
5439 case SCTP_RANDOMcxx . . $ `usrsctplib/netinet/sctp_constants.h:424:9`!:
5440 if (padded_size > (sizeof(struct sctp_auth_randomcxx . . $ sctp_auth_random#) + SCTP_RANDOM_MAX_SIZEcxx . . $ `usrsctplib/netinet/sctp_header.h:518:9`!)) {
5441 SCTPDBGcxx . . $ `usrsctplib/netinet/sctp_os_userspace.h:591:9`!(SCTP_DEBUG_OUTPUT1cxx . . $ `usrsctplib/netinet/sctp_constants.h:643:9`!, "Invalid size - error random %d\n", plen);
5442 goto invalid_size;
5443 }
5444 at += padded_size;
5445 break;
5446 case SCTP_SET_PRIM_ADDRcxx . . $ `usrsctplib/netinet/sctp_constants.h:438:9`!:
5447 case SCTP_DEL_IP_ADDRESScxx . . $ `usrsctplib/netinet/sctp_constants.h:436:9`!:
5448 case SCTP_ADD_IP_ADDRESScxx . . $ `usrsctplib/netinet/sctp_constants.h:435:9`!:
5449 if ((padded_size != sizeof(struct sctp_asconf_addrv4_paramcxx . . $ sctp_asconf_addrv4_param#)) &&
5450 (padded_size != sizeof(struct sctp_asconf_addr_paramcxx . . $ sctp_asconf_addr_param#))) {
5451 SCTPDBGcxx . . $ `usrsctplib/netinet/sctp_os_userspace.h:591:9`!(SCTP_DEBUG_OUTPUT1cxx . . $ `usrsctplib/netinet/sctp_constants.h:643:9`!, "Invalid size - error setprim %d\n", plen);
5452 goto invalid_size;
5453 }
5454 at += padded_size;
5455 break;
5456 /* Param's with a fixed size */
5457 case SCTP_IPV4_ADDRESScxx . . $ `usrsctplib/netinet/sctp_constants.h:399:9`!:
5458 if (padded_size != sizeof(struct sctp_ipv4addr_paramcxx . . $ sctp_ipv4addr_param#)) {
5459 SCTPDBGcxx . . $ `usrsctplib/netinet/sctp_os_userspace.h:591:9`!(SCTP_DEBUG_OUTPUT1cxx . . $ `usrsctplib/netinet/sctp_constants.h:643:9`!, "Invalid size - error ipv4 addr %d\n", plen);
5460 goto invalid_size;
5461 }
5462 at += padded_size;
5463 break;
5464 case SCTP_IPV6_ADDRESScxx . . $ `usrsctplib/netinet/sctp_constants.h:400:9`!:
5465 if (padded_size != sizeof(struct sctp_ipv6addr_paramcxx . . $ sctp_ipv6addr_param#)) {
5466 SCTPDBGcxx . . $ `usrsctplib/netinet/sctp_os_userspace.h:591:9`!(SCTP_DEBUG_OUTPUT1cxx . . $ `usrsctplib/netinet/sctp_constants.h:643:9`!, "Invalid size - error ipv6 addr %d\n", plen);
5467 goto invalid_size;
5468 }
5469 at += padded_size;
5470 break;
5471 case SCTP_COOKIE_PRESERVEcxx . . $ `usrsctplib/netinet/sctp_constants.h:403:9`!:
5472 if (padded_size != sizeof(struct sctp_cookie_perserve_paramcxx . . $ sctp_cookie_perserve_param#)) {
5473 SCTPDBGcxx . . $ `usrsctplib/netinet/sctp_os_userspace.h:591:9`!(SCTP_DEBUG_OUTPUT1cxx . . $ `usrsctplib/netinet/sctp_constants.h:643:9`!, "Invalid size - error cookie-preserve %d\n", plen);
5474 goto invalid_size;
5475 }
5476 at += padded_size;
5477 break;
5478 case SCTP_HAS_NAT_SUPPORTcxx . . $ `usrsctplib/netinet/sctp_constants.h:442:9`!:
5479 *nat_friendly = 1;
5480 /* fall through */
5481 case SCTP_PRSCTP_SUPPORTEDcxx . . $ `usrsctplib/netinet/sctp_constants.h:433:9`!:
5482 if (padded_size != sizeof(struct sctp_paramhdrcxx . . $ sctp_paramhdr#)) {
5483 SCTPDBGcxx . . $ `usrsctplib/netinet/sctp_os_userspace.h:591:9`!(SCTP_DEBUG_OUTPUT1cxx . . $ `usrsctplib/netinet/sctp_constants.h:643:9`!, "Invalid size - error prsctp/nat support %d\n", plen);
5484 goto invalid_size;
5485 }
5486 at += padded_size;
5487 break;
5488 case SCTP_ECN_CAPABLEcxx . . $ `usrsctplib/netinet/sctp_constants.h:421:9`!:
5489 if (padded_size != sizeof(struct sctp_paramhdrcxx . . $ sctp_paramhdr#)) {
5490 SCTPDBGcxx . . $ `usrsctplib/netinet/sctp_os_userspace.h:591:9`!(SCTP_DEBUG_OUTPUT1cxx . . $ `usrsctplib/netinet/sctp_constants.h:643:9`!, "Invalid size - error ecn %d\n", plen);
5491 goto invalid_size;
5492 }
5493 at += padded_size;
5494 break;
5495 case SCTP_ULP_ADAPTATIONcxx . . $ `usrsctplib/netinet/sctp_constants.h:440:9`!:
5496 if (padded_size != sizeof(struct sctp_adaptation_layer_indicationcxx . . $ sctp_adaptation_layer_indication#)) {
5497 SCTPDBGcxx . . $ `usrsctplib/netinet/sctp_os_userspace.h:591:9`!(SCTP_DEBUG_OUTPUT1cxx . . $ `usrsctplib/netinet/sctp_constants.h:643:9`!, "Invalid size - error adapatation %d\n", plen);
5498 goto invalid_size;
5499 }
5500 at += padded_size;
5501 break;
5502 case SCTP_SUCCESS_REPORTcxx . . $ `usrsctplib/netinet/sctp_constants.h:439:9`!:
5503 if (padded_size != sizeof(struct sctp_asconf_paramhdrcxx . . $ sctp_asconf_paramhdr#)) {
5504 SCTPDBGcxx . . $ `usrsctplib/netinet/sctp_os_userspace.h:591:9`!(SCTP_DEBUG_OUTPUT1cxx . . $ `usrsctplib/netinet/sctp_constants.h:643:9`!, "Invalid size - error success %d\n", plen);
5505 goto invalid_size;
5506 }
5507 at += padded_size;
5508 break;
5509 case SCTP_HOSTNAME_ADDRESScxx . . $ `usrsctplib/netinet/sctp_constants.h:404:9`!:
5510 {
5511 /* Hostname parameters are deprecated. */
5512 struct sctp_gen_error_causecxx . . $ sctp_gen_error_cause# *cause;
5513 int l_len;
5514
5515 SCTPDBGcxx . . $ `usrsctplib/netinet/sctp_os_userspace.h:591:9`!(SCTP_DEBUG_OUTPUT1cxx . . $ `usrsctplib/netinet/sctp_constants.h:643:9`!, "Can't handle hostname addresses.. abort processing\n");
5516 *abort_processing = 1;
5517 sctp_m_freemcxx . . $ `usrsctplib/netinet/sctputil.h:57:9`!(op_err);
5518 op_err = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!;
5519 op_err_last = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!;
5520 #ifdef INET6cxx . . $ `<built-in>:432:9`!
5521 l_len = SCTP_MIN_OVERHEADcxx . . $ `usrsctplib/netinet/sctp_header.h:561:9`!;
5522 #else
5523 l_len = SCTP_MIN_V4_OVERHEAD;
5524 #endif
5525 l_len += sizeof(struct sctp_chunkhdrcxx . . $ sctp_chunkhdr#);
5526 l_len += sizeof(struct sctp_gen_error_causecxx . . $ sctp_gen_error_cause#);
5527 op_err = sctp_get_mbuf_for_msgcxx . . $ sctp_get_mbuf_for_msg(c7c30fc329598377).(l_len, 0, M_NOWAITcxx . . $ `usrsctplib/user_malloc.h:60:9`!, 1, MT_DATAcxx . . $ `usrsctplib/user_mbuf.h:289:9`!);
5528 if (op_err != NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!) {
5529 /*
5530 * Pre-reserve space for IP, SCTP, and
5531 * chunk header.
5532 */
5533 #ifdef INET6cxx . . $ `<built-in>:432:9`!
5534 SCTP_BUF_RESV_UFcxx . . $ `usrsctplib/netinet/sctp_os_userspace.h:793:9`!(op_err, sizeof(struct ip6_hdr));
5535 #else
5536 SCTP_BUF_RESV_UF(op_err, sizeof(struct ip));
5537 #endif
5538 SCTP_BUF_RESV_UFcxx . . $ `usrsctplib/netinet/sctp_os_userspace.h:793:9`!(op_err, sizeof(struct sctphdr));
5539 SCTP_BUF_RESV_UFcxx . . $ `usrsctplib/netinet/sctp_os_userspace.h:793:9`!(op_err, sizeof(struct sctp_chunkhdr));
5540 SCTP_BUF_LENcxx . . $ `usrsctplib/netinet/sctp_os_userspace.h:790:9`!(op_err) = sizeof(struct sctp_gen_error_causecxx . . $ sctp_gen_error_cause#);
5541 cause = mtodcxx . . $ `usrsctplib/user_mbuf.h:96:9`!(op_err, struct sctp_gen_error_cause *);
5542 cause->codecxx . . $ sctp_gen_error_cause#code. = htonscxx . . $ htons(a18c05e4017afb3d).(SCTP_CAUSE_UNRESOLVABLE_ADDRcxx . . $ `usrsctplib/netinet/sctp.h:365:9`!);
5543 cause->lengthcxx . . $ sctp_gen_error_cause#length. = htonscxx . . $ htons(a18c05e4017afb3d).((uint16_tcxx . . $ uint16_t#)(sizeof(struct sctp_gen_error_causecxx . . $ sctp_gen_error_cause#) + plen));
5544 SCTP_BUF_NEXTcxx . . $ `usrsctplib/netinet/sctp_os_userspace.h:791:9`!(op_err) = SCTP_M_COPYMcxx . . $ `usrsctplib/netinet/sctp_os_userspace.h:759:9`!(mat, at, plen, M_NOWAITcxx . . $ `usrsctplib/user_malloc.h:60:9`!);
5545 if (SCTP_BUF_NEXTcxx . . $ `usrsctplib/netinet/sctp_os_userspace.h:791:9`!(op_err) == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!) {
5546 sctp_m_freemcxx . . $ `usrsctplib/netinet/sctputil.h:57:9`!(op_err);
5547 op_err = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!;
5548 op_err_last = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!;
5549 }
5550 }
5551 return (op_err);
5552 }
5553 default:
5554 /*
5555 * we do not recognize the parameter figure out what
5556 * we do.
5557 */
5558 SCTPDBGcxx . . $ `usrsctplib/netinet/sctp_os_userspace.h:591:9`!(SCTP_DEBUG_OUTPUT1cxx . . $ `usrsctplib/netinet/sctp_constants.h:643:9`!, "Hit default param %x\n", ptype);
5559 if ((ptype & 0x4000) == 0x4000) {
5560 /* Report bit is set?? */
5561 SCTPDBGcxx . . $ `usrsctplib/netinet/sctp_os_userspace.h:591:9`!(SCTP_DEBUG_OUTPUT1cxx . . $ `usrsctplib/netinet/sctp_constants.h:643:9`!, "report op err\n");
5562 if (op_err == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!) {
5563 int l_len;
5564 /* Ok need to try to get an mbuf */
5565 #ifdef INET6cxx . . $ `<built-in>:432:9`!
5566 l_len = SCTP_MIN_OVERHEADcxx . . $ `usrsctplib/netinet/sctp_header.h:561:9`!;
5567 #else
5568 l_len = SCTP_MIN_V4_OVERHEAD;
5569 #endif
5570 l_len += sizeof(struct sctp_chunkhdrcxx . . $ sctp_chunkhdr#);
5571 l_len += sizeof(struct sctp_paramhdrcxx . . $ sctp_paramhdr#);
5572 op_err = sctp_get_mbuf_for_msgcxx . . $ sctp_get_mbuf_for_msg(c7c30fc329598377).(l_len, 0, M_NOWAITcxx . . $ `usrsctplib/user_malloc.h:60:9`!, 1, MT_DATAcxx . . $ `usrsctplib/user_mbuf.h:289:9`!);
5573 if (op_err) {
5574 SCTP_BUF_LENcxx . . $ `usrsctplib/netinet/sctp_os_userspace.h:790:9`!(op_err) = 0;
5575 #ifdef INET6cxx . . $ `<built-in>:432:9`!
5576 SCTP_BUF_RESV_UFcxx . . $ `usrsctplib/netinet/sctp_os_userspace.h:793:9`!(op_err, sizeof(struct ip6_hdr));
5577 #else
5578 SCTP_BUF_RESV_UF(op_err, sizeof(struct ip));
5579 #endif
5580 SCTP_BUF_RESV_UFcxx . . $ `usrsctplib/netinet/sctp_os_userspace.h:793:9`!(op_err, sizeof(struct sctphdr));
5581 SCTP_BUF_RESV_UFcxx . . $ `usrsctplib/netinet/sctp_os_userspace.h:793:9`!(op_err, sizeof(struct sctp_chunkhdr));
5582 op_err_last = op_err;
5583 }
5584 }
5585 if (op_err != NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!) {
5586 /* If we have space */
5587 struct sctp_paramhdrcxx . . $ sctp_paramhdr# *param;
5588
5589 if (pad_needed > 0) {
5590 op_err_last = sctp_add_pad_tombufcxx . . $ sctp_add_pad_tombuf(78d6dcf03d579fb3).(op_err_last, pad_needed);
5591 }
5592 if (op_err_last == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!) {
5593 sctp_m_freemcxx . . $ `usrsctplib/netinet/sctputil.h:57:9`!(op_err);
5594 op_err = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!;
5595 op_err_last = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!;
5596 goto more_processing;
5597 }
5598 if (M_TRAILINGSPACEcxx . . $ `usrsctplib/user_mbuf.h:355:9`!(op_err_last) < (int)sizeof(struct sctp_paramhdrcxx . . $ sctp_paramhdr#)) {
5599 m_tmp = sctp_get_mbuf_for_msgcxx . . $ sctp_get_mbuf_for_msg(c7c30fc329598377).(sizeof(struct sctp_paramhdrcxx . . $ sctp_paramhdr#), 0, M_NOWAITcxx . . $ `usrsctplib/user_malloc.h:60:9`!, 1, MT_DATAcxx . . $ `usrsctplib/user_mbuf.h:289:9`!);
5600 if (m_tmp == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!) {
5601 sctp_m_freemcxx . . $ `usrsctplib/netinet/sctputil.h:57:9`!(op_err);
5602 op_err = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!;
5603 op_err_last = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!;
5604 goto more_processing;
5605 }
5606 SCTP_BUF_LENcxx . . $ `usrsctplib/netinet/sctp_os_userspace.h:790:9`!(m_tmp) = 0;
5607 SCTP_BUF_NEXTcxx . . $ `usrsctplib/netinet/sctp_os_userspace.h:791:9`!(m_tmp) = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!;
5608 SCTP_BUF_NEXTcxx . . $ `usrsctplib/netinet/sctp_os_userspace.h:791:9`!(op_err_last) = m_tmp;
5609 op_err_last = m_tmp;
5610 }
5611 param = (struct sctp_paramhdrcxx . . $ sctp_paramhdr# *)(mtodcxx . . $ `usrsctplib/user_mbuf.h:96:9`!(op_err_last, caddr_t) + SCTP_BUF_LENcxx . . $ `usrsctplib/netinet/sctp_os_userspace.h:790:9`!(op_err_last));
5612 param->param_typecxx . . $ sctp_paramhdr#param_type. = htonscxx . . $ htons(a18c05e4017afb3d).(SCTP_UNRECOG_PARAMcxx . . $ `usrsctplib/netinet/sctp_constants.h:402:9`!);
5613 param->param_lengthcxx . . $ sctp_paramhdr#param_length. = htonscxx . . $ htons(a18c05e4017afb3d).((uint16_tcxx . . $ uint16_t#)sizeof(struct sctp_paramhdrcxx . . $ sctp_paramhdr#) + plen);
5614 SCTP_BUF_LENcxx . . $ `usrsctplib/netinet/sctp_os_userspace.h:790:9`!(op_err_last) += sizeof(struct sctp_paramhdrcxx . . $ sctp_paramhdr#);
5615 SCTP_BUF_NEXTcxx . . $ `usrsctplib/netinet/sctp_os_userspace.h:791:9`!(op_err_last) = SCTP_M_COPYMcxx . . $ `usrsctplib/netinet/sctp_os_userspace.h:759:9`!(mat, at, plen, M_NOWAITcxx . . $ `usrsctplib/user_malloc.h:60:9`!);
5616 if (SCTP_BUF_NEXTcxx . . $ `usrsctplib/netinet/sctp_os_userspace.h:791:9`!(op_err_last) == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!) {
5617 sctp_m_freemcxx . . $ `usrsctplib/netinet/sctputil.h:57:9`!(op_err);
5618 op_err = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!;
5619 op_err_last = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!;
5620 goto more_processing;
5621 } else {
5622 while (SCTP_BUF_NEXTcxx . . $ `usrsctplib/netinet/sctp_os_userspace.h:791:9`!(op_err_last) != NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!) {
5623 op_err_last = SCTP_BUF_NEXTcxx . . $ `usrsctplib/netinet/sctp_os_userspace.h:791:9`!(op_err_last);
5624 }
5625 }
5626 if (plen % 4 != 0) {
5627 pad_needed = 4 - (plen % 4);
5628 } else {
5629 pad_needed = 0;
5630 }
5631 }
5632 }
5633 more_processing:
5634 if ((ptype & 0x8000) == 0x0000) {
5635 SCTPDBGcxx . . $ `usrsctplib/netinet/sctp_os_userspace.h:591:9`!(SCTP_DEBUG_OUTPUT1cxx . . $ `usrsctplib/netinet/sctp_constants.h:643:9`!, "stop proc\n");
5636 return (op_err);
5637 } else {
5638 /* skip this chunk and continue processing */
5639 SCTPDBGcxx . . $ `usrsctplib/netinet/sctp_os_userspace.h:591:9`!(SCTP_DEBUG_OUTPUT1cxx . . $ `usrsctplib/netinet/sctp_constants.h:643:9`!, "move on\n");
5640 at += SCTP_SIZE32cxx . . $ `usrsctplib/netinet/sctp_constants.h:388:9`!(plen);
5641 }
5642 break;
5643 }
5644 phdr = sctp_get_next_paramcxx . . $ sctp_get_next_param(db742a953aea46f4).(mat, at, &params, sizeof(params));
5645 }
5646 return (op_err);
5647 invalid_size:
5648 SCTPDBGcxx . . $ `usrsctplib/netinet/sctp_os_userspace.h:591:9`!(SCTP_DEBUG_OUTPUT1cxx . . $ `usrsctplib/netinet/sctp_constants.h:643:9`!, "abort flag set\n");
5649 *abort_processing = 1;
5650 sctp_m_freemcxx . . $ `usrsctplib/netinet/sctputil.h:57:9`!(op_err);
5651 op_err = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!;
5652 op_err_last = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!;
5653 if (phdr != NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!) {
5654 struct sctp_paramhdrcxx . . $ sctp_paramhdr# *param;
5655 int l_len;
5656 #ifdef INET6cxx . . $ `<built-in>:432:9`!
5657 l_len = SCTP_MIN_OVERHEADcxx . . $ `usrsctplib/netinet/sctp_header.h:561:9`!;
5658 #else
5659 l_len = SCTP_MIN_V4_OVERHEAD;
5660 #endif
5661 l_len += sizeof(struct sctp_chunkhdrcxx . . $ sctp_chunkhdr#);
5662 l_len += (2 * sizeof(struct sctp_paramhdrcxx . . $ sctp_paramhdr#));
5663 op_err = sctp_get_mbuf_for_msgcxx . . $ sctp_get_mbuf_for_msg(c7c30fc329598377).(l_len, 0, M_NOWAITcxx . . $ `usrsctplib/user_malloc.h:60:9`!, 1, MT_DATAcxx . . $ `usrsctplib/user_mbuf.h:289:9`!);
5664 if (op_err) {
5665 SCTP_BUF_LENcxx . . $ `usrsctplib/netinet/sctp_os_userspace.h:790:9`!(op_err) = 0;
5666 #ifdef INET6cxx . . $ `<built-in>:432:9`!
5667 SCTP_BUF_RESV_UFcxx . . $ `usrsctplib/netinet/sctp_os_userspace.h:793:9`!(op_err, sizeof(struct ip6_hdr));
5668 #else
5669 SCTP_BUF_RESV_UF(op_err, sizeof(struct ip));
5670 #endif
5671 SCTP_BUF_RESV_UFcxx . . $ `usrsctplib/netinet/sctp_os_userspace.h:793:9`!(op_err, sizeof(struct sctphdr));
5672 SCTP_BUF_RESV_UFcxx . . $ `usrsctplib/netinet/sctp_os_userspace.h:793:9`!(op_err, sizeof(struct sctp_chunkhdr));
5673 SCTP_BUF_LENcxx . . $ `usrsctplib/netinet/sctp_os_userspace.h:790:9`!(op_err) = 2 * sizeof(struct sctp_paramhdrcxx . . $ sctp_paramhdr#);
5674 param = mtodcxx . . $ `usrsctplib/user_mbuf.h:96:9`!(op_err, struct sctp_paramhdr *);
5675 param->param_typecxx . . $ sctp_paramhdr#param_type. = htonscxx . . $ htons(a18c05e4017afb3d).(SCTP_CAUSE_PROTOCOL_VIOLATIONcxx . . $ `usrsctplib/netinet/sctp.h:373:9`!);
5676 param->param_lengthcxx . . $ sctp_paramhdr#param_length. = htonscxx . . $ htons(a18c05e4017afb3d).(2 * sizeof(struct sctp_paramhdrcxx . . $ sctp_paramhdr#));
5677 param++;
5678 param->param_typecxx . . $ sctp_paramhdr#param_type. = htonscxx . . $ htons(a18c05e4017afb3d).(ptype);
5679 param->param_lengthcxx . . $ sctp_paramhdr#param_length. = htonscxx . . $ htons(a18c05e4017afb3d).(plen);
5680 }
5681 }
5682 return (op_err);
5683 }
5684
5685 static int
5686 sctp_are_there_new_addressescxx . . $ sctp_are_there_new_addresses(9d51dfc13311ffd).(struct sctp_associationcxx . . $ sctp_association# *asoc,
5687 struct mbufcxx . . $ mbuf# *in_initpkt, int offset, struct sockaddrcxx . . $ sockaddr# *src)
5688 {
5689 /*
5690 * Given a INIT packet, look through the packet to verify that there
5691 * are NO new addresses. As we go through the parameters add reports
5692 * of any un-understood parameters that require an error. Also we
5693 * must return (1) to drop the packet if we see a un-understood
5694 * parameter that tells us to drop the chunk.
5695 */
5696 struct sockaddrcxx . . $ sockaddr# *sa_touse;
5697 struct sockaddrcxx . . $ sockaddr# *sa;
5698 struct sctp_paramhdrcxx . . $ sctp_paramhdr# *phdr, params;
5699 uint16_tcxx . . $ uint16_t# ptype, plen;
5700 uint8_tcxx . . $ uint8_t# fnd;
5701 struct sctp_netscxx . . $ sctp_nets# *net;
5702 int check_src;
5703 #ifdef INETcxx . . $ `<built-in>:431:9`!
5704 struct sockaddr_incxx . . $ sockaddr_in# sin4, *sa4;
5705 #endif
5706 #ifdef INET6cxx . . $ `<built-in>:432:9`!
5707 struct sockaddr_in6cxx . . $ sockaddr_in6# sin6, *sa6;
5708 #endif
5709 #if defined(__Userspace__cxx . . $ `<built-in>:442:9`!)
5710 struct sockaddr_conncxx . . $ sockaddr_conn# *sac;
5711 #endif
5712
5713 #ifdef INETcxx . . $ `<built-in>:431:9`!
5714 memsetcxx . . $ memset(d1de1e4fb215f1c6).(&sin4, 0, sizeof(sin4));
5715 sin4.sin_familycxx . . $ sockaddr_in#sin_family. = AF_INETcxx . . $ `<external>/8962547315054503424/socket.h:97:9`!;
5716 #ifdef HAVE_SIN_LEN
5717 sin4.sin_len = sizeof(sin4);
5718 #endif
5719 #endif
5720 #ifdef INET6cxx . . $ `<built-in>:432:9`!
5721 memsetcxx . . $ memset(d1de1e4fb215f1c6).(&sin6, 0, sizeof(sin6));
5722 sin6.sin6_familycxx . . $ sockaddr_in6#sin6_family. = AF_INET6cxx . . $ `<external>/8962547315054503424/socket.h:105:9`!;
5723 #ifdef HAVE_SIN6_LEN
5724 sin6.sin6_len = sizeof(sin6);
5725 #endif
5726 #endif
5727 /* First what about the src address of the pkt ? */
5728 check_src = 0;
5729 switch (src->sa_familycxx . . $ sockaddr#sa_family.) {
5730 #ifdef INETcxx . . $ `<built-in>:431:9`!
5731 case AF_INETcxx . . $ `<external>/8962547315054503424/socket.h:97:9`!:
5732 if (asoc->scopecxx . . $ sctp_association#scope..ipv4_addr_legalcxx . . $ sctp_scoping#ipv4_addr_legal.) {
5733 check_src = 1;
5734 }
5735 break;
5736 #endif
5737 #ifdef INET6cxx . . $ `<built-in>:432:9`!
5738 case AF_INET6cxx . . $ `<external>/8962547315054503424/socket.h:105:9`!:
5739 if (asoc->scopecxx . . $ sctp_association#scope..ipv6_addr_legalcxx . . $ sctp_scoping#ipv6_addr_legal.) {
5740 check_src = 1;
5741 }
5742 break;
5743 #endif
5744 #if defined(__Userspace__cxx . . $ `<built-in>:442:9`!)
5745 case AF_CONNcxx . . $ `usrsctplib/netinet/sctp_os_userspace.h:995:9`!:
5746 if (asoc->scopecxx . . $ sctp_association#scope..conn_addr_legalcxx . . $ sctp_scoping#conn_addr_legal.) {
5747 check_src = 1;
5748 }
5749 break;
5750 #endif
5751 default:
5752 /* TSNH */
5753 break;
5754 }
5755 if (check_src) {
5756 fnd = 0;
5757 TAILQ_FOREACHcxx . . $ `<external>/2546723208511035544/queue.h:435:9`!(net, &asoc->nets, sctp_next) {
5758 sa = (struct sockaddrcxx . . $ sockaddr# *)&net->rocxx . . $ sctp_nets#ro.._l_addrcxx . . $ sctp_net_route#_l_addr.;
5759 if (sa->sa_familycxx . . $ sockaddr#sa_family. == src->sa_familycxx . . $ sockaddr#sa_family.) {
5760 #ifdef INETcxx . . $ `<built-in>:431:9`!
5761 if (sa->sa_familycxx . . $ sockaddr#sa_family. == AF_INETcxx . . $ `<external>/8962547315054503424/socket.h:97:9`!) {
5762 struct sockaddr_incxx . . $ sockaddr_in# *src4;
5763
5764 sa4 = (struct sockaddr_incxx . . $ sockaddr_in# *)sa;
5765 src4 = (struct sockaddr_incxx . . $ sockaddr_in# *)src;
5766 if (sa4->sin_addrcxx . . $ sockaddr_in#sin_addr..s_addrcxx . . $ in_addr#s_addr. == src4->sin_addrcxx . . $ sockaddr_in#sin_addr..s_addrcxx . . $ in_addr#s_addr.) {
5767 fnd = 1;
5768 break;
5769 }
5770 }
5771 #endif
5772 #ifdef INET6cxx . . $ `<built-in>:432:9`!
5773 if (sa->sa_familycxx . . $ sockaddr#sa_family. == AF_INET6cxx . . $ `<external>/8962547315054503424/socket.h:105:9`!) {
5774 struct sockaddr_in6cxx . . $ sockaddr_in6# *src6;
5775
5776 sa6 = (struct sockaddr_in6cxx . . $ sockaddr_in6# *)sa;
5777 src6 = (struct sockaddr_in6cxx . . $ sockaddr_in6# *)src;
5778 if (SCTP6_ARE_ADDR_EQUALcxx . . $ SCTP6_ARE_ADDR_EQUAL(86633e128a705e5c).(sa6, src6)) {
5779 fnd = 1;
5780 break;
5781 }
5782 }
5783 #endif
5784 #if defined(__Userspace__cxx . . $ `<built-in>:442:9`!)
5785 if (sa->sa_familycxx . . $ sockaddr#sa_family. == AF_CONNcxx . . $ `usrsctplib/netinet/sctp_os_userspace.h:995:9`!) {
5786 struct sockaddr_conncxx . . $ sockaddr_conn# *srcc;
5787
5788 sac = (struct sockaddr_conncxx . . $ sockaddr_conn# *)sa;
5789 srcc = (struct sockaddr_conncxx . . $ sockaddr_conn# *)src;
5790 if (sac->sconn_addrcxx . . $ sockaddr_conn#sconn_addr. == srcc->sconn_addrcxx . . $ sockaddr_conn#sconn_addr.) {
5791 fnd = 1;
5792 break;
5793 }
5794 }
5795 #endif
5796 }
5797 }
5798 if (fnd == 0) {
5799 /* New address added! no need to look further. */
5800 return (1);
5801 }
5802 }
5803 /* Ok so far lets munge through the rest of the packet */
5804 offset += sizeof(struct sctp_init_chunkcxx . . $ sctp_init_chunk#);
5805 phdr = sctp_get_next_paramcxx . . $ sctp_get_next_param(db742a953aea46f4).(in_initpkt, offset, &params, sizeof(params));
5806 while (phdr) {
5807 sa_touse = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!;
5808 ptype = ntohscxx . . $ ntohs(a18c05e4017afb3d).(phdr->param_typecxx . . $ sctp_paramhdr#param_type.);
5809 plen = ntohscxx . . $ ntohs(a18c05e4017afb3d).(phdr->param_lengthcxx . . $ sctp_paramhdr#param_length.);
5810 switch (ptype) {
5811 #ifdef INETcxx . . $ `<built-in>:431:9`!
5812 case SCTP_IPV4_ADDRESScxx . . $ `usrsctplib/netinet/sctp_constants.h:399:9`!:
5813 {
5814 struct sctp_ipv4addr_paramcxx . . $ sctp_ipv4addr_param# *p4, p4_buf;
5815
5816 if (plen != sizeof(struct sctp_ipv4addr_paramcxx . . $ sctp_ipv4addr_param#)) {
5817 return (1);
5818 }
5819 phdr = sctp_get_next_paramcxx . . $ sctp_get_next_param(db742a953aea46f4).(in_initpkt, offset,
5820 (struct sctp_paramhdrcxx . . $ sctp_paramhdr# *)&p4_buf, sizeof(p4_buf));
5821 if (phdr == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!) {
5822 return (1);
5823 }
5824 if (asoc->scopecxx . . $ sctp_association#scope..ipv4_addr_legalcxx . . $ sctp_scoping#ipv4_addr_legal.) {
5825 p4 = (struct sctp_ipv4addr_paramcxx . . $ sctp_ipv4addr_param# *)phdr;
5826 sin4.sin_addrcxx . . $ sockaddr_in#sin_addr..s_addrcxx . . $ in_addr#s_addr. = p4->addrcxx . . $ sctp_ipv4addr_param#addr.;
5827 sa_touse = (struct sockaddrcxx . . $ sockaddr# *)&sin4;
5828 }
5829 break;
5830 }
5831 #endif
5832 #ifdef INET6cxx . . $ `<built-in>:432:9`!
5833 case SCTP_IPV6_ADDRESScxx . . $ `usrsctplib/netinet/sctp_constants.h:400:9`!:
5834 {
5835 struct sctp_ipv6addr_paramcxx . . $ sctp_ipv6addr_param# *p6, p6_buf;
5836
5837 if (plen != sizeof(struct sctp_ipv6addr_paramcxx . . $ sctp_ipv6addr_param#)) {
5838 return (1);
5839 }
5840 phdr = sctp_get_next_paramcxx . . $ sctp_get_next_param(db742a953aea46f4).(in_initpkt, offset,
5841 (struct sctp_paramhdrcxx . . $ sctp_paramhdr# *)&p6_buf, sizeof(p6_buf));
5842 if (phdr == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!) {
5843 return (1);
5844 }
5845 if (asoc->scopecxx . . $ sctp_association#scope..ipv6_addr_legalcxx . . $ sctp_scoping#ipv6_addr_legal.) {
5846 p6 = (struct sctp_ipv6addr_paramcxx . . $ sctp_ipv6addr_param# *)phdr;
5847 memcpycxx . . $ memcpy(cc817cb175f282d).((caddr_tcxx . . $ caddr_t#)&sin6.sin6_addrcxx . . $ sockaddr_in6#sin6_addr., p6->addrcxx . . $ sctp_ipv6addr_param#addr.,
5848 sizeof(p6->addrcxx . . $ sctp_ipv6addr_param#addr.));
5849 sa_touse = (struct sockaddrcxx . . $ sockaddr# *)&sin6;
5850 }
5851 break;
5852 }
5853 #endif
5854 default:
5855 sa_touse = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!;
5856 break;
5857 }
5858 if (sa_touse) {
5859 /* ok, sa_touse points to one to check */
5860 fnd = 0;
5861 TAILQ_FOREACHcxx . . $ `<external>/2546723208511035544/queue.h:435:9`!(net, &asoc->nets, sctp_next) {
5862 sa = (struct sockaddrcxx . . $ sockaddr# *)&net->rocxx . . $ sctp_nets#ro.._l_addrcxx . . $ sctp_net_route#_l_addr.;
5863 if (sa->sa_familycxx . . $ sockaddr#sa_family. != sa_touse->sa_familycxx . . $ sockaddr#sa_family.) {
5864 continue;
5865 }
5866 #ifdef INETcxx . . $ `<built-in>:431:9`!
5867 if (sa->sa_familycxx . . $ sockaddr#sa_family. == AF_INETcxx . . $ `<external>/8962547315054503424/socket.h:97:9`!) {
5868 sa4 = (struct sockaddr_incxx . . $ sockaddr_in# *)sa;
5869 if (sa4->sin_addrcxx . . $ sockaddr_in#sin_addr..s_addrcxx . . $ in_addr#s_addr. ==
5870 sin4.sin_addrcxx . . $ sockaddr_in#sin_addr..s_addrcxx . . $ in_addr#s_addr.) {
5871 fnd = 1;
5872 break;
5873 }
5874 }
5875 #endif
5876 #ifdef INET6cxx . . $ `<built-in>:432:9`!
5877 if (sa->sa_familycxx . . $ sockaddr#sa_family. == AF_INET6cxx . . $ `<external>/8962547315054503424/socket.h:105:9`!) {
5878 sa6 = (struct sockaddr_in6cxx . . $ sockaddr_in6# *)sa;
5879 if (SCTP6_ARE_ADDR_EQUALcxx . . $ SCTP6_ARE_ADDR_EQUAL(86633e128a705e5c).(
5880 sa6, &sin6)) {
5881 fnd = 1;
5882 break;
5883 }
5884 }
5885 #endif
5886 }
5887 if (!fnd) {
5888 /* New addr added! no need to look further */
5889 return (1);
5890 }
5891 }
5892 offset += SCTP_SIZE32cxx . . $ `usrsctplib/netinet/sctp_constants.h:388:9`!(plen);
5893 phdr = sctp_get_next_paramcxx . . $ sctp_get_next_param(db742a953aea46f4).(in_initpkt, offset, &params, sizeof(params));
5894 }
5895 return (0);
5896 }
5897
5898 /*
5899 * Given a MBUF chain that was sent into us containing an INIT. Build a
5900 * INIT-ACK with COOKIE and send back. We assume that the in_initpkt has done
5901 * a pullup to include IPv6/4header, SCTP header and initial part of INIT
5902 * message (i.e. the struct sctp_init_msg).
5903 */
5904 void
5905 sctp_send_initiate_ackcxx . . $ sctp_send_initiate_ack(345776b3bb8b4306).(struct sctp_inpcbcxx . . $ sctp_inpcb# *inp, struct sctp_tcbcxx . . $ sctp_tcb# *stcb,
5906 struct sctp_netscxx . . $ sctp_nets# *src_net, struct mbufcxx . . $ mbuf# *init_pkt,
5907 int iphlen, int offset,
5908 struct sockaddrcxx . . $ sockaddr# *src, struct sockaddrcxx . . $ sockaddr# *dst,
5909 struct sctphdrcxx . . $ sctphdr# *sh, struct sctp_init_chunkcxx . . $ sctp_init_chunk# *init_chk,
5910 #if defined(__FreeBSD__) && !defined(__Userspace__cxx . . $ `<built-in>:442:9`!)
5911 uint8_t mflowtype, uint32_t mflowid,
5912 #endif
5913 uint32_tcxx . . $ uint32_t# vrf_id, uint16_tcxx . . $ uint16_t# port)
5914 {
5915 struct sctp_associationcxx . . $ sctp_association# *asoc;
5916 struct mbufcxx . . $ mbuf# *m, *m_tmp, *m_last, *m_cookie, *op_err;
5917 struct sctp_init_ack_chunkcxx . . $ `usrsctplib/netinet/sctp_header.h:254:9`! *initack;
5918 struct sctp_adaptation_layer_indicationcxx . . $ sctp_adaptation_layer_indication# *ali;
5919 struct sctp_supported_chunk_types_paramcxx . . $ sctp_supported_chunk_types_param# *pr_supported;
5920 struct sctp_paramhdrcxx . . $ sctp_paramhdr# *ph;
5921 union sctp_sockstore *over_addr;
5922 struct sctp_scopingcxx . . $ sctp_scoping# scp;
5923 struct timevalcxx . . $ timeval# now;
5924 #ifdef INETcxx . . $ `<built-in>:431:9`!
5925 struct sockaddr_incxx . . $ sockaddr_in# *dst4 = (struct sockaddr_incxx . . $ sockaddr_in# *)dst;
5926 struct sockaddr_incxx . . $ sockaddr_in# *src4 = (struct sockaddr_incxx . . $ sockaddr_in# *)src;
5927 struct sockaddr_incxx . . $ sockaddr_in# *sin;
5928 #endif
5929 #ifdef INET6cxx . . $ `<built-in>:432:9`!
5930 struct sockaddr_in6cxx . . $ sockaddr_in6# *dst6 = (struct sockaddr_in6cxx . . $ sockaddr_in6# *)dst;
5931 struct sockaddr_in6cxx . . $ sockaddr_in6# *src6 = (struct sockaddr_in6cxx . . $ sockaddr_in6# *)src;
5932 struct sockaddr_in6cxx . . $ sockaddr_in6# *sin6;
5933 #endif
5934 #if defined(__Userspace__cxx . . $ `<built-in>:442:9`!)
5935 struct sockaddr_conncxx . . $ sockaddr_conn# *dstconn = (struct sockaddr_conncxx . . $ sockaddr_conn# *)dst;
5936 struct sockaddr_conncxx . . $ sockaddr_conn# *srcconn = (struct sockaddr_conncxx . . $ sockaddr_conn# *)src;
5937 struct sockaddr_conncxx . . $ sockaddr_conn# *sconn;
5938 #endif
5939 struct sockaddrcxx . . $ sockaddr# *to;
5940 struct sctp_state_cookiecxx . . $ sctp_state_cookie# stc;
5941 struct sctp_netscxx . . $ sctp_nets# *net = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!;
5942 uint8_tcxx . . $ uint8_t# *signature = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!;
5943 int cnt_inits_to = 0;
5944 uint16_tcxx . . $ uint16_t# his_limit, i_want;
5945 int abort_flag;
5946 int nat_friendly = 0;
5947 int error;
5948 struct socketcxx . . $ socket# *so;
5949 uint16_tcxx . . $ uint16_t# num_ext, chunk_len, padding_len, parameter_len;
5950
5951 if (stcb) {
5952 asoc = &stcb->asoccxx . . $ sctp_tcb#asoc.;
5953 } else {
5954 asoc = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!;
5955 }
5956 if ((asoc != NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!) &&
5957 (SCTP_GET_STATEcxx . . $ `usrsctplib/netinet/sctp_constants.h:476:9`!(stcb) != SCTP_STATE_COOKIE_WAITcxx . . $ `usrsctplib/netinet/sctp_constants.h:462:9`!)) {
5958 if (sctp_are_there_new_addressescxx . . $ sctp_are_there_new_addresses(9d51dfc13311ffd).(asoc, init_pkt, offset, src)) {
5959 /*
5960 * new addresses, out of here in non-cookie-wait states
5961 *
5962 * Send an ABORT, without the new address error cause.
5963 * This looks no different than if no listener
5964 * was present.
5965 */
5966 op_err = sctp_generate_causecxx . . $ sctp_generate_cause(b66a0ee9768f26bd).(SCTP_BASE_SYSCTLcxx . . $ `usrsctplib/netinet/sctp_os_userspace.h:579:9`!(sctp_diag_info_code),
5967 "Address added");
5968 sctp_send_abortcxx . . $ sctp_send_abort(d57fc55c8a777e0c).(init_pkt, iphlen, src, dst, sh, 0, op_err,
5969 #if defined(__FreeBSD__) && !defined(__Userspace__cxx . . $ `<built-in>:442:9`!)
5970 mflowtype, mflowid, inp->fibnum,
5971 #endif
5972 vrf_id, port);
5973 return;
5974 }
5975 if (src_net != NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`! && (src_net->portcxx . . $ sctp_nets#port. != port)) {
5976 /*
5977 * change of remote encapsulation port, out of here in
5978 * non-cookie-wait states
5979 *
5980 * Send an ABORT, without an specific error cause.
5981 * This looks no different than if no listener
5982 * was present.
5983 */
5984 op_err = sctp_generate_causecxx . . $ sctp_generate_cause(b66a0ee9768f26bd).(SCTP_BASE_SYSCTLcxx . . $ `usrsctplib/netinet/sctp_os_userspace.h:579:9`!(sctp_diag_info_code),
5985 "Remote encapsulation port changed");
5986 sctp_send_abortcxx . . $ sctp_send_abort(d57fc55c8a777e0c).(init_pkt, iphlen, src, dst, sh, 0, op_err,
5987 #if defined(__FreeBSD__) && !defined(__Userspace__cxx . . $ `<built-in>:442:9`!)
5988 mflowtype, mflowid, inp->fibnum,
5989 #endif
5990 vrf_id, port);
5991 return;
5992 }
5993 }
5994 abort_flag = 0;
5995 op_err = sctp_arethere_unrecognized_parameterscxx . . $ sctp_arethere_unrecognized_parameters(769374a5071e409f).(init_pkt,
5996 (offset + sizeof(struct sctp_init_chunkcxx . . $ sctp_init_chunk#)),
5997 &abort_flag,
5998 (struct sctp_chunkhdrcxx . . $ sctp_chunkhdr# *)init_chk,
5999 &nat_friendly, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!);
6000 if (abort_flag) {
6001 do_a_abort:
6002 if (op_err == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!) {
6003 char msg[SCTP_DIAG_INFO_LENcxx . . $ `usrsctplib/netinet/sctp_constants.h:748:9`!];
6004
6005 SCTP_SNPRINTFcxx . . $ `usrsctplib/netinet/sctp_os_userspace.h:808:9`!(msg, sizeof(msg), "%s:%d at %s", __FILE__, __LINE__, __func__);
6006 op_err = sctp_generate_causecxx . . $ sctp_generate_cause(b66a0ee9768f26bd).(SCTP_BASE_SYSCTLcxx . . $ `usrsctplib/netinet/sctp_os_userspace.h:579:9`!(sctp_diag_info_code),
6007 msg);
6008 }
6009 sctp_send_abortcxx . . $ sctp_send_abort(d57fc55c8a777e0c).(init_pkt, iphlen, src, dst, sh,
6010 init_chk->initcxx . . $ sctp_init_chunk#init..initiate_tagcxx . . $ sctp_init#initiate_tag., op_err,
6011 #if defined(__FreeBSD__) && !defined(__Userspace__cxx . . $ `<built-in>:442:9`!)
6012 mflowtype, mflowid, inp->fibnum,
6013 #endif
6014 vrf_id, port);
6015 return;
6016 }
6017 m = sctp_get_mbuf_for_msgcxx . . $ sctp_get_mbuf_for_msg(c7c30fc329598377).(MCLBYTEScxx . . $ `usrsctplib/user_mbuf.h:51:9`!, 0, M_NOWAITcxx . . $ `usrsctplib/user_malloc.h:60:9`!, 1, MT_DATAcxx . . $ `usrsctplib/user_mbuf.h:289:9`!);
6018 if (m == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!) {
6019 /* No memory, INIT timer will re-attempt. */
6020 sctp_m_freemcxx . . $ `usrsctplib/netinet/sctputil.h:57:9`!(op_err);
6021 return;
6022 }
6023 chunk_len = (uint16_tcxx . . $ uint16_t#)sizeof(struct sctp_init_ack_chunkcxx . . $ `usrsctplib/netinet/sctp_header.h:254:9`!);
6024 padding_len = 0;
6025
6026 /*
6027 * We might not overwrite the identification[] completely and on
6028 * some platforms time_entered will contain some padding.
6029 * Therefore zero out the cookie to avoid putting
6030 * uninitialized memory on the wire.
6031 */
6032 memsetcxx . . $ memset(d1de1e4fb215f1c6).(&stc, 0, sizeof(struct sctp_state_cookiecxx . . $ sctp_state_cookie#));
6033
6034 /* the time I built cookie */
6035 (void)SCTP_GETTIME_TIMEVALcxx . . $ `usrsctplib/netinet/sctp_constants.h:995:9`!(&now);
6036 stc.time_enteredcxx . . $ sctp_state_cookie#time_entered..tv_seccxx . . $ timeval#tv_sec. = now.tv_seccxx . . $ timeval#tv_sec.;
6037 stc.time_enteredcxx . . $ sctp_state_cookie#time_entered..tv_useccxx . . $ timeval#tv_usec. = now.tv_useccxx . . $ timeval#tv_usec.;
6038
6039 /* populate any tie tags */
6040 if (asoc != NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!) {
6041 /* unlock before tag selections */
6042 stc.tie_tag_my_vtagcxx . . $ sctp_state_cookie#tie_tag_my_vtag. = asoc->my_vtag_noncecxx . . $ sctp_association#my_vtag_nonce.;
6043 stc.tie_tag_peer_vtagcxx . . $ sctp_state_cookie#tie_tag_peer_vtag. = asoc->peer_vtag_noncecxx . . $ sctp_association#peer_vtag_nonce.;
6044 stc.cookie_lifecxx . . $ sctp_state_cookie#cookie_life. = asoc->cookie_lifecxx . . $ sctp_association#cookie_life.;
6045 net = asoc->primary_destinationcxx . . $ sctp_association#primary_destination.;
6046 } else {
6047 stc.tie_tag_my_vtagcxx . . $ sctp_state_cookie#tie_tag_my_vtag. = 0;
6048 stc.tie_tag_peer_vtagcxx . . $ sctp_state_cookie#tie_tag_peer_vtag. = 0;
6049 /* life I will award this cookie */
6050 stc.cookie_lifecxx . . $ sctp_state_cookie#cookie_life. = inp->sctp_epcxx . . $ sctp_inpcb#sctp_ep..def_cookie_lifecxx . . $ sctp_pcb#def_cookie_life.;
6051 }
6052
6053 /* copy in the ports for later check */
6054 stc.myportcxx . . $ sctp_state_cookie#myport. = sh->dest_portcxx . . $ sctphdr#dest_port.;
6055 stc.peerportcxx . . $ sctp_state_cookie#peerport. = sh->src_portcxx . . $ sctphdr#src_port.;
6056
6057 /*
6058 * If we wanted to honor cookie life extensions, we would add to
6059 * stc.cookie_life. For now we should NOT honor any extension
6060 */
6061 stc.site_scopecxx . . $ sctp_state_cookie#site_scope. = stc.local_scopecxx . . $ sctp_state_cookie#local_scope. = stc.loopback_scopecxx . . $ sctp_state_cookie#loopback_scope. = 0;
6062 if (inp->sctp_flagscxx . . $ sctp_inpcb#sctp_flags. & SCTP_PCB_FLAGS_BOUND_V6cxx . . $ `usrsctplib/netinet/sctp.h:539:9`!) {
6063 stc.ipv6_addr_legalcxx . . $ sctp_state_cookie#ipv6_addr_legal. = 1;
6064 if (SCTP_IPV6_V6ONLYcxx . . $ `usrsctplib/netinet/sctp_os_userspace.h:945:9`!(inp)) {
6065 stc.ipv4_addr_legalcxx . . $ sctp_state_cookie#ipv4_addr_legal. = 0;
6066 } else {
6067 stc.ipv4_addr_legalcxx . . $ sctp_state_cookie#ipv4_addr_legal. = 1;
6068 }
6069 #if defined(__Userspace__cxx . . $ `<built-in>:442:9`!)
6070 stc.conn_addr_legalcxx . . $ sctp_state_cookie#conn_addr_legal. = 0;
6071 #endif
6072 } else {
6073 stc.ipv6_addr_legalcxx . . $ sctp_state_cookie#ipv6_addr_legal. = 0;
6074 #if defined(__Userspace__cxx . . $ `<built-in>:442:9`!)
6075 if (inp->sctp_flagscxx . . $ sctp_inpcb#sctp_flags. & SCTP_PCB_FLAGS_BOUND_CONNcxx . . $ `usrsctplib/netinet/sctp.h:545:9`!) {
6076 stc.conn_addr_legalcxx . . $ sctp_state_cookie#conn_addr_legal. = 1;
6077 stc.ipv4_addr_legalcxx . . $ sctp_state_cookie#ipv4_addr_legal. = 0;
6078 } else {
6079 stc.conn_addr_legalcxx . . $ sctp_state_cookie#conn_addr_legal. = 0;
6080 stc.ipv4_addr_legalcxx . . $ sctp_state_cookie#ipv4_addr_legal. = 1;
6081 }
6082 #else
6083 stc.ipv4_addr_legal = 1;
6084 #endif
6085 }
6086 stc.ipv4_scopecxx . . $ sctp_state_cookie#ipv4_scope. = 0;
6087 if (net == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!) {
6088 to = src;
6089 switch (dst->sa_familycxx . . $ sockaddr#sa_family.) {
6090 #ifdef INETcxx . . $ `<built-in>:431:9`!
6091 case AF_INETcxx . . $ `<external>/8962547315054503424/socket.h:97:9`!:
6092 {
6093 /* lookup address */
6094 stc.addresscxx . . $ sctp_state_cookie#address.[0] = src4->sin_addrcxx . . $ sockaddr_in#sin_addr..s_addrcxx . . $ in_addr#s_addr.;
6095 stc.addresscxx . . $ sctp_state_cookie#address.[1] = 0;
6096 stc.addresscxx . . $ sctp_state_cookie#address.[2] = 0;
6097 stc.addresscxx . . $ sctp_state_cookie#address.[3] = 0;
6098 stc.addr_typecxx . . $ sctp_state_cookie#addr_type. = SCTP_IPV4_ADDRESScxx . . $ `usrsctplib/netinet/sctp_constants.h:399:9`!;
6099 /* local from address */
6100 stc.laddresscxx . . $ sctp_state_cookie#laddress.[0] = dst4->sin_addrcxx . . $ sockaddr_in#sin_addr..s_addrcxx . . $ in_addr#s_addr.;
6101 stc.laddresscxx . . $ sctp_state_cookie#laddress.[1] = 0;
6102 stc.laddresscxx . . $ sctp_state_cookie#laddress.[2] = 0;
6103 stc.laddresscxx . . $ sctp_state_cookie#laddress.[3] = 0;
6104 stc.laddr_typecxx . . $ sctp_state_cookie#laddr_type. = SCTP_IPV4_ADDRESScxx . . $ `usrsctplib/netinet/sctp_constants.h:399:9`!;
6105 /* scope_id is only for v6 */
6106 stc.scope_idcxx . . $ sctp_state_cookie#scope_id. = 0;
6107 if ((IN4_ISPRIVATE_ADDRESScxx . . $ `usrsctplib/netinet/sctp_constants.h:972:9`!(&src4->sin_addr)) ||
6108 (IN4_ISPRIVATE_ADDRESScxx . . $ `usrsctplib/netinet/sctp_constants.h:972:9`!(&dst4->sin_addr))){
6109 stc.ipv4_scopecxx . . $ sctp_state_cookie#ipv4_scope. = 1;
6110 }
6111 /* Must use the address in this case */
6112 if (sctp_is_address_on_local_hostcxx . . $ sctp_is_address_on_local_host(db0353392d411bf9).(src, vrf_id)) {
6113 stc.loopback_scopecxx . . $ sctp_state_cookie#loopback_scope. = 1;
6114 stc.ipv4_scopecxx . . $ sctp_state_cookie#ipv4_scope. = 1;
6115 stc.site_scopecxx . . $ sctp_state_cookie#site_scope. = 1;
6116 stc.local_scopecxx . . $ sctp_state_cookie#local_scope. = 0;
6117 }
6118 break;
6119 }
6120 #endif
6121 #ifdef INET6cxx . . $ `<built-in>:432:9`!
6122 case AF_INET6cxx . . $ `<external>/8962547315054503424/socket.h:105:9`!:
6123 {
6124 stc.addr_typecxx . . $ sctp_state_cookie#addr_type. = SCTP_IPV6_ADDRESScxx . . $ `usrsctplib/netinet/sctp_constants.h:400:9`!;
6125 memcpycxx . . $ memcpy(cc817cb175f282d).(&stc.addresscxx . . $ sctp_state_cookie#address., &src6->sin6_addrcxx . . $ sockaddr_in6#sin6_addr., sizeof(struct in6_addrcxx . . $ in6_addr#));
6126 #if defined(__FreeBSD__) && !defined(__Userspace__cxx . . $ `<built-in>:442:9`!)
6127 stc.scope_id = ntohs(in6_getscope(&src6->sin6_addr));
6128 #else
6129 stc.scope_idcxx . . $ sctp_state_cookie#scope_id. = 0;
6130 #endif
6131 if (sctp_is_address_on_local_hostcxx . . $ sctp_is_address_on_local_host(db0353392d411bf9).(src, vrf_id)) {
6132 stc.loopback_scopecxx . . $ sctp_state_cookie#loopback_scope. = 1;
6133 stc.local_scopecxx . . $ sctp_state_cookie#local_scope. = 0;
6134 stc.site_scopecxx . . $ sctp_state_cookie#site_scope. = 1;
6135 stc.ipv4_scopecxx . . $ sctp_state_cookie#ipv4_scope. = 1;
6136 } else if (IN6_IS_ADDR_LINKLOCALcxx . . $ `<external>/9581057695539925927/in.h:453:10`!(&src6->sin6_addr) ||
6137 IN6_IS_ADDR_LINKLOCALcxx . . $ `<external>/9581057695539925927/in.h:453:10`!(&dst6->sin6_addr)) {
6138 /*
6139 * If the new destination or source is a
6140 * LINK_LOCAL we must have common both site and
6141 * local scope. Don't set local scope though
6142 * since we must depend on the source to be
6143 * added implicitly. We cannot assure just
6144 * because we share one link that all links are
6145 * common.
6146 */
6147 #if defined(__APPLE__) && !defined(__Userspace__cxx . . $ `<built-in>:442:9`!)
6148 /* Mac OS X currently doesn't have in6_getscope() */
6149 stc.scope_id = src6->sin6_addr.s6_addr16[1];
6150 #endif
6151 stc.local_scopecxx . . $ sctp_state_cookie#local_scope. = 0;
6152 stc.site_scopecxx . . $ sctp_state_cookie#site_scope. = 1;
6153 stc.ipv4_scopecxx . . $ sctp_state_cookie#ipv4_scope. = 1;
6154 /*
6155 * we start counting for the private address
6156 * stuff at 1. since the link local we
6157 * source from won't show up in our scoped
6158 * count.
6159 */
6160 cnt_inits_to = 1;
6161 /* pull out the scope_id from incoming pkt */
6162 } else if (IN6_IS_ADDR_SITELOCALcxx . . $ `<external>/9581057695539925927/in.h:458:10`!(&src6->sin6_addr) ||
6163 IN6_IS_ADDR_SITELOCALcxx . . $ `<external>/9581057695539925927/in.h:458:10`!(&dst6->sin6_addr)) {
6164 /*
6165 * If the new destination or source is
6166 * SITE_LOCAL then we must have site scope in
6167 * common.
6168 */
6169 stc.site_scopecxx . . $ sctp_state_cookie#site_scope. = 1;
6170 }
6171 memcpycxx . . $ memcpy(cc817cb175f282d).(&stc.laddresscxx . . $ sctp_state_cookie#laddress., &dst6->sin6_addrcxx . . $ sockaddr_in6#sin6_addr., sizeof(struct in6_addrcxx . . $ in6_addr#));
6172 stc.laddr_typecxx . . $ sctp_state_cookie#laddr_type. = SCTP_IPV6_ADDRESScxx . . $ `usrsctplib/netinet/sctp_constants.h:400:9`!;
6173 break;
6174 }
6175 #endif
6176 #if defined(__Userspace__cxx . . $ `<built-in>:442:9`!)
6177 case AF_CONNcxx . . $ `usrsctplib/netinet/sctp_os_userspace.h:995:9`!:
6178 {
6179 /* lookup address */
6180 stc.addresscxx . . $ sctp_state_cookie#address.[0] = 0;
6181 stc.addresscxx . . $ sctp_state_cookie#address.[1] = 0;
6182 stc.addresscxx . . $ sctp_state_cookie#address.[2] = 0;
6183 stc.addresscxx . . $ sctp_state_cookie#address.[3] = 0;
6184 memcpycxx . . $ memcpy(cc817cb175f282d).(&stc.addresscxx . . $ sctp_state_cookie#address., &srcconn->sconn_addrcxx . . $ sockaddr_conn#sconn_addr., sizeof(void *));
6185 stc.addr_typecxx . . $ sctp_state_cookie#addr_type. = SCTP_CONN_ADDRESScxx . . $ `usrsctplib/netinet/sctp_constants.h:397:9`!;
6186 /* local from address */
6187 stc.laddresscxx . . $ sctp_state_cookie#laddress.[0] = 0;
6188 stc.laddresscxx . . $ sctp_state_cookie#laddress.[1] = 0;
6189 stc.laddresscxx . . $ sctp_state_cookie#laddress.[2] = 0;
6190 stc.laddresscxx . . $ sctp_state_cookie#laddress.[3] = 0;
6191 memcpycxx . . $ memcpy(cc817cb175f282d).(&stc.laddresscxx . . $ sctp_state_cookie#laddress., &dstconn->sconn_addrcxx . . $ sockaddr_conn#sconn_addr., sizeof(void *));
6192 stc.laddr_typecxx . . $ sctp_state_cookie#laddr_type. = SCTP_CONN_ADDRESScxx . . $ `usrsctplib/netinet/sctp_constants.h:397:9`!;
6193 /* scope_id is only for v6 */
6194 stc.scope_idcxx . . $ sctp_state_cookie#scope_id. = 0;
6195 break;
6196 }
6197 #endif
6198 default:
6199 /* TSNH */
6200 goto do_a_abort;
6201 break;
6202 }
6203 } else {
6204 /* set the scope per the existing tcb */
6205
6206 #ifdef INET6cxx . . $ `<built-in>:432:9`!
6207 struct sctp_netscxx . . $ sctp_nets# *lnet;
6208 #endif
6209
6210 stc.loopback_scopecxx . . $ sctp_state_cookie#loopback_scope. = asoc->scopecxx . . $ sctp_association#scope..loopback_scopecxx . . $ sctp_scoping#loopback_scope.;
6211 stc.ipv4_scopecxx . . $ sctp_state_cookie#ipv4_scope. = asoc->scopecxx . . $ sctp_association#scope..ipv4_local_scopecxx . . $ sctp_scoping#ipv4_local_scope.;
6212 stc.site_scopecxx . . $ sctp_state_cookie#site_scope. = asoc->scopecxx . . $ sctp_association#scope..site_scopecxx . . $ sctp_scoping#site_scope.;
6213 stc.local_scopecxx . . $ sctp_state_cookie#local_scope. = asoc->scopecxx . . $ sctp_association#scope..local_scopecxx . . $ sctp_scoping#local_scope.;
6214 #ifdef INET6cxx . . $ `<built-in>:432:9`!
6215 /* Why do we not consider IPv4 LL addresses? */
6216 TAILQ_FOREACHcxx . . $ `<external>/2546723208511035544/queue.h:435:9`!(lnet, &asoc->nets, sctp_next) {
6217 if (lnet->rocxx . . $ sctp_nets#ro.._l_addrcxx . . $ sctp_net_route#_l_addr..sin6.sin6_familycxx . . $ sockaddr_in6#sin6_family. == AF_INET6cxx . . $ `<external>/8962547315054503424/socket.h:105:9`!) {
6218 if (IN6_IS_ADDR_LINKLOCALcxx . . $ `<external>/9581057695539925927/in.h:453:10`!(&lnet->ro._l_addr.sin6.sin6_addr)) {
6219 /*
6220 * if we have a LL address, start
6221 * counting at 1.
6222 */
6223 cnt_inits_to = 1;
6224 }
6225 }
6226 }
6227 #endif
6228 /* use the net pointer */
6229 to = (struct sockaddrcxx . . $ sockaddr# *)&net->rocxx . . $ sctp_nets#ro.._l_addrcxx . . $ sctp_net_route#_l_addr.;
6230 switch (to->sa_familycxx . . $ sockaddr#sa_family.) {
6231 #ifdef INETcxx . . $ `<built-in>:431:9`!
6232 case AF_INETcxx . . $ `<external>/8962547315054503424/socket.h:97:9`!:
6233 sin = (struct sockaddr_incxx . . $ sockaddr_in# *)to;
6234 stc.addresscxx . . $ sctp_state_cookie#address.[0] = sin->sin_addrcxx . . $ sockaddr_in#sin_addr..s_addrcxx . . $ in_addr#s_addr.;
6235 stc.addresscxx . . $ sctp_state_cookie#address.[1] = 0;
6236 stc.addresscxx . . $ sctp_state_cookie#address.[2] = 0;
6237 stc.addresscxx . . $ sctp_state_cookie#address.[3] = 0;
6238 stc.addr_typecxx . . $ sctp_state_cookie#addr_type. = SCTP_IPV4_ADDRESScxx . . $ `usrsctplib/netinet/sctp_constants.h:399:9`!;
6239 if (net->src_addr_selectedcxx . . $ sctp_nets#src_addr_selected. == 0) {
6240 /*
6241 * strange case here, the INIT should have
6242 * did the selection.
6243 */
6244 net->rocxx . . $ sctp_nets#ro.._s_addrcxx . . $ sctp_net_route#_s_addr. = sctp_source_address_selectioncxx . . $ sctp_source_address_selection(8ee075f20da66e1).(inp,
6245 stcb, (sctp_route_tcxx . . $ sctp_route_t# *)&net->rocxx . . $ sctp_nets#ro.,
6246 net, 0, vrf_id);
6247 if (net->rocxx . . $ sctp_nets#ro.._s_addrcxx . . $ sctp_net_route#_s_addr. == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!) {
6248 sctp_m_freemcxx . . $ `usrsctplib/netinet/sctputil.h:57:9`!(op_err);
6249 sctp_m_freemcxx . . $ `usrsctplib/netinet/sctputil.h:57:9`!(m);
6250 return;
6251 }
6252
6253 net->src_addr_selectedcxx . . $ sctp_nets#src_addr_selected. = 1;
6254 }
6255 stc.laddresscxx . . $ sctp_state_cookie#laddress.[0] = net->rocxx . . $ sctp_nets#ro.._s_addrcxx . . $ sctp_net_route#_s_addr.->addresscxx . . $ sctp_ifa#address..sin.sin_addrcxx . . $ sockaddr_in#sin_addr..s_addrcxx . . $ in_addr#s_addr.;
6256 stc.laddresscxx . . $ sctp_state_cookie#laddress.[1] = 0;
6257 stc.laddresscxx . . $ sctp_state_cookie#laddress.[2] = 0;
6258 stc.laddresscxx . . $ sctp_state_cookie#laddress.[3] = 0;
6259 stc.laddr_typecxx . . $ sctp_state_cookie#laddr_type. = SCTP_IPV4_ADDRESScxx . . $ `usrsctplib/netinet/sctp_constants.h:399:9`!;
6260 /* scope_id is only for v6 */
6261 stc.scope_idcxx . . $ sctp_state_cookie#scope_id. = 0;
6262 break;
6263 #endif
6264 #ifdef INET6cxx . . $ `<built-in>:432:9`!
6265 case AF_INET6cxx . . $ `<external>/8962547315054503424/socket.h:105:9`!:
6266 sin6 = (struct sockaddr_in6cxx . . $ sockaddr_in6# *)to;
6267 memcpycxx . . $ memcpy(cc817cb175f282d).(&stc.addresscxx . . $ sctp_state_cookie#address., &sin6->sin6_addrcxx . . $ sockaddr_in6#sin6_addr.,
6268 sizeof(struct in6_addrcxx . . $ in6_addr#));
6269 stc.addr_typecxx . . $ sctp_state_cookie#addr_type. = SCTP_IPV6_ADDRESScxx . . $ `usrsctplib/netinet/sctp_constants.h:400:9`!;
6270 stc.scope_idcxx . . $ sctp_state_cookie#scope_id. = sin6->sin6_scope_idcxx . . $ sockaddr_in6#sin6_scope_id.;
6271 if (net->src_addr_selectedcxx . . $ sctp_nets#src_addr_selected. == 0) {
6272 /*
6273 * strange case here, the INIT should have
6274 * done the selection.
6275 */
6276 net->rocxx . . $ sctp_nets#ro.._s_addrcxx . . $ sctp_net_route#_s_addr. = sctp_source_address_selectioncxx . . $ sctp_source_address_selection(8ee075f20da66e1).(inp,
6277 stcb, (sctp_route_tcxx . . $ sctp_route_t# *)&net->rocxx . . $ sctp_nets#ro.,
6278 net, 0, vrf_id);
6279 if (net->rocxx . . $ sctp_nets#ro.._s_addrcxx . . $ sctp_net_route#_s_addr. == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!) {
6280 sctp_m_freemcxx . . $ `usrsctplib/netinet/sctputil.h:57:9`!(op_err);
6281 sctp_m_freemcxx . . $ `usrsctplib/netinet/sctputil.h:57:9`!(m);
6282 return;
6283 }
6284
6285 net->src_addr_selectedcxx . . $ sctp_nets#src_addr_selected. = 1;
6286 }
6287 memcpycxx . . $ memcpy(cc817cb175f282d).(&stc.laddresscxx . . $ sctp_state_cookie#laddress., &net->rocxx . . $ sctp_nets#ro.._s_addrcxx . . $ sctp_net_route#_s_addr.->addresscxx . . $ sctp_ifa#address..sin6.sin6_addrcxx . . $ sockaddr_in6#sin6_addr.,
6288 sizeof(struct in6_addrcxx . . $ in6_addr#));
6289 stc.laddr_typecxx . . $ sctp_state_cookie#laddr_type. = SCTP_IPV6_ADDRESScxx . . $ `usrsctplib/netinet/sctp_constants.h:400:9`!;
6290 break;
6291 #endif
6292 #if defined(__Userspace__cxx . . $ `<built-in>:442:9`!)
6293 case AF_CONNcxx . . $ `usrsctplib/netinet/sctp_os_userspace.h:995:9`!:
6294 sconn = (struct sockaddr_conncxx . . $ sockaddr_conn# *)to;
6295 stc.addresscxx . . $ sctp_state_cookie#address.[0] = 0;
6296 stc.addresscxx . . $ sctp_state_cookie#address.[1] = 0;
6297 stc.addresscxx . . $ sctp_state_cookie#address.[2] = 0;
6298 stc.addresscxx . . $ sctp_state_cookie#address.[3] = 0;
6299 memcpycxx . . $ memcpy(cc817cb175f282d).(&stc.addresscxx . . $ sctp_state_cookie#address., &sconn->sconn_addrcxx . . $ sockaddr_conn#sconn_addr., sizeof(void *));
6300 stc.addr_typecxx . . $ sctp_state_cookie#addr_type. = SCTP_CONN_ADDRESScxx . . $ `usrsctplib/netinet/sctp_constants.h:397:9`!;
6301 stc.laddresscxx . . $ sctp_state_cookie#laddress.[0] = 0;
6302 stc.laddresscxx . . $ sctp_state_cookie#laddress.[1] = 0;
6303 stc.laddresscxx . . $ sctp_state_cookie#laddress.[2] = 0;
6304 stc.laddresscxx . . $ sctp_state_cookie#laddress.[3] = 0;
6305 memcpycxx . . $ memcpy(cc817cb175f282d).(&stc.laddresscxx . . $ sctp_state_cookie#laddress., &sconn->sconn_addrcxx . . $ sockaddr_conn#sconn_addr., sizeof(void *));
6306 stc.laddr_typecxx . . $ sctp_state_cookie#laddr_type. = SCTP_CONN_ADDRESScxx . . $ `usrsctplib/netinet/sctp_constants.h:397:9`!;
6307 stc.scope_idcxx . . $ sctp_state_cookie#scope_id. = 0;
6308 break;
6309 #endif
6310 }
6311 }
6312 /* Now lets put the SCTP header in place */
6313 initack = mtodcxx . . $ `usrsctplib/user_mbuf.h:96:9`!(m, struct sctp_init_ack_chunkcxx . . $ `usrsctplib/netinet/sctp_header.h:254:9`! *);
6314 /* Save it off for quick ref */
6315 stc.peers_vtagcxx . . $ sctp_state_cookie#peers_vtag. = ntohlcxx . . $ ntohl(2141b656ce2cc063).(init_chk->initcxx . . $ sctp_init_chunk#init..initiate_tagcxx . . $ sctp_init#initiate_tag.);
6316 /* who are we */
6317 memcpycxx . . $ memcpy(cc817cb175f282d).(stc.identificationcxx . . $ sctp_state_cookie#identification., SCTP_VERSION_STRINGcxx . . $ `usrsctplib/netinet/sctp_constants.h:91:9`!,
6318 mincxx . . $ `usrsctplib/user_environment.h:66:9`!(strlen(SCTP_VERSION_STRINGcxx . . $ `usrsctplib/netinet/sctp_constants.h:91:9`!), sizeof(stc.identification)));
6319 memsetcxx . . $ memset(d1de1e4fb215f1c6).(stc.reservedcxx . . $ sctp_state_cookie#reserved., 0, SCTP_RESERVE_SPACEcxx . . $ `usrsctplib/netinet/sctp_header.h:196:9`!);
6320 /* now the chunk header */
6321 initack->chcxx . . $ sctp_init_chunk#ch..chunk_typecxx . . $ sctp_chunkhdr#chunk_type. = SCTP_INITIATION_ACKcxx . . $ `usrsctplib/netinet/sctp.h:451:9`!;
6322 initack->chcxx . . $ sctp_init_chunk#ch..chunk_flagscxx . . $ sctp_chunkhdr#chunk_flags. = 0;
6323 /* fill in later from mbuf we build */
6324 initack->chcxx . . $ sctp_init_chunk#ch..chunk_lengthcxx . . $ sctp_chunkhdr#chunk_length. = 0;
6325 /* place in my tag */
6326 if ((asoc != NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!) &&
6327 ((SCTP_GET_STATEcxx . . $ `usrsctplib/netinet/sctp_constants.h:476:9`!(stcb) == SCTP_STATE_COOKIE_WAITcxx . . $ `usrsctplib/netinet/sctp_constants.h:462:9`!) ||
6328 (SCTP_GET_STATEcxx . . $ `usrsctplib/netinet/sctp_constants.h:476:9`!(stcb) == SCTP_STATE_INUSEcxx . . $ `usrsctplib/netinet/sctp_constants.h:461:9`!) ||
6329 (SCTP_GET_STATEcxx . . $ `usrsctplib/netinet/sctp_constants.h:476:9`!(stcb) == SCTP_STATE_COOKIE_ECHOEDcxx . . $ `usrsctplib/netinet/sctp_constants.h:463:9`!))) {
6330 /* re-use the v-tags and init-seq here */
6331 initack->initcxx . . $ sctp_init_chunk#init..initiate_tagcxx . . $ sctp_init#initiate_tag. = htonlcxx . . $ htonl(2141b656ce2cc063).(asoc->my_vtagcxx . . $ sctp_association#my_vtag.);
6332 initack->initcxx . . $ sctp_init_chunk#init..initial_tsncxx . . $ sctp_init#initial_tsn. = htonlcxx . . $ htonl(2141b656ce2cc063).(asoc->init_seq_numbercxx . . $ sctp_association#init_seq_number.);
6333 } else {
6334 uint32_tcxx . . $ uint32_t# vtag, itsn;
6335
6336 if (asoc) {
6337 atomic_add_intcxx . . $ `usrsctplib/user_atomic.h:94:9`!(&asoc->refcnt, 1);
6338 SCTP_TCB_UNLOCKcxx . . $ `usrsctplib/netinet/sctp_process_lock.h:476:9`!(stcb);
6339 new_tag:
6340 vtag = sctp_select_a_tagcxx . . $ sctp_select_a_tag(38ac6aa2a73c3363).(inp, inp->sctp_lportcxx . . $ `usrsctplib/netinet/sctp_pcb.h:430:9`!, sh->src_portcxx . . $ sctphdr#src_port., 1);
6341 if ((asoc->peer_supports_natcxx . . $ sctp_association#peer_supports_nat.) && (vtag == asoc->my_vtagcxx . . $ sctp_association#my_vtag.)) {
6342 /* Got a duplicate vtag on some guy behind a nat
6343 * make sure we don't use it.
6344 */
6345 goto new_tag;
6346 }
6347 initack->initcxx . . $ sctp_init_chunk#init..initiate_tagcxx . . $ sctp_init#initiate_tag. = htonlcxx . . $ htonl(2141b656ce2cc063).(vtag);
6348 /* get a TSN to use too */
6349 itsn = sctp_select_initial_TSNcxx . . $ sctp_select_initial_TSN(4bcc659f5dd09fb6).(&inp->sctp_epcxx . . $ sctp_inpcb#sctp_ep.);
6350 initack->initcxx . . $ sctp_init_chunk#init..initial_tsncxx . . $ sctp_init#initial_tsn. = htonlcxx . . $ htonl(2141b656ce2cc063).(itsn);
6351 SCTP_TCB_LOCKcxx . . $ `usrsctplib/netinet/sctp_process_lock.h:473:9`!(stcb);
6352 atomic_add_intcxx . . $ `usrsctplib/user_atomic.h:94:9`!(&asoc->refcnt, -1);
6353 } else {
6354 SCTP_INP_INCR_REFcxx . . $ `usrsctplib/netinet/sctp_process_lock.h:390:9`!(inp);
6355 SCTP_INP_RUNLOCKcxx . . $ `usrsctplib/netinet/sctp_process_lock.h:381:9`!(inp);
6356 vtag = sctp_select_a_tagcxx . . $ sctp_select_a_tag(38ac6aa2a73c3363).(inp, inp->sctp_lportcxx . . $ `usrsctplib/netinet/sctp_pcb.h:430:9`!, sh->src_portcxx . . $ sctphdr#src_port., 1);
6357 initack->initcxx . . $ sctp_init_chunk#init..initiate_tagcxx . . $ sctp_init#initiate_tag. = htonlcxx . . $ htonl(2141b656ce2cc063).(vtag);
6358 /* get a TSN to use too */
6359 initack->initcxx . . $ sctp_init_chunk#init..initial_tsncxx . . $ sctp_init#initial_tsn. = htonlcxx . . $ htonl(2141b656ce2cc063).(sctp_select_initial_TSNcxx . . $ sctp_select_initial_TSN(4bcc659f5dd09fb6).(&inp->sctp_epcxx . . $ sctp_inpcb#sctp_ep.));
6360 SCTP_INP_RLOCKcxx . . $ `usrsctplib/netinet/sctp_process_lock.h:376:9`!(inp);
6361 SCTP_INP_DECR_REFcxx . . $ `usrsctplib/netinet/sctp_process_lock.h:391:9`!(inp);
6362 }
6363 }
6364 /* save away my tag to */
6365 stc.my_vtagcxx . . $ sctp_state_cookie#my_vtag. = initack->initcxx . . $ sctp_init_chunk#init..initiate_tagcxx . . $ sctp_init#initiate_tag.;
6366
6367 /* set up some of the credits. */
6368 so = inp->sctp_socketcxx . . $ sctp_inpcb#sctp_socket.;
6369 if (so == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!) {
6370 /* memory problem */
6371 sctp_m_freemcxx . . $ `usrsctplib/netinet/sctputil.h:57:9`!(op_err);
6372 sctp_m_freemcxx . . $ `usrsctplib/netinet/sctputil.h:57:9`!(m);
6373 return;
6374 } else {
6375 initack->initcxx . . $ sctp_init_chunk#init..a_rwndcxx . . $ sctp_init#a_rwnd. = htonlcxx . . $ htonl(2141b656ce2cc063).(maxcxx . . $ `usrsctplib/user_environment.h:67:9`!(SCTP_SB_LIMIT_RCVcxx . . $ `usrsctplib/netinet/sctp_os_userspace.h:964:9`!(so), SCTP_MINIMAL_RWNDcxx . . $ `usrsctplib/netinet/sctp_constants.h:634:9`!));
6376 }
6377 /* set what I want */
6378 his_limit = ntohscxx . . $ ntohs(a18c05e4017afb3d).(init_chk->initcxx . . $ sctp_init_chunk#init..num_inbound_streamscxx . . $ sctp_init#num_inbound_streams.);
6379 /* choose what I want */
6380 if (asoc != NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!) {
6381 if (asoc->streamoutcntcxx . . $ sctp_association#streamoutcnt. > asoc->pre_open_streamscxx . . $ sctp_association#pre_open_streams.) {
6382 i_want = asoc->streamoutcntcxx . . $ sctp_association#streamoutcnt.;
6383 } else {
6384 i_want = asoc->pre_open_streamscxx . . $ sctp_association#pre_open_streams.;
6385 }
6386 } else {
6387 i_want = inp->sctp_epcxx . . $ sctp_inpcb#sctp_ep..pre_open_stream_countcxx . . $ sctp_pcb#pre_open_stream_count.;
6388 }
6389 if (his_limit < i_want) {
6390 /* I Want more :< */
6391 initack->initcxx . . $ sctp_init_chunk#init..num_outbound_streamscxx . . $ sctp_init#num_outbound_streams. = init_chk->initcxx . . $ sctp_init_chunk#init..num_inbound_streamscxx . . $ sctp_init#num_inbound_streams.;
6392 } else {
6393 /* I can have what I want :> */
6394 initack->initcxx . . $ sctp_init_chunk#init..num_outbound_streamscxx . . $ sctp_init#num_outbound_streams. = htonscxx . . $ htons(a18c05e4017afb3d).(i_want);
6395 }
6396 /* tell him his limit. */
6397 initack->initcxx . . $ sctp_init_chunk#init..num_inbound_streamscxx . . $ sctp_init#num_inbound_streams. =
6398 htonscxx . . $ htons(a18c05e4017afb3d).(inp->sctp_epcxx . . $ sctp_inpcb#sctp_ep..max_open_streams_intomecxx . . $ sctp_pcb#max_open_streams_intome.);
6399
6400 /* adaptation layer indication parameter */
6401 if (inp->sctp_epcxx . . $ sctp_inpcb#sctp_ep..adaptation_layer_indicator_providedcxx . . $ sctp_pcb#adaptation_layer_indicator_provided.) {
6402 parameter_len = (uint16_tcxx . . $ uint16_t#)sizeof(struct sctp_adaptation_layer_indicationcxx . . $ sctp_adaptation_layer_indication#);
6403 ali = (struct sctp_adaptation_layer_indicationcxx . . $ sctp_adaptation_layer_indication# *)(mtodcxx . . $ `usrsctplib/user_mbuf.h:96:9`!(m, caddr_t) + chunk_len);
6404 ali->phcxx . . $ sctp_adaptation_layer_indication#ph..param_typecxx . . $ sctp_paramhdr#param_type. = htonscxx . . $ htons(a18c05e4017afb3d).(SCTP_ULP_ADAPTATIONcxx . . $ `usrsctplib/netinet/sctp_constants.h:440:9`!);
6405 ali->phcxx . . $ sctp_adaptation_layer_indication#ph..param_lengthcxx . . $ sctp_paramhdr#param_length. = htonscxx . . $ htons(a18c05e4017afb3d).(parameter_len);
6406 ali->indicationcxx . . $ sctp_adaptation_layer_indication#indication. = htonlcxx . . $ htonl(2141b656ce2cc063).(inp->sctp_epcxx . . $ sctp_inpcb#sctp_ep..adaptation_layer_indicatorcxx . . $ sctp_pcb#adaptation_layer_indicator.);
6407 chunk_len += parameter_len;
6408 }
6409
6410 /* ECN parameter */
6411 if (((asoc != NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!) && (asoc->ecn_supportedcxx . . $ sctp_association#ecn_supported. == 1)) ||
6412 ((asoc == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!) && (inp->ecn_supportedcxx . . $ sctp_inpcb#ecn_supported. == 1))) {
6413 parameter_len = (uint16_tcxx . . $ uint16_t#)sizeof(struct sctp_paramhdrcxx . . $ sctp_paramhdr#);
6414 ph = (struct sctp_paramhdrcxx . . $ sctp_paramhdr# *)(mtodcxx . . $ `usrsctplib/user_mbuf.h:96:9`!(m, caddr_t) + chunk_len);
6415 ph->param_typecxx . . $ sctp_paramhdr#param_type. = htonscxx . . $ htons(a18c05e4017afb3d).(SCTP_ECN_CAPABLEcxx . . $ `usrsctplib/netinet/sctp_constants.h:421:9`!);
6416 ph->param_lengthcxx . . $ sctp_paramhdr#param_length. = htonscxx . . $ htons(a18c05e4017afb3d).(parameter_len);
6417 chunk_len += parameter_len;
6418 }
6419
6420 /* PR-SCTP supported parameter */
6421 if (((asoc != NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!) && (asoc->prsctp_supportedcxx . . $ sctp_association#prsctp_supported. == 1)) ||
6422 ((asoc == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!) && (inp->prsctp_supportedcxx . . $ sctp_inpcb#prsctp_supported. == 1))) {
6423 parameter_len = (uint16_tcxx . . $ uint16_t#)sizeof(struct sctp_paramhdrcxx . . $ sctp_paramhdr#);
6424 ph = (struct sctp_paramhdrcxx . . $ sctp_paramhdr# *)(mtodcxx . . $ `usrsctplib/user_mbuf.h:96:9`!(m, caddr_t) + chunk_len);
6425 ph->param_typecxx . . $ sctp_paramhdr#param_type. = htonscxx . . $ htons(a18c05e4017afb3d).(SCTP_PRSCTP_SUPPORTEDcxx . . $ `usrsctplib/netinet/sctp_constants.h:433:9`!);
6426 ph->param_lengthcxx . . $ sctp_paramhdr#param_length. = htonscxx . . $ htons(a18c05e4017afb3d).(parameter_len);
6427 chunk_len += parameter_len;
6428 }
6429
6430 /* Add NAT friendly parameter */
6431 if (nat_friendly) {
6432 parameter_len = (uint16_tcxx . . $ uint16_t#)sizeof(struct sctp_paramhdrcxx . . $ sctp_paramhdr#);
6433 ph = (struct sctp_paramhdrcxx . . $ sctp_paramhdr# *)(mtodcxx . . $ `usrsctplib/user_mbuf.h:96:9`!(m, caddr_t) + chunk_len);
6434 ph->param_typecxx . . $ sctp_paramhdr#param_type. = htonscxx . . $ htons(a18c05e4017afb3d).(SCTP_HAS_NAT_SUPPORTcxx . . $ `usrsctplib/netinet/sctp_constants.h:442:9`!);
6435 ph->param_lengthcxx . . $ sctp_paramhdr#param_length. = htonscxx . . $ htons(a18c05e4017afb3d).(parameter_len);
6436 chunk_len += parameter_len;
6437 }
6438
6439 /* And now tell the peer which extensions we support */
6440 num_ext = 0;
6441 pr_supported = (struct sctp_supported_chunk_types_paramcxx . . $ sctp_supported_chunk_types_param# *)(mtodcxx . . $ `usrsctplib/user_mbuf.h:96:9`!(m, caddr_t) + chunk_len);
6442 if (((asoc != NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!) && (asoc->prsctp_supportedcxx . . $ sctp_association#prsctp_supported. == 1)) ||
6443 ((asoc == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!) && (inp->prsctp_supportedcxx . . $ sctp_inpcb#prsctp_supported. == 1))) {
6444 pr_supported->chunk_typescxx . . $ sctp_supported_chunk_types_param#chunk_types.[num_ext++] = SCTP_FORWARD_CUM_TSNcxx . . $ `usrsctplib/netinet/sctp.h:482:9`!;
6445 if (((asoc != NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!) && (asoc->idata_supportedcxx . . $ sctp_association#idata_supported. == 1)) ||
6446 ((asoc == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!) && (inp->idata_supportedcxx . . $ sctp_inpcb#idata_supported. == 1))) {
6447 pr_supported->chunk_typescxx . . $ sctp_supported_chunk_types_param#chunk_types.[num_ext++] = SCTP_IFORWARD_CUM_TSNcxx . . $ `usrsctplib/netinet/sctp.h:485:9`!;
6448 }
6449 }
6450 if (((asoc != NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!) && (asoc->auth_supportedcxx . . $ sctp_association#auth_supported. == 1)) ||
6451 ((asoc == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!) && (inp->auth_supportedcxx . . $ sctp_inpcb#auth_supported. == 1))) {
6452 pr_supported->chunk_typescxx . . $ sctp_supported_chunk_types_param#chunk_types.[num_ext++] = SCTP_AUTHENTICATIONcxx . . $ `usrsctplib/netinet/sctp.h:465:9`!;
6453 }
6454 if (((asoc != NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!) && (asoc->asconf_supportedcxx . . $ sctp_association#asconf_supported. == 1)) ||
6455 ((asoc == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!) && (inp->asconf_supportedcxx . . $ sctp_inpcb#asconf_supported. == 1))) {
6456 pr_supported->chunk_typescxx . . $ sctp_supported_chunk_types_param#chunk_types.[num_ext++] = SCTP_ASCONFcxx . . $ `usrsctplib/netinet/sctp.h:484:9`!;
6457 pr_supported->chunk_typescxx . . $ sctp_supported_chunk_types_param#chunk_types.[num_ext++] = SCTP_ASCONF_ACKcxx . . $ `usrsctplib/netinet/sctp.h:472:9`!;
6458 }
6459 if (((asoc != NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!) && (asoc->reconfig_supportedcxx . . $ sctp_association#reconfig_supported. == 1)) ||
6460 ((asoc == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!) && (inp->reconfig_supportedcxx . . $ sctp_inpcb#reconfig_supported. == 1))) {
6461 pr_supported->chunk_typescxx . . $ sctp_supported_chunk_types_param#chunk_types.[num_ext++] = SCTP_STREAM_RESETcxx . . $ `usrsctplib/netinet/sctp.h:476:9`!;
6462 }
6463 if (((asoc != NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!) && (asoc->idata_supportedcxx . . $ sctp_association#idata_supported. == 1)) ||
6464 ((asoc == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!) && (inp->idata_supportedcxx . . $ sctp_inpcb#idata_supported. == 1))) {
6465 pr_supported->chunk_typescxx . . $ sctp_supported_chunk_types_param#chunk_types.[num_ext++] = SCTP_IDATAcxx . . $ `usrsctplib/netinet/sctp.h:469:9`!;
6466 }
6467 if (((asoc != NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!) && (asoc->nrsack_supportedcxx . . $ sctp_association#nrsack_supported. == 1)) ||
6468 ((asoc == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!) && (inp->nrsack_supportedcxx . . $ sctp_inpcb#nrsack_supported. == 1))) {
6469 pr_supported->chunk_typescxx . . $ sctp_supported_chunk_types_param#chunk_types.[num_ext++] = SCTP_NR_SELECTIVE_ACKcxx . . $ `usrsctplib/netinet/sctp.h:467:9`!;
6470 }
6471 if (((asoc != NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!) && (asoc->pktdrop_supportedcxx . . $ sctp_association#pktdrop_supported. == 1)) ||
6472 ((asoc == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!) && (inp->pktdrop_supportedcxx . . $ sctp_inpcb#pktdrop_supported. == 1))) {
6473 pr_supported->chunk_typescxx . . $ sctp_supported_chunk_types_param#chunk_types.[num_ext++] = SCTP_PACKET_DROPPEDcxx . . $ `usrsctplib/netinet/sctp.h:474:9`!;
6474 }
6475 if (num_ext > 0) {
6476 parameter_len = (uint16_tcxx . . $ uint16_t#)sizeof(struct sctp_supported_chunk_types_paramcxx . . $ sctp_supported_chunk_types_param#) + num_ext;
6477 pr_supported->phcxx . . $ sctp_supported_chunk_types_param#ph..param_typecxx . . $ sctp_paramhdr#param_type. = htonscxx . . $ htons(a18c05e4017afb3d).(SCTP_SUPPORTED_CHUNK_EXTcxx . . $ `usrsctplib/netinet/sctp_constants.h:430:9`!);
6478 pr_supported->phcxx . . $ sctp_supported_chunk_types_param#ph..param_lengthcxx . . $ sctp_paramhdr#param_length. = htonscxx . . $ htons(a18c05e4017afb3d).(parameter_len);
6479 padding_len = SCTP_SIZE32cxx . . $ `usrsctplib/netinet/sctp_constants.h:388:9`!(parameter_len) - parameter_len;
6480 chunk_len += parameter_len;
6481 }
6482
6483 /* add authentication parameters */
6484 if (((asoc != NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!) && (asoc->auth_supportedcxx . . $ sctp_association#auth_supported. == 1)) ||
6485 ((asoc == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!) && (inp->auth_supportedcxx . . $ sctp_inpcb#auth_supported. == 1))) {
6486 struct sctp_auth_randomcxx . . $ sctp_auth_random# *randp;
6487 struct sctp_auth_hmac_algocxx . . $ sctp_auth_hmac_algo# *hmacs;
6488 struct sctp_auth_chunk_listcxx . . $ sctp_auth_chunk_list# *chunks;
6489
6490 if (padding_len > 0) {
6491 memsetcxx . . $ memset(d1de1e4fb215f1c6).(mtodcxx . . $ `usrsctplib/user_mbuf.h:96:9`!(m, caddr_t) + chunk_len, 0, padding_len);
6492 chunk_len += padding_len;
6493 padding_len = 0;
6494 }
6495 /* generate and add RANDOM parameter */
6496 randp = (struct sctp_auth_randomcxx . . $ sctp_auth_random# *)(mtodcxx . . $ `usrsctplib/user_mbuf.h:96:9`!(m, caddr_t) + chunk_len);
6497 parameter_len = (uint16_tcxx . . $ uint16_t#)sizeof(struct sctp_auth_randomcxx . . $ sctp_auth_random#) +
6498 SCTP_AUTH_RANDOM_SIZE_DEFAULTcxx . . $ `usrsctplib/netinet/sctp_auth.h:51:9`!;
6499 randp->phcxx . . $ sctp_auth_random#ph..param_typecxx . . $ sctp_paramhdr#param_type. = htonscxx . . $ htons(a18c05e4017afb3d).(SCTP_RANDOMcxx . . $ `usrsctplib/netinet/sctp_constants.h:424:9`!);
6500 randp->phcxx . . $ sctp_auth_random#ph..param_lengthcxx . . $ sctp_paramhdr#param_length. = htonscxx . . $ htons(a18c05e4017afb3d).(parameter_len);
6501 SCTP_READ_RANDOMcxx . . $ `usrsctplib/netinet/sctp_os_userspace.h:967:9`!(randp->random_data, SCTP_AUTH_RANDOM_SIZE_DEFAULTcxx . . $ `usrsctplib/netinet/sctp_auth.h:51:9`!);
6502 padding_len = SCTP_SIZE32cxx . . $ `usrsctplib/netinet/sctp_constants.h:388:9`!(parameter_len) - parameter_len;
6503 chunk_len += parameter_len;
6504
6505 if (padding_len > 0) {
6506 memsetcxx . . $ memset(d1de1e4fb215f1c6).(mtodcxx . . $ `usrsctplib/user_mbuf.h:96:9`!(m, caddr_t) + chunk_len, 0, padding_len);
6507 chunk_len += padding_len;
6508 padding_len = 0;
6509 }
6510 /* add HMAC_ALGO parameter */
6511 hmacs = (struct sctp_auth_hmac_algocxx . . $ sctp_auth_hmac_algo# *)(mtodcxx . . $ `usrsctplib/user_mbuf.h:96:9`!(m, caddr_t) + chunk_len);
6512 parameter_len = (uint16_tcxx . . $ uint16_t#)sizeof(struct sctp_auth_hmac_algocxx . . $ sctp_auth_hmac_algo#) +
6513 sctp_serialize_hmaclistcxx . . $ sctp_serialize_hmaclist(efcf6ebc6065f5a8).(inp->sctp_epcxx . . $ sctp_inpcb#sctp_ep..local_hmacscxx . . $ sctp_pcb#local_hmacs.,
6514 (uint8_tcxx . . $ uint8_t# *)hmacs->hmac_idscxx . . $ sctp_auth_hmac_algo#hmac_ids.);
6515 hmacs->phcxx . . $ sctp_auth_hmac_algo#ph..param_typecxx . . $ sctp_paramhdr#param_type. = htonscxx . . $ htons(a18c05e4017afb3d).(SCTP_HMAC_LISTcxx . . $ `usrsctplib/netinet/sctp_constants.h:426:9`!);
6516 hmacs->phcxx . . $ sctp_auth_hmac_algo#ph..param_lengthcxx . . $ sctp_paramhdr#param_length. = htonscxx . . $ htons(a18c05e4017afb3d).(parameter_len);
6517 padding_len = SCTP_SIZE32cxx . . $ `usrsctplib/netinet/sctp_constants.h:388:9`!(parameter_len) - parameter_len;
6518 chunk_len += parameter_len;
6519
6520 if (padding_len > 0) {
6521 memsetcxx . . $ memset(d1de1e4fb215f1c6).(mtodcxx . . $ `usrsctplib/user_mbuf.h:96:9`!(m, caddr_t) + chunk_len, 0, padding_len);
6522 chunk_len += padding_len;
6523 padding_len = 0;
6524 }
6525 /* add CHUNKS parameter */
6526 chunks = (struct sctp_auth_chunk_listcxx . . $ sctp_auth_chunk_list# *)(mtodcxx . . $ `usrsctplib/user_mbuf.h:96:9`!(m, caddr_t) + chunk_len);
6527 parameter_len = (uint16_tcxx . . $ uint16_t#)sizeof(struct sctp_auth_chunk_listcxx . . $ sctp_auth_chunk_list#) +
6528 sctp_serialize_auth_chunkscxx . . $ sctp_serialize_auth_chunks(589238950b692487).(inp->sctp_epcxx . . $ sctp_inpcb#sctp_ep..local_auth_chunkscxx . . $ sctp_pcb#local_auth_chunks.,
6529 chunks->chunk_typescxx . . $ sctp_auth_chunk_list#chunk_types.);
6530 chunks->phcxx . . $ sctp_auth_chunk_list#ph..param_typecxx . . $ sctp_paramhdr#param_type. = htonscxx . . $ htons(a18c05e4017afb3d).(SCTP_CHUNK_LISTcxx . . $ `usrsctplib/netinet/sctp_constants.h:425:9`!);
6531 chunks->phcxx . . $ sctp_auth_chunk_list#ph..param_lengthcxx . . $ sctp_paramhdr#param_length. = htonscxx . . $ htons(a18c05e4017afb3d).(parameter_len);
6532 padding_len = SCTP_SIZE32cxx . . $ `usrsctplib/netinet/sctp_constants.h:388:9`!(parameter_len) - parameter_len;
6533 chunk_len += parameter_len;
6534 }
6535 SCTP_BUF_LENcxx . . $ `usrsctplib/netinet/sctp_os_userspace.h:790:9`!(m) = chunk_len;
6536 m_last = m;
6537 /* now the addresses */
6538 /* To optimize this we could put the scoping stuff
6539 * into a structure and remove the individual uint8's from
6540 * the stc structure. Then we could just sifa in the
6541 * address within the stc.. but for now this is a quick
6542 * hack to get the address stuff teased apart.
6543 */
6544 scp.ipv4_addr_legalcxx . . $ sctp_scoping#ipv4_addr_legal. = stc.ipv4_addr_legalcxx . . $ sctp_state_cookie#ipv4_addr_legal.;
6545 scp.ipv6_addr_legalcxx . . $ sctp_scoping#ipv6_addr_legal. = stc.ipv6_addr_legalcxx . . $ sctp_state_cookie#ipv6_addr_legal.;
6546 #if defined(__Userspace__cxx . . $ `<built-in>:442:9`!)
6547 scp.conn_addr_legalcxx . . $ sctp_scoping#conn_addr_legal. = stc.conn_addr_legalcxx . . $ sctp_state_cookie#conn_addr_legal.;
6548 #endif
6549 scp.loopback_scopecxx . . $ sctp_scoping#loopback_scope. = stc.loopback_scopecxx . . $ sctp_state_cookie#loopback_scope.;
6550 scp.ipv4_local_scopecxx . . $ sctp_scoping#ipv4_local_scope. = stc.ipv4_scopecxx . . $ sctp_state_cookie#ipv4_scope.;
6551 scp.local_scopecxx . . $ sctp_scoping#local_scope. = stc.local_scopecxx . . $ sctp_state_cookie#local_scope.;
6552 scp.site_scopecxx . . $ sctp_scoping#site_scope. = stc.site_scopecxx . . $ sctp_state_cookie#site_scope.;
6553 m_last = sctp_add_addresses_to_i_iacxx . . $ sctp_add_addresses_to_i_ia(9e6c56b7dd223edd).(inp, stcb, &scp, m_last,
6554 cnt_inits_to,
6555 &padding_len, &chunk_len);
6556 /* padding_len can only be positive, if no addresses have been added */
6557 if (padding_len > 0) {
6558 memsetcxx . . $ memset(d1de1e4fb215f1c6).(mtodcxx . . $ `usrsctplib/user_mbuf.h:96:9`!(m, caddr_t) + chunk_len, 0, padding_len);
6559 chunk_len += padding_len;
6560 SCTP_BUF_LENcxx . . $ `usrsctplib/netinet/sctp_os_userspace.h:790:9`!(m) += padding_len;
6561 padding_len = 0;
6562 }
6563
6564 /* tack on the operational error if present */
6565 if (op_err) {
6566 parameter_len = 0;
6567 for (m_tmp = op_err; m_tmp != NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!; m_tmp = SCTP_BUF_NEXTcxx . . $ `usrsctplib/netinet/sctp_os_userspace.h:791:9`!(m_tmp)) {
6568 parameter_len += SCTP_BUF_LENcxx . . $ `usrsctplib/netinet/sctp_os_userspace.h:790:9`!(m_tmp);
6569 }
6570 padding_len = SCTP_SIZE32cxx . . $ `usrsctplib/netinet/sctp_constants.h:388:9`!(parameter_len) - parameter_len;
6571 SCTP_BUF_NEXTcxx . . $ `usrsctplib/netinet/sctp_os_userspace.h:791:9`!(m_last) = op_err;
6572 while (SCTP_BUF_NEXTcxx . . $ `usrsctplib/netinet/sctp_os_userspace.h:791:9`!(m_last) != NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!) {
6573 m_last = SCTP_BUF_NEXTcxx . . $ `usrsctplib/netinet/sctp_os_userspace.h:791:9`!(m_last);
6574 }
6575 chunk_len += parameter_len;
6576 }
6577 if (padding_len > 0) {
6578 m_last = sctp_add_pad_tombufcxx . . $ sctp_add_pad_tombuf(78d6dcf03d579fb3).(m_last, padding_len);
6579 if (m_last == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!) {
6580 /* Houston we have a problem, no space */
6581 sctp_m_freemcxx . . $ `usrsctplib/netinet/sctputil.h:57:9`!(m);
6582 return;
6583 }
6584 chunk_len += padding_len;
6585 padding_len = 0;
6586 }
6587 /* Now we must build a cookie */
6588 m_cookie = sctp_add_cookiecxx . . $ sctp_add_cookie(b9db52938457bd6).(init_pkt, offset, m, 0, &stc, &signature);
6589 if (m_cookie == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!) {
6590 /* memory problem */
6591 sctp_m_freemcxx . . $ `usrsctplib/netinet/sctputil.h:57:9`!(m);
6592 return;
6593 }
6594 /* Now append the cookie to the end and update the space/size */
6595 SCTP_BUF_NEXTcxx . . $ `usrsctplib/netinet/sctp_os_userspace.h:791:9`!(m_last) = m_cookie;
6596 parameter_len = 0;
6597 for (m_tmp = m_cookie; m_tmp != NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!; m_tmp = SCTP_BUF_NEXTcxx . . $ `usrsctplib/netinet/sctp_os_userspace.h:791:9`!(m_tmp)) {
6598 parameter_len += SCTP_BUF_LENcxx . . $ `usrsctplib/netinet/sctp_os_userspace.h:790:9`!(m_tmp);
6599 if (SCTP_BUF_NEXTcxx . . $ `usrsctplib/netinet/sctp_os_userspace.h:791:9`!(m_tmp) == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!) {
6600 m_last = m_tmp;
6601 }
6602 }
6603 padding_len = SCTP_SIZE32cxx . . $ `usrsctplib/netinet/sctp_constants.h:388:9`!(parameter_len) - parameter_len;
6604 chunk_len += parameter_len;
6605
6606 /* Place in the size, but we don't include
6607 * the last pad (if any) in the INIT-ACK.
6608 */
6609 initack->chcxx . . $ sctp_init_chunk#ch..chunk_lengthcxx . . $ sctp_chunkhdr#chunk_length. = htonscxx . . $ htons(a18c05e4017afb3d).(chunk_len);
6610
6611 /* Time to sign the cookie, we don't sign over the cookie
6612 * signature though thus we set trailer.
6613 */
6614 (void)sctp_hmac_mcxx . . $ sctp_hmac_m(d321f6c9b672eb02).(SCTP_HMACcxx . . $ `usrsctplib/netinet/sctp_constants.h:304:9`!,
6615 (uint8_tcxx . . $ uint8_t# *)inp->sctp_epcxx . . $ sctp_inpcb#sctp_ep..secret_keycxx . . $ sctp_pcb#secret_key.[(int)(inp->sctp_epcxx . . $ sctp_inpcb#sctp_ep..current_secret_numbercxx . . $ sctp_pcb#current_secret_number.)],
6616 SCTP_SECRET_SIZEcxx . . $ `usrsctplib/netinet/sctp_constants.h:705:9`!, m_cookie, sizeof(struct sctp_paramhdrcxx . . $ sctp_paramhdr#),
6617 (uint8_tcxx . . $ uint8_t# *)signature, SCTP_SIGNATURE_SIZEcxx . . $ `usrsctplib/netinet/sctp_constants.h:305:9`!);
6618 #if defined(__Userspace__cxx . . $ `<built-in>:442:9`!)
6619 /*
6620 * Don't put AF_CONN addresses on the wire, in case this is critical
6621 * for the application. However, they are protected by the HMAC and
6622 * need to be reconstructed before checking the HMAC.
6623 * Clearing is only done in the mbuf chain, since the local stc is
6624 * not used anymore.
6625 */
6626 if (stc.addr_typecxx . . $ sctp_state_cookie#addr_type. == SCTP_CONN_ADDRESScxx . . $ `usrsctplib/netinet/sctp_constants.h:397:9`!) {
6627 const void *p = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!;
6628
6629 m_copybackcxx . . $ m_copyback(ac1bb86caf8c6a54).(m_cookie, sizeof(struct sctp_paramhdrcxx . . $ sctp_paramhdr#) + offsetofcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:431:9`!(struct sctp_state_cookie, address),
6630 (int)sizeof(void *), (caddr_tcxx . . $ caddr_t#)&p);
6631 }
6632 if (stc.laddr_typecxx . . $ sctp_state_cookie#laddr_type. == SCTP_CONN_ADDRESScxx . . $ `usrsctplib/netinet/sctp_constants.h:397:9`!) {
6633 const void *p = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!;
6634
6635 m_copybackcxx . . $ m_copyback(ac1bb86caf8c6a54).(m_cookie, sizeof(struct sctp_paramhdrcxx . . $ sctp_paramhdr#) + offsetofcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:431:9`!(struct sctp_state_cookie, laddress),
6636 (int)sizeof(void *), (caddr_tcxx . . $ caddr_t#)&p);
6637 }
6638 #endif
6639 /*
6640 * We sifa 0 here to NOT set IP_DF if its IPv4, we ignore the return
6641 * here since the timer will drive a retranmission.
6642 */
6643 if (padding_len > 0) {
6644 if (sctp_add_pad_tombufcxx . . $ sctp_add_pad_tombuf(78d6dcf03d579fb3).(m_last, padding_len) == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!) {
6645 sctp_m_freemcxx . . $ `usrsctplib/netinet/sctputil.h:57:9`!(m);
6646 return;
6647 }
6648 }
6649 if (stc.loopback_scopecxx . . $ sctp_state_cookie#loopback_scope.) {
6650 over_addr = (union sctp_sockstore *)dst;
6651 } else {
6652 over_addr = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!;
6653 }
6654
6655 if ((error = sctp_lowlevel_chunk_outputcxx . . $ sctp_lowlevel_chunk_output(4859f95fdecd7401).(inp, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!, to, m, 0, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!, 0, 0,
6656 0, 0,
6657 inp->sctp_lportcxx . . $ `usrsctplib/netinet/sctp_pcb.h:430:9`!, sh->src_portcxx . . $ sctphdr#src_port., init_chk->initcxx . . $ sctp_init_chunk#init..initiate_tagcxx . . $ sctp_init#initiate_tag.,
6658 port, over_addr,
6659 #if defined(__FreeBSD__) && !defined(__Userspace__cxx . . $ `<built-in>:442:9`!)
6660 mflowtype, mflowid,
6661 #endif
6662 SCTP_SO_NOT_LOCKEDcxx . . $ `usrsctplib/netinet/sctp_constants.h:964:9`!))) {
6663 SCTPDBGcxx . . $ `usrsctplib/netinet/sctp_os_userspace.h:591:9`!(SCTP_DEBUG_OUTPUT4cxx . . $ `usrsctplib/netinet/sctp_constants.h:646:9`!, "Gak send error %d\n", error);
6664 if (error == ENOBUFScxx . . $ `<external>/17922322188510340118/errno.h:89:9`!) {
6665 if (asoc != NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!) {
6666 asoc->ifp_had_enobufcxx . . $ sctp_association#ifp_had_enobuf. = 1;
6667 }
6668 SCTP_STAT_INCRcxx . . $ `./netinet/sctp_uio.h:1111:9`!(sctps_lowlevelerr);
6669 }
6670 } else {
6671 if (asoc != NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!) {
6672 asoc->ifp_had_enobufcxx . . $ sctp_association#ifp_had_enobuf. = 0;
6673 }
6674 }
6675 SCTP_STAT_INCR_COUNTER64cxx . . $ `./netinet/sctp_uio.h:1127:9`!(sctps_outcontrolchunks);
6676 }
6677
6678 static void
6679 sctp_prune_prsctpcxx . . $ sctp_prune_prsctp(d414e49fb135549e).(struct sctp_tcbcxx . . $ sctp_tcb# *stcb,
6680 struct sctp_associationcxx . . $ sctp_association# *asoc,
6681 struct sctp_sndrcvinfo *srcv,
6682 int dataout)
6683 {
6684 int freed_spc = 0;
6685 struct sctp_tmit_chunkcxx . . $ sctp_tmit_chunk# *chk, *nchk;
6686
6687 SCTP_TCB_LOCK_ASSERTcxx . . $ `usrsctplib/netinet/sctp_process_lock.h:478:9`!(stcb);
6688 if ((asoc->prsctp_supportedcxx . . $ sctp_association#prsctp_supported.) &&
6689 (asoc->sent_queue_cnt_removeablecxx . . $ sctp_association#sent_queue_cnt_removeable. > 0)) {
6690 TAILQ_FOREACHcxx . . $ `<external>/2546723208511035544/queue.h:435:9`!(chk, &asoc->sent_queue, sctp_next) {
6691 /*
6692 * Look for chunks marked with the PR_SCTP flag AND
6693 * the buffer space flag. If the one being sent is
6694 * equal or greater priority then purge the old one
6695 * and free some space.
6696 */
6697 if (PR_SCTP_BUF_ENABLEDcxx . . $ `./netinet/sctp_uio.h:289:9`!(chk->flags)) {
6698 /*
6699 * This one is PR-SCTP AND buffer space
6700 * limited type
6701 */
6702 if (chk->reccxx . . $ sctp_tmit_chunk#rec..datacxx . . $ sctp_tmit_chunk#$anonymous_type_3#data..timetodropcxx . . $ sctp_data_chunkrec#timetodrop..tv_seccxx . . $ timeval#tv_sec. > (long)srcv->sinfo_timetolive) {
6703 /*
6704 * Lower numbers equates to higher
6705 * priority. So if the one we are
6706 * looking at has a larger priority,
6707 * we want to drop the data and NOT
6708 * retransmit it.
6709 */
6710 if (chk->datacxx . . $ sctp_tmit_chunk#data.) {
6711 /*
6712 * We release the book_size
6713 * if the mbuf is here
6714 */
6715 int ret_spc;
6716 uint8_tcxx . . $ uint8_t# sent;
6717
6718 if (chk->sentcxx . . $ sctp_tmit_chunk#sent. > SCTP_DATAGRAM_UNSENTcxx . . $ `usrsctplib/netinet/sctp_constants.h:353:9`!)
6719 sent = 1;
6720 else
6721 sent = 0;
6722 ret_spc = sctp_release_pr_sctp_chunkcxx . . $ sctp_release_pr_sctp_chunk(89d0e2781945948e).(stcb, chk,
6723 sent,
6724 SCTP_SO_LOCKEDcxx . . $ `usrsctplib/netinet/sctp_constants.h:963:9`!);
6725 freed_spc += ret_spc;
6726 if (freed_spc >= dataout) {
6727 return;
6728 }
6729 } /* if chunk was present */
6730 } /* if of sufficient priority */
6731 } /* if chunk has enabled */
6732 } /* tailqforeach */
6733
6734 TAILQ_FOREACH_SAFEcxx . . $ `usrsctplib/netinet/sctp_os_userspace.h:1109:9`!(chk, &asoc->send_queue, sctp_next, nchk) {
6735 /* Here we must move to the sent queue and mark */
6736 if (PR_SCTP_BUF_ENABLEDcxx . . $ `./netinet/sctp_uio.h:289:9`!(chk->flags)) {
6737 if (chk->reccxx . . $ sctp_tmit_chunk#rec..datacxx . . $ sctp_tmit_chunk#$anonymous_type_3#data..timetodropcxx . . $ sctp_data_chunkrec#timetodrop..tv_seccxx . . $ timeval#tv_sec. > (long)srcv->sinfo_timetolive) {
6738 if (chk->datacxx . . $ sctp_tmit_chunk#data.) {
6739 /*
6740 * We release the book_size
6741 * if the mbuf is here
6742 */
6743 int ret_spc;
6744
6745 ret_spc = sctp_release_pr_sctp_chunkcxx . . $ sctp_release_pr_sctp_chunk(89d0e2781945948e).(stcb, chk,
6746 0, SCTP_SO_LOCKEDcxx . . $ `usrsctplib/netinet/sctp_constants.h:963:9`!);
6747
6748 freed_spc += ret_spc;
6749 if (freed_spc >= dataout) {
6750 return;
6751 }
6752 } /* end if chk->data */
6753 } /* end if right class */
6754 } /* end if chk pr-sctp */
6755 } /* tailqforeachsafe (chk) */
6756 } /* if enabled in asoc */
6757 }
6758
6759 int
6760 sctp_get_frag_pointcxx . . $ sctp_get_frag_point(527fbf6e26d2907d).(struct sctp_tcbcxx . . $ sctp_tcb# *stcb,
6761 struct sctp_associationcxx . . $ sctp_association# *asoc)
6762 {
6763 int siz, ovh;
6764
6765 /*
6766 * For endpoints that have both v6 and v4 addresses we must reserve
6767 * room for the ipv6 header, for those that are only dealing with V4
6768 * we use a larger frag point.
6769 */
6770 if (stcb->sctp_epcxx . . $ sctp_tcb#sctp_ep.->sctp_flagscxx . . $ sctp_inpcb#sctp_flags. & SCTP_PCB_FLAGS_BOUND_V6cxx . . $ `usrsctplib/netinet/sctp.h:539:9`!) {
6771 ovh = SCTP_MIN_OVERHEADcxx . . $ `usrsctplib/netinet/sctp_header.h:561:9`!;
6772 } else {
6773 #if defined(__Userspace__cxx . . $ `<built-in>:442:9`!)
6774 if (stcb->sctp_epcxx . . $ sctp_tcb#sctp_ep.->sctp_flagscxx . . $ sctp_inpcb#sctp_flags. & SCTP_PCB_FLAGS_BOUND_CONNcxx . . $ `usrsctplib/netinet/sctp.h:545:9`!) {
6775 ovh = sizeof(struct sctphdrcxx . . $ sctphdr#);
6776 } else {
6777 ovh = SCTP_MIN_V4_OVERHEADcxx . . $ `usrsctplib/netinet/sctp_header.h:585:9`!;
6778 }
6779 #else
6780 ovh = SCTP_MIN_V4_OVERHEAD;
6781 #endif
6782 }
6783 ovh += SCTP_DATA_CHUNK_OVERHEADcxx . . $ `usrsctplib/netinet/sctp_output.h:137:9`!(stcb);
6784 if (stcb->asoccxx . . $ sctp_tcb#asoc..sctp_frag_pointcxx . . $ sctp_association#sctp_frag_point. > asoc->smallest_mtucxx . . $ sctp_association#smallest_mtu.)
6785 siz = asoc->smallest_mtucxx . . $ sctp_association#smallest_mtu. - ovh;
6786 else
6787 siz = (stcb->asoccxx . . $ sctp_tcb#asoc..sctp_frag_pointcxx . . $ sctp_association#sctp_frag_point. - ovh);
6788 /*
6789 * if (siz > (MCLBYTES-sizeof(struct sctp_data_chunk))) {
6790 */
6791 /* A data chunk MUST fit in a cluster */
6792 /* siz = (MCLBYTES - sizeof(struct sctp_data_chunk)); */
6793 /* } */
6794
6795 /* adjust for an AUTH chunk if DATA requires auth */
6796 if (sctp_auth_is_required_chunkcxx . . $ `usrsctplib/netinet/sctp_auth.h:105:9`!(SCTP_DATAcxx . . $ `usrsctplib/netinet/sctp.h:449:9`!, stcb->asoc.peer_auth_chunks))
6797 siz -= sctp_get_auth_chunk_lencxx . . $ sctp_get_auth_chunk_len(909d59720f161188).(stcb->asoccxx . . $ sctp_tcb#asoc..peer_hmac_idcxx . . $ sctp_association#peer_hmac_id.);
6798
6799 if (siz % 4) {
6800 /* make it an even word boundary please */
6801 siz -= (siz % 4);
6802 }
6803 return (siz);
6804 }
6805
6806 static void
6807 sctp_set_prsctp_policycxx . . $ sctp_set_prsctp_policy(d559ce077b2531c0).(struct sctp_stream_queue_pendingcxx . . $ sctp_stream_queue_pending# *sp)
6808 {
6809 /*
6810 * We assume that the user wants PR_SCTP_TTL if the user
6811 * provides a positive lifetime but does not specify any
6812 * PR_SCTP policy.
6813 */
6814 if (PR_SCTP_ENABLEDcxx . . $ `./netinet/sctp_uio.h:286:9`!(sp->sinfo_flags)) {
6815 sp->act_flagscxx . . $ sctp_stream_queue_pending#act_flags. |= PR_SCTP_POLICYcxx . . $ `./netinet/sctp_uio.h:285:9`!(sp->sinfo_flags);
6816 } else if (sp->timetolivecxx . . $ sctp_stream_queue_pending#timetolive. > 0) {
6817 sp->sinfo_flagscxx . . $ sctp_stream_queue_pending#sinfo_flags. |= SCTP_PR_SCTP_TTLcxx . . $ `./netinet/sctp_uio.h:278:9`!;
6818 sp->act_flagscxx . . $ sctp_stream_queue_pending#act_flags. |= PR_SCTP_POLICYcxx . . $ `./netinet/sctp_uio.h:285:9`!(sp->sinfo_flags);
6819 } else {
6820 return;
6821 }
6822 switch (PR_SCTP_POLICYcxx . . $ `./netinet/sctp_uio.h:285:9`!(sp->sinfo_flags)) {
6823 case CHUNK_FLAGS_PR_SCTP_BUFcxx . . $ `usrsctplib/netinet/sctp_structs.h:462:9`!:
6824 /*
6825 * Time to live is a priority stored in tv_sec when
6826 * doing the buffer drop thing.
6827 */
6828 sp->tscxx . . $ sctp_stream_queue_pending#ts..tv_seccxx . . $ timeval#tv_sec. = sp->timetolivecxx . . $ sctp_stream_queue_pending#timetolive.;
6829 sp->tscxx . . $ sctp_stream_queue_pending#ts..tv_useccxx . . $ timeval#tv_usec. = 0;
6830 break;
6831 case CHUNK_FLAGS_PR_SCTP_TTLcxx . . $ `usrsctplib/netinet/sctp_structs.h:461:9`!:
6832 {
6833 struct timevalcxx . . $ timeval# tv;
6834 (void)SCTP_GETTIME_TIMEVALcxx . . $ `usrsctplib/netinet/sctp_constants.h:995:9`!(&sp->ts);
6835 tv.tv_seccxx . . $ timeval#tv_sec. = sp->timetolivecxx . . $ sctp_stream_queue_pending#timetolive. / 1000;
6836 tv.tv_useccxx . . $ timeval#tv_usec. = (sp->timetolivecxx . . $ sctp_stream_queue_pending#timetolive. * 1000) % 1000000;
6837 /* TODO sctp_constants.h needs alternative time macros when
6838 * _KERNEL is undefined.
6839 */
6840 #if !(defined(__FreeBSD__) && !defined(__Userspace__cxx . . $ `<built-in>:442:9`!))
6841 timeraddcxx . . $ `<external>/8057359269225398204/time.h:237:10`!(&sp->ts, &tv, &sp->ts);
6842 #else
6843 timevaladd(&sp->ts, &tv);
6844 #endif
6845 }
6846 break;
6847 case CHUNK_FLAGS_PR_SCTP_RTXcxx . . $ `usrsctplib/netinet/sctp_structs.h:463:9`!:
6848 /*
6849 * Time to live is a the number or retransmissions
6850 * stored in tv_sec.
6851 */
6852 sp->tscxx . . $ sctp_stream_queue_pending#ts..tv_seccxx . . $ timeval#tv_sec. = sp->timetolivecxx . . $ sctp_stream_queue_pending#timetolive.;
6853 sp->tscxx . . $ sctp_stream_queue_pending#ts..tv_useccxx . . $ timeval#tv_usec. = 0;
6854 break;
6855 default:
6856 SCTPDBGcxx . . $ `usrsctplib/netinet/sctp_os_userspace.h:591:9`!(SCTP_DEBUG_USRREQ1cxx . . $ `usrsctplib/netinet/sctp_constants.h:667:9`!,
6857 "Unknown PR_SCTP policy %u.\n",
6858 PR_SCTP_POLICYcxx . . $ `./netinet/sctp_uio.h:285:9`!(sp->sinfo_flags));
6859 break;
6860 }
6861 }
6862
6863 static int
6864 sctp_msg_appendcxx . . $ sctp_msg_append(fe525a3a5cc14699).(struct sctp_tcbcxx . . $ sctp_tcb# *stcb,
6865 struct sctp_netscxx . . $ sctp_nets# *net,
6866 struct mbufcxx . . $ mbuf# *m,
6867 struct sctp_sndrcvinfo *srcv, int hold_stcb_lock)
6868 {
6869 int error = 0;
6870 struct mbufcxx . . $ mbuf# *at;
6871 struct sctp_stream_queue_pendingcxx . . $ sctp_stream_queue_pending# *sp = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!;
6872 struct sctp_stream_outcxx . . $ sctp_stream_out# *strm;
6873
6874 /* Given an mbuf chain, put it
6875 * into the association send queue and
6876 * place it on the wheel
6877 */
6878 if (srcv->sinfo_stream >= stcb->asoccxx . . $ sctp_tcb#asoc..streamoutcntcxx . . $ sctp_association#streamoutcnt.) {
6879 /* Invalid stream number */
6880 SCTP_LTRACE_ERR_RET_PKTcxx . . $ `usrsctplib/netinet/sctp_os_userspace.h:628:9`!(m, NULL, stcb, net, SCTP_FROM_SCTP_OUTPUT, EINVAL);
6881 error = EINVALcxx . . $ `<external>/8987895939074593727/errno-base.h:26:9`!;
6882 goto out_now;
6883 }
6884 if ((stcb->asoccxx . . $ sctp_tcb#asoc..stream_lockedcxx . . $ sctp_association#stream_locked.) &&
6885 (stcb->asoccxx . . $ sctp_tcb#asoc..stream_locked_oncxx . . $ sctp_association#stream_locked_on. != srcv->sinfo_stream)) {
6886 SCTP_LTRACE_ERR_RET_PKTcxx . . $ `usrsctplib/netinet/sctp_os_userspace.h:628:9`!(m, NULL, stcb, net, SCTP_FROM_SCTP_OUTPUT, EINVAL);
6887 error = EINVALcxx . . $ `<external>/8987895939074593727/errno-base.h:26:9`!;
6888 goto out_now;
6889 }
6890 strm = &stcb->asoccxx . . $ sctp_tcb#asoc..strmoutcxx . . $ sctp_association#strmout.[srcv->sinfo_stream];
6891 /* Now can we send this? */
6892 if ((SCTP_GET_STATEcxx . . $ `usrsctplib/netinet/sctp_constants.h:476:9`!(stcb) == SCTP_STATE_SHUTDOWN_SENTcxx . . $ `usrsctplib/netinet/sctp_constants.h:465:9`!) ||
6893 (SCTP_GET_STATEcxx . . $ `usrsctplib/netinet/sctp_constants.h:476:9`!(stcb) == SCTP_STATE_SHUTDOWN_ACK_SENTcxx . . $ `usrsctplib/netinet/sctp_constants.h:467:9`!) ||
6894 (SCTP_GET_STATEcxx . . $ `usrsctplib/netinet/sctp_constants.h:476:9`!(stcb) == SCTP_STATE_SHUTDOWN_RECEIVEDcxx . . $ `usrsctplib/netinet/sctp_constants.h:466:9`!) ||
6895 (stcb->asoccxx . . $ sctp_tcb#asoc..statecxx . . $ sctp_association#state. & SCTP_STATE_SHUTDOWN_PENDINGcxx . . $ `usrsctplib/netinet/sctp_constants.h:468:9`!)) {
6896 /* got data while shutting down */
6897 SCTP_LTRACE_ERR_RETcxx . . $ `usrsctplib/netinet/sctp_os_userspace.h:629:9`!(NULL, stcb, NULL, SCTP_FROM_SCTP_OUTPUT, ECONNRESET);
6898 error = ECONNRESETcxx . . $ `<external>/17922322188510340118/errno.h:88:9`!;
6899 goto out_now;
6900 }
6901 sctp_alloc_a_strmoqcxx . . $ `usrsctplib/netinet/sctp_var.h:135:9`!(stcb, sp);
6902 if (sp == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!) {
6903 SCTP_LTRACE_ERR_RETcxx . . $ `usrsctplib/netinet/sctp_os_userspace.h:629:9`!(NULL, stcb, NULL, SCTP_FROM_SCTP_OUTPUT, ENOMEM);
6904 error = ENOMEMcxx . . $ `<external>/8987895939074593727/errno-base.h:16:9`!;
6905 goto out_now;
6906 }
6907 sp->sinfo_flagscxx . . $ sctp_stream_queue_pending#sinfo_flags. = srcv->sinfo_flags;
6908 sp->timetolivecxx . . $ sctp_stream_queue_pending#timetolive. = srcv->sinfo_timetolive;
6909 sp->ppidcxx . . $ sctp_stream_queue_pending#ppid. = srcv->sinfo_ppid;
6910 sp->contextcxx . . $ sctp_stream_queue_pending#context. = srcv->sinfo_context;
6911 sp->fsncxx . . $ sctp_stream_queue_pending#fsn. = 0;
6912 if (sp->sinfo_flagscxx . . $ sctp_stream_queue_pending#sinfo_flags. & SCTP_ADDR_OVERcxx . . $ `./netinet/sctp_uio.h:265:9`!) {
6913 sp->netcxx . . $ sctp_stream_queue_pending#net. = net;
6914 atomic_add_intcxx . . $ `usrsctplib/user_atomic.h:94:9`!(&sp->net->ref_count, 1);
6915 } else {
6916 sp->netcxx . . $ sctp_stream_queue_pending#net. = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!;
6917 }
6918 (void)SCTP_GETTIME_TIMEVALcxx . . $ `usrsctplib/netinet/sctp_constants.h:995:9`!(&sp->ts);
6919 sp->sidcxx . . $ sctp_stream_queue_pending#sid. = srcv->sinfo_stream;
6920 sp->msg_is_completecxx . . $ sctp_stream_queue_pending#msg_is_complete. = 1;
6921 sp->sender_all_donecxx . . $ sctp_stream_queue_pending#sender_all_done. = 1;
6922 sp->some_takencxx . . $ sctp_stream_queue_pending#some_taken. = 0;
6923 sp->datacxx . . $ sctp_stream_queue_pending#data. = m;
6924 sp->tail_mbufcxx . . $ sctp_stream_queue_pending#tail_mbuf. = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!;
6925 sctp_set_prsctp_policycxx . . $ sctp_set_prsctp_policy(d559ce077b2531c0).(sp);
6926 /* We could in theory (for sendall) sifa the length
6927 * in, but we would still have to hunt through the
6928 * chain since we need to setup the tail_mbuf
6929 */
6930 sp->lengthcxx . . $ sctp_stream_queue_pending#length. = 0;
6931 for (at = m; at; at = SCTP_BUF_NEXTcxx . . $ `usrsctplib/netinet/sctp_os_userspace.h:791:9`!(at)) {
6932 if (SCTP_BUF_NEXTcxx . . $ `usrsctplib/netinet/sctp_os_userspace.h:791:9`!(at) == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!)
6933 sp->tail_mbufcxx . . $ sctp_stream_queue_pending#tail_mbuf. = at;
6934 sp->lengthcxx . . $ sctp_stream_queue_pending#length. += SCTP_BUF_LENcxx . . $ `usrsctplib/netinet/sctp_os_userspace.h:790:9`!(at);
6935 }
6936 if (srcv->sinfo_keynumber_valid) {
6937 sp->auth_keyidcxx . . $ sctp_stream_queue_pending#auth_keyid. = srcv->sinfo_keynumber;
6938 } else {
6939 sp->auth_keyidcxx . . $ sctp_stream_queue_pending#auth_keyid. = stcb->asoccxx . . $ sctp_tcb#asoc..authinfocxx . . $ sctp_association#authinfo..active_keyidcxx . . $ sctp_authinformation#active_keyid.;
6940 }
6941 if (sctp_auth_is_required_chunkcxx . . $ `usrsctplib/netinet/sctp_auth.h:105:9`!(SCTP_DATAcxx . . $ `usrsctplib/netinet/sctp.h:449:9`!, stcb->asoc.peer_auth_chunks)) {
6942 sctp_auth_key_acquirecxx . . $ sctp_auth_key_acquire(f17400a79897d6ee).(stcb, sp->auth_keyidcxx . . $ sctp_stream_queue_pending#auth_keyid.);
6943 sp->holds_key_refcxx . . $ sctp_stream_queue_pending#holds_key_ref. = 1;
6944 }
6945 if (hold_stcb_lock == 0) {
6946 SCTP_TCB_SEND_LOCKcxx . . $ `usrsctplib/netinet/sctp_process_lock.h:403:9`!(stcb);
6947 }
6948 sctp_snd_sb_alloccxx . . $ `usrsctplib/netinet/sctputil.h:327:9`!(stcb, sp->length);
6949 atomic_add_intcxx . . $ `usrsctplib/user_atomic.h:94:9`!(&stcb->asoc.stream_queue_cnt, 1);
6950 TAILQ_INSERT_TAILcxx . . $ `<external>/2546723208511035544/queue.h:402:9`!(&strm->outqueue, sp, next);
6951 stcb->asoccxx . . $ sctp_tcb#asoc..ss_functionscxx . . $ sctp_association#ss_functions..sctp_ss_add_to_streamcxx . . $ sctp_ss_functions#sctp_ss_add_to_stream.(stcb, &stcb->asoccxx . . $ sctp_tcb#asoc., strm, sp, 1);
6952 m = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!;
6953 if (hold_stcb_lock == 0) {
6954 SCTP_TCB_SEND_UNLOCKcxx . . $ `usrsctplib/netinet/sctp_process_lock.h:405:9`!(stcb);
6955 }
6956 out_now:
6957 if (m) {
6958 sctp_m_freemcxx . . $ `usrsctplib/netinet/sctputil.h:57:9`!(m);
6959 }
6960 return (error);
6961 }
6962
6963 static struct mbufcxx . . $ mbuf# *
6964 sctp_copy_mbufchaincxx . . $ sctp_copy_mbufchain(161b07f3a70427c7).(struct mbufcxx . . $ mbuf# *clonechain,
6965 struct mbufcxx . . $ mbuf# *outchain,
6966 struct mbufcxx . . $ mbuf# **endofchain,
6967 int can_take_mbuf,
6968 int sizeofcpy,
6969 uint8_tcxx . . $ uint8_t# copy_by_ref)
6970 {
6971 struct mbufcxx . . $ mbuf# *m;
6972 struct mbufcxx . . $ mbuf# *appendchain;
6973 caddr_tcxx . . $ caddr_t# cp;
6974 int len;
6975
6976 if (endofchain == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!) {
6977 /* error */
6978 error_out:
6979 if (outchain)
6980 sctp_m_freemcxx . . $ `usrsctplib/netinet/sctputil.h:57:9`!(outchain);
6981 return (NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!);
6982 }
6983 if (can_take_mbuf) {
6984 appendchain = clonechain;
6985 } else {
6986 if (!copy_by_ref &&
6987 (sizeofcpy <= (int)((((SCTP_BASE_SYSCTLcxx . . $ `usrsctplib/netinet/sctp_os_userspace.h:579:9`!(sctp_mbuf_threshold_count) - 1) * MLENcxx . . $ `usrsctplib/user_mbuf.h:140:9`!) + MHLENcxx . . $ `usrsctplib/user_mbuf.h:141:9`!)))) {
6988 /* Its not in a cluster */
6989 if (*endofchain == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!) {
6990 /* lets get a mbuf cluster */
6991 if (outchain == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!) {
6992 /* This is the general case */
6993 new_mbuf:
6994 outchain = sctp_get_mbuf_for_msgcxx . . $ sctp_get_mbuf_for_msg(c7c30fc329598377).(MCLBYTEScxx . . $ `usrsctplib/user_mbuf.h:51:9`!, 0, M_NOWAITcxx . . $ `usrsctplib/user_malloc.h:60:9`!, 1, MT_HEADERcxx . . $ `usrsctplib/user_mbuf.h:290:9`!);
6995 if (outchain == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!) {
6996 goto error_out;
6997 }
6998 SCTP_BUF_LENcxx . . $ `usrsctplib/netinet/sctp_os_userspace.h:790:9`!(outchain) = 0;
6999 *endofchain = outchain;
7000 /* get the prepend space */
7001 SCTP_BUF_RESV_UFcxx . . $ `usrsctplib/netinet/sctp_os_userspace.h:793:9`!(outchain, (SCTP_FIRST_MBUF_RESVcxx . . $ `usrsctplib/netinet/sctp_constants.h:351:9`!+4));
7002 } else {
7003 /* We really should not get a NULL in endofchain */
7004 /* find end */
7005 m = outchain;
7006 while (m) {
7007 if (SCTP_BUF_NEXTcxx . . $ `usrsctplib/netinet/sctp_os_userspace.h:791:9`!(m) == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!) {
7008 *endofchain = m;
7009 break;
7010 }
7011 m = SCTP_BUF_NEXTcxx . . $ `usrsctplib/netinet/sctp_os_userspace.h:791:9`!(m);
7012 }
7013 /* sanity */
7014 if (*endofchain == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!) {
7015 /* huh, TSNH XXX maybe we should panic */
7016 sctp_m_freemcxx . . $ `usrsctplib/netinet/sctputil.h:57:9`!(outchain);
7017 goto new_mbuf;
7018 }
7019 }
7020 /* get the new end of length */
7021 len = (int)M_TRAILINGSPACEcxx . . $ `usrsctplib/user_mbuf.h:355:9`!(*endofchain);
7022 } else {
7023 /* how much is left at the end? */
7024 len = (int)M_TRAILINGSPACEcxx . . $ `usrsctplib/user_mbuf.h:355:9`!(*endofchain);
7025 }
7026 /* Find the end of the data, for appending */
7027 cp = (mtodcxx . . $ `usrsctplib/user_mbuf.h:96:9`!((*endofchain), caddr_t) + SCTP_BUF_LENcxx . . $ `usrsctplib/netinet/sctp_os_userspace.h:790:9`!((*endofchain)));
7028
7029 /* Now lets copy it out */
7030 if (len >= sizeofcpy) {
7031 /* It all fits, copy it in */
7032 m_copydatacxx . . $ m_copydata(fee92403c79d6892).(clonechain, 0, sizeofcpy, cp);
7033 SCTP_BUF_LENcxx . . $ `usrsctplib/netinet/sctp_os_userspace.h:790:9`!((*endofchain)) += sizeofcpy;
7034 } else {
7035 /* fill up the end of the chain */
7036 if (len > 0) {
7037 m_copydatacxx . . $ m_copydata(fee92403c79d6892).(clonechain, 0, len, cp);
7038 SCTP_BUF_LENcxx . . $ `usrsctplib/netinet/sctp_os_userspace.h:790:9`!((*endofchain)) += len;
7039 /* now we need another one */
7040 sizeofcpy -= len;
7041 }
7042 m = sctp_get_mbuf_for_msgcxx . . $ sctp_get_mbuf_for_msg(c7c30fc329598377).(MCLBYTEScxx . . $ `usrsctplib/user_mbuf.h:51:9`!, 0, M_NOWAITcxx . . $ `usrsctplib/user_malloc.h:60:9`!, 1, MT_HEADERcxx . . $ `usrsctplib/user_mbuf.h:290:9`!);
7043 if (m == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!) {
7044 /* We failed */
7045 goto error_out;
7046 }
7047 SCTP_BUF_NEXTcxx . . $ `usrsctplib/netinet/sctp_os_userspace.h:791:9`!((*endofchain)) = m;
7048 *endofchain = m;
7049 cp = mtodcxx . . $ `usrsctplib/user_mbuf.h:96:9`!((*endofchain), caddr_t);
7050 m_copydatacxx . . $ m_copydata(fee92403c79d6892).(clonechain, len, sizeofcpy, cp);
7051 SCTP_BUF_LENcxx . . $ `usrsctplib/netinet/sctp_os_userspace.h:790:9`!((*endofchain)) += sizeofcpy;
7052 }
7053 return (outchain);
7054 } else {
7055 /* copy the old fashion way */
7056 appendchain = SCTP_M_COPYMcxx . . $ `usrsctplib/netinet/sctp_os_userspace.h:759:9`!(clonechain, 0, M_COPYALLcxx . . $ `usrsctplib/user_mbuf.h:75:9`!, M_NOWAITcxx . . $ `usrsctplib/user_malloc.h:60:9`!);
7057 #ifdef SCTP_MBUF_LOGGING
7058 if (SCTP_BASE_SYSCTL(sctp_logging_level) & SCTP_MBUF_LOGGING_ENABLE) {
7059 sctp_log_mbc(appendchain, SCTP_MBUF_ICOPY);
7060 }
7061 #endif
7062 }
7063 }
7064 if (appendchain == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!) {
7065 /* error */
7066 if (outchain)
7067 sctp_m_freemcxx . . $ `usrsctplib/netinet/sctputil.h:57:9`!(outchain);
7068 return (NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!);
7069 }
7070 if (outchain) {
7071 /* tack on to the end */
7072 if (*endofchain != NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!) {
7073 SCTP_BUF_NEXTcxx . . $ `usrsctplib/netinet/sctp_os_userspace.h:791:9`!(((*endofchain))) = appendchain;
7074 } else {
7075 m = outchain;
7076 while (m) {
7077 if (SCTP_BUF_NEXTcxx . . $ `usrsctplib/netinet/sctp_os_userspace.h:791:9`!(m) == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!) {
7078 SCTP_BUF_NEXTcxx . . $ `usrsctplib/netinet/sctp_os_userspace.h:791:9`!(m) = appendchain;
7079 break;
7080 }
7081 m = SCTP_BUF_NEXTcxx . . $ `usrsctplib/netinet/sctp_os_userspace.h:791:9`!(m);
7082 }
7083 }
7084 /*
7085 * save off the end and update the end-chain
7086 * position
7087 */
7088 m = appendchain;
7089 while (m) {
7090 if (SCTP_BUF_NEXTcxx . . $ `usrsctplib/netinet/sctp_os_userspace.h:791:9`!(m) == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!) {
7091 *endofchain = m;
7092 break;
7093 }
7094 m = SCTP_BUF_NEXTcxx . . $ `usrsctplib/netinet/sctp_os_userspace.h:791:9`!(m);
7095 }
7096 return (outchain);
7097 } else {
7098 /* save off the end and update the end-chain position */
7099 m = appendchain;
7100 while (m) {
7101 if (SCTP_BUF_NEXTcxx . . $ `usrsctplib/netinet/sctp_os_userspace.h:791:9`!(m) == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!) {
7102 *endofchain = m;
7103 break;
7104 }
7105 m = SCTP_BUF_NEXTcxx . . $ `usrsctplib/netinet/sctp_os_userspace.h:791:9`!(m);
7106 }
7107 return (appendchain);
7108 }
7109 }
7110
7111 static int
7112 sctp_med_chunk_outputcxx . . $ sctp_med_chunk_output(ae2c5cc94a0e278d).(struct sctp_inpcbcxx . . $ sctp_inpcb# *inp,
7113 struct sctp_tcbcxx . . $ sctp_tcb# *stcb,
7114 struct sctp_associationcxx . . $ sctp_association# *asoc,
7115 int *num_out,
7116 int *reason_code,
7117 int control_only, int from_where,
7118 struct timevalcxx . . $ timeval# *now, int *now_filled, int frag_point, int so_locked);
7119
7120 static void
7121 sctp_sendall_iteratorcxx . . $ sctp_sendall_iterator(3f64057379ebb9ec).(struct sctp_inpcbcxx . . $ sctp_inpcb# *inp, struct sctp_tcbcxx . . $ sctp_tcb# *stcb, void *ptr,
7122 uint32_tcxx . . $ uint32_t# val SCTP_UNUSEDcxx . . $ `usrsctplib/netinet/sctp_os_userspace.h:780:9`!)
7123 {
7124 struct sctp_copy_allcxx . . $ sctp_copy_all# *ca;
7125 struct mbufcxx . . $ mbuf# *m;
7126 int ret = 0;
7127 int added_control = 0;
7128 int un_sent, do_chunk_output = 1;
7129 struct sctp_associationcxx . . $ sctp_association# *asoc;
7130 struct sctp_netscxx . . $ sctp_nets# *net;
7131
7132 ca = (struct sctp_copy_allcxx . . $ sctp_copy_all# *)ptr;
7133 if (ca->mcxx . . $ sctp_copy_all#m. == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!) {
7134 return;
7135 }
7136 if (ca->inpcxx . . $ sctp_copy_all#inp. != inp) {
7137 /* TSNH */
7138 return;
7139 }
7140 if (ca->sndlencxx . . $ sctp_copy_all#sndlen. > 0) {
7141 m = SCTP_M_COPYMcxx . . $ `usrsctplib/netinet/sctp_os_userspace.h:759:9`!(ca->mcxx . . $ sctp_copy_all#m., 0, M_COPYALLcxx . . $ `usrsctplib/user_mbuf.h:75:9`!, M_NOWAITcxx . . $ `usrsctplib/user_malloc.h:60:9`!);
7142 if (m == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!) {
7143 /* can't copy so we are done */
7144 ca->cnt_failedcxx . . $ sctp_copy_all#cnt_failed.++;
7145 return;
7146 }
7147 #ifdef SCTP_MBUF_LOGGING
7148 if (SCTP_BASE_SYSCTL(sctp_logging_level) & SCTP_MBUF_LOGGING_ENABLE) {
7149 sctp_log_mbc(m, SCTP_MBUF_ICOPY);
7150 }
7151 #endif
7152 } else {
7153 m = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!;
7154 }
7155 SCTP_TCB_LOCK_ASSERTcxx . . $ `usrsctplib/netinet/sctp_process_lock.h:478:9`!(stcb);
7156 if (stcb->asoccxx . . $ sctp_tcb#asoc..alternatecxx . . $ sctp_association#alternate.) {
7157 net = stcb->asoccxx . . $ sctp_tcb#asoc..alternatecxx . . $ sctp_association#alternate.;
7158 } else {
7159 net = stcb->asoccxx . . $ sctp_tcb#asoc..primary_destinationcxx . . $ sctp_association#primary_destination.;
7160 }
7161 if (ca->sndrcvcxx . . $ sctp_copy_all#sndrcv..sinfo_flags & SCTP_ABORTcxx . . $ `./netinet/sctp_uio.h:263:9`!) {
7162 /* Abort this assoc with m as the user defined reason */
7163 if (m != NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!) {
7164 SCTP_BUF_PREPENDcxx . . $ `usrsctplib/netinet/sctp_os_userspace.h:799:9`!(m, sizeof(struct sctp_paramhdr), M_NOWAITcxx . . $ `usrsctplib/user_malloc.h:60:9`!);
7165 } else {
7166 m = sctp_get_mbuf_for_msgcxx . . $ sctp_get_mbuf_for_msg(c7c30fc329598377).(sizeof(struct sctp_paramhdrcxx . . $ sctp_paramhdr#),
7167 0, M_NOWAITcxx . . $ `usrsctplib/user_malloc.h:60:9`!, 1, MT_DATAcxx . . $ `usrsctplib/user_mbuf.h:289:9`!);
7168 SCTP_BUF_LENcxx . . $ `usrsctplib/netinet/sctp_os_userspace.h:790:9`!(m) = sizeof(struct sctp_paramhdrcxx . . $ sctp_paramhdr#);
7169 }
7170 if (m != NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!) {
7171 struct sctp_paramhdrcxx . . $ sctp_paramhdr# *ph;
7172
7173 ph = mtodcxx . . $ `usrsctplib/user_mbuf.h:96:9`!(m, struct sctp_paramhdr *);
7174 ph->param_typecxx . . $ sctp_paramhdr#param_type. = htonscxx . . $ htons(a18c05e4017afb3d).(SCTP_CAUSE_USER_INITIATED_ABTcxx . . $ `usrsctplib/netinet/sctp.h:372:9`!);
7175 ph->param_lengthcxx . . $ sctp_paramhdr#param_length. = htonscxx . . $ htons(a18c05e4017afb3d).((uint16_tcxx . . $ uint16_t#)(sizeof(struct sctp_paramhdrcxx . . $ sctp_paramhdr#) + ca->sndlencxx . . $ sctp_copy_all#sndlen.));
7176 }
7177 /* We add one here to keep the assoc from
7178 * dis-appearing on us.
7179 */
7180 atomic_add_intcxx . . $ `usrsctplib/user_atomic.h:94:9`!(&stcb->asoc.refcnt, 1);
7181 sctp_abort_an_associationcxx . . $ sctp_abort_an_association(2bef2660eefb26cd).(inp, stcb, m, SCTP_SO_NOT_LOCKEDcxx . . $ `usrsctplib/netinet/sctp_constants.h:964:9`!);
7182 /* sctp_abort_an_association calls sctp_free_asoc()
7183 * free association will NOT free it since we
7184 * incremented the refcnt .. we do this to prevent
7185 * it being freed and things getting tricky since
7186 * we could end up (from free_asoc) calling inpcb_free
7187 * which would get a recursive lock call to the
7188 * iterator lock.. But as a consequence of that the
7189 * stcb will return to us un-locked.. since free_asoc
7190 * returns with either no TCB or the TCB unlocked, we
7191 * must relock.. to unlock in the iterator timer :-0
7192 */
7193 SCTP_TCB_LOCKcxx . . $ `usrsctplib/netinet/sctp_process_lock.h:473:9`!(stcb);
7194 atomic_add_intcxx . . $ `usrsctplib/user_atomic.h:94:9`!(&stcb->asoc.refcnt, -1);
7195 goto no_chunk_output;
7196 } else {
7197 if (m) {
7198 ret = sctp_msg_appendcxx . . $ sctp_msg_append(fe525a3a5cc14699).(stcb, net, m,
7199 &ca->sndrcvcxx . . $ sctp_copy_all#sndrcv., 1);
7200 }
7201 asoc = &stcb->asoccxx . . $ sctp_tcb#asoc.;
7202 if (ca->sndrcvcxx . . $ sctp_copy_all#sndrcv..sinfo_flags & SCTP_EOFcxx . . $ `./netinet/sctp_uio.h:262:9`!) {
7203 /* shutdown this assoc */
7204 if (TAILQ_EMPTYcxx . . $ `<external>/2546723208511035544/queue.h:457:9`!(&asoc->send_queue) &&
7205 TAILQ_EMPTYcxx . . $ `<external>/2546723208511035544/queue.h:457:9`!(&asoc->sent_queue) &&
7206 sctp_is_there_unsent_datacxx . . $ sctp_is_there_unsent_data(ac3aa47b47eaac09).(stcb, SCTP_SO_NOT_LOCKEDcxx . . $ `usrsctplib/netinet/sctp_constants.h:964:9`!) == 0) {
7207 if ((*asoc->ss_functionscxx . . $ sctp_association#ss_functions..sctp_ss_is_user_msgs_incompletecxx . . $ sctp_ss_functions#sctp_ss_is_user_msgs_incomplete.)(stcb, asoc)) {
7208 goto abort_anyway;
7209 }
7210 /* there is nothing queued to send, so I'm done... */
7211 if ((SCTP_GET_STATEcxx . . $ `usrsctplib/netinet/sctp_constants.h:476:9`!(stcb) != SCTP_STATE_SHUTDOWN_SENTcxx . . $ `usrsctplib/netinet/sctp_constants.h:465:9`!) &&
7212 (SCTP_GET_STATEcxx . . $ `usrsctplib/netinet/sctp_constants.h:476:9`!(stcb) != SCTP_STATE_SHUTDOWN_RECEIVEDcxx . . $ `usrsctplib/netinet/sctp_constants.h:466:9`!) &&
7213 (SCTP_GET_STATEcxx . . $ `usrsctplib/netinet/sctp_constants.h:476:9`!(stcb) != SCTP_STATE_SHUTDOWN_ACK_SENTcxx . . $ `usrsctplib/netinet/sctp_constants.h:467:9`!)) {
7214 /* only send SHUTDOWN the first time through */
7215 if (SCTP_GET_STATEcxx . . $ `usrsctplib/netinet/sctp_constants.h:476:9`!(stcb) == SCTP_STATE_OPENcxx . . $ `usrsctplib/netinet/sctp_constants.h:464:9`!) {
7216 SCTP_STAT_DECR_GAUGE32cxx . . $ `./netinet/sctp_uio.h:1131:9`!(sctps_currestab);
7217 }
7218 SCTP_SET_STATEcxx . . $ `usrsctplib/netinet/sctp_constants.h:478:9`!(stcb, SCTP_STATE_SHUTDOWN_SENTcxx . . $ `usrsctplib/netinet/sctp_constants.h:465:9`!);
7219 sctp_stop_timers_for_shutdowncxx . . $ sctp_stop_timers_for_shutdown(5e56bbb8005ef9b0).(stcb);
7220 sctp_send_shutdowncxx . . $ sctp_send_shutdown(2ed2c3ddd2bbab6a).(stcb, net);
7221 sctp_timer_startcxx . . $ sctp_timer_start(73c9263bfa4b937d).(SCTP_TIMER_TYPE_SHUTDOWNcxx . . $ `usrsctplib/netinet/sctp_constants.h:540:9`!, stcb->sctp_epcxx . . $ sctp_tcb#sctp_ep., stcb,
7222 net);
7223 sctp_timer_startcxx . . $ sctp_timer_start(73c9263bfa4b937d).(SCTP_TIMER_TYPE_SHUTDOWNGUARDcxx . . $ `usrsctplib/netinet/sctp_constants.h:547:9`!, stcb->sctp_epcxx . . $ sctp_tcb#sctp_ep., stcb,
7224 NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!);
7225 added_control = 1;
7226 do_chunk_output = 0;
7227 }
7228 } else {
7229 /*
7230 * we still got (or just got) data to send, so set
7231 * SHUTDOWN_PENDING
7232 */
7233 /*
7234 * XXX sockets draft says that SCTP_EOF should be
7235 * sent with no data. currently, we will allow user
7236 * data to be sent first and move to
7237 * SHUTDOWN-PENDING
7238 */
7239 if ((SCTP_GET_STATEcxx . . $ `usrsctplib/netinet/sctp_constants.h:476:9`!(stcb) != SCTP_STATE_SHUTDOWN_SENTcxx . . $ `usrsctplib/netinet/sctp_constants.h:465:9`!) &&
7240 (SCTP_GET_STATEcxx . . $ `usrsctplib/netinet/sctp_constants.h:476:9`!(stcb) != SCTP_STATE_SHUTDOWN_RECEIVEDcxx . . $ `usrsctplib/netinet/sctp_constants.h:466:9`!) &&
7241 (SCTP_GET_STATEcxx . . $ `usrsctplib/netinet/sctp_constants.h:476:9`!(stcb) != SCTP_STATE_SHUTDOWN_ACK_SENTcxx . . $ `usrsctplib/netinet/sctp_constants.h:467:9`!)) {
7242 if ((*asoc->ss_functionscxx . . $ sctp_association#ss_functions..sctp_ss_is_user_msgs_incompletecxx . . $ sctp_ss_functions#sctp_ss_is_user_msgs_incomplete.)(stcb, asoc)) {
7243 SCTP_ADD_SUBSTATEcxx . . $ `usrsctplib/netinet/sctp_constants.h:482:9`!(stcb, SCTP_STATE_PARTIAL_MSG_LEFTcxx . . $ `usrsctplib/netinet/sctp_constants.h:471:9`!);
7244 }
7245 SCTP_ADD_SUBSTATEcxx . . $ `usrsctplib/netinet/sctp_constants.h:482:9`!(stcb, SCTP_STATE_SHUTDOWN_PENDINGcxx . . $ `usrsctplib/netinet/sctp_constants.h:468:9`!);
7246 if (TAILQ_EMPTYcxx . . $ `<external>/2546723208511035544/queue.h:457:9`!(&asoc->send_queue) &&
7247 TAILQ_EMPTYcxx . . $ `<external>/2546723208511035544/queue.h:457:9`!(&asoc->sent_queue) &&
7248 (asoc->statecxx . . $ sctp_association#state. & SCTP_STATE_PARTIAL_MSG_LEFTcxx . . $ `usrsctplib/netinet/sctp_constants.h:471:9`!)) {
7249 struct mbufcxx . . $ mbuf# *op_err;
7250 char msg[SCTP_DIAG_INFO_LENcxx . . $ `usrsctplib/netinet/sctp_constants.h:748:9`!];
7251
7252 abort_anyway:
7253 SCTP_SNPRINTFcxx . . $ `usrsctplib/netinet/sctp_os_userspace.h:808:9`!(msg, sizeof(msg),
7254 "%s:%d at %s", __FILE__, __LINE__, __func__);
7255 op_err = sctp_generate_causecxx . . $ sctp_generate_cause(b66a0ee9768f26bd).(SCTP_BASE_SYSCTLcxx . . $ `usrsctplib/netinet/sctp_os_userspace.h:579:9`!(sctp_diag_info_code),
7256 msg);
7257 atomic_add_intcxx . . $ `usrsctplib/user_atomic.h:94:9`!(&stcb->asoc.refcnt, 1);
7258 sctp_abort_an_associationcxx . . $ sctp_abort_an_association(2bef2660eefb26cd).(stcb->sctp_epcxx . . $ sctp_tcb#sctp_ep., stcb,
7259 op_err, SCTP_SO_NOT_LOCKEDcxx . . $ `usrsctplib/netinet/sctp_constants.h:964:9`!);
7260 atomic_add_intcxx . . $ `usrsctplib/user_atomic.h:94:9`!(&stcb->asoc.refcnt, -1);
7261 goto no_chunk_output;
7262 }
7263 sctp_timer_startcxx . . $ sctp_timer_start(73c9263bfa4b937d).(SCTP_TIMER_TYPE_SHUTDOWNGUARDcxx . . $ `usrsctplib/netinet/sctp_constants.h:547:9`!, stcb->sctp_epcxx . . $ sctp_tcb#sctp_ep., stcb,
7264 NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!);
7265 }
7266 }
7267 }
7268 }
7269 un_sent = ((stcb->asoccxx . . $ sctp_tcb#asoc..total_output_queue_sizecxx . . $ sctp_association#total_output_queue_size. - stcb->asoccxx . . $ sctp_tcb#asoc..total_flightcxx . . $ sctp_association#total_flight.) +
7270 (stcb->asoccxx . . $ sctp_tcb#asoc..stream_queue_cntcxx . . $ sctp_association#stream_queue_cnt. * SCTP_DATA_CHUNK_OVERHEADcxx . . $ `usrsctplib/netinet/sctp_output.h:137:9`!(stcb)));
7271
7272 if ((sctp_is_feature_offcxx . . $ `usrsctplib/netinet/sctp_var.h:54:9`!(inp, SCTP_PCB_FLAGS_NODELAYcxx . . $ `usrsctplib/netinet/sctp.h:571:9`!)) &&
7273 (stcb->asoccxx . . $ sctp_tcb#asoc..total_flightcxx . . $ sctp_association#total_flight. > 0) &&
7274 (un_sent < (int)(stcb->asoccxx . . $ sctp_tcb#asoc..smallest_mtucxx . . $ sctp_association#smallest_mtu. - SCTP_MIN_OVERHEADcxx . . $ `usrsctplib/netinet/sctp_header.h:561:9`!))) {
7275 do_chunk_output = 0;
7276 }
7277 if (do_chunk_output)
7278 sctp_chunk_outputcxx . . $ sctp_chunk_output(777f7332f4f2f1ed).(inp, stcb, SCTP_OUTPUT_FROM_USR_SENDcxx . . $ `usrsctplib/netinet/sctp_constants.h:366:9`!, SCTP_SO_NOT_LOCKEDcxx . . $ `usrsctplib/netinet/sctp_constants.h:964:9`!);
7279 else if (added_control) {
7280 int num_out, reason, now_filled = 0;
7281 struct timevalcxx . . $ timeval# now;
7282 int frag_point;
7283
7284 frag_point = sctp_get_frag_pointcxx . . $ sctp_get_frag_point(527fbf6e26d2907d).(stcb, &stcb->asoccxx . . $ sctp_tcb#asoc.);
7285 (void)sctp_med_chunk_outputcxx . . $ sctp_med_chunk_output(ae2c5cc94a0e278d).(inp, stcb, &stcb->asoccxx . . $ sctp_tcb#asoc., &num_out,
7286 &reason, 1, 1, &now, &now_filled, frag_point, SCTP_SO_NOT_LOCKEDcxx . . $ `usrsctplib/netinet/sctp_constants.h:964:9`!);
7287 }
7288 no_chunk_output:
7289 if (ret) {
7290 ca->cnt_failedcxx . . $ sctp_copy_all#cnt_failed.++;
7291 } else {
7292 ca->cnt_sentcxx . . $ sctp_copy_all#cnt_sent.++;
7293 }
7294 }
7295
7296 static void
7297 sctp_sendall_completescxx . . $ sctp_sendall_completes(67abb4dd43ac34c5).(void *ptr, uint32_tcxx . . $ uint32_t# val SCTP_UNUSEDcxx . . $ `usrsctplib/netinet/sctp_os_userspace.h:780:9`!)
7298 {
7299 struct sctp_copy_allcxx . . $ sctp_copy_all# *ca;
7300
7301 ca = (struct sctp_copy_allcxx . . $ sctp_copy_all# *)ptr;
7302 /*
7303 * Do a notify here? Kacheong suggests that the notify be done at
7304 * the send time.. so you would push up a notification if any send
7305 * failed. Don't know if this is feasible since the only failures we
7306 * have is "memory" related and if you cannot get an mbuf to send
7307 * the data you surely can't get an mbuf to send up to notify the
7308 * user you can't send the data :->
7309 */
7310
7311 /* now free everything */
7312 if (ca->inpcxx . . $ sctp_copy_all#inp.) {
7313 /* Lets clear the flag to allow others to run. */
7314 ca->inpcxx . . $ sctp_copy_all#inp.->sctp_flagscxx . . $ sctp_inpcb#sctp_flags. &= ~SCTP_PCB_FLAGS_SND_ITERATOR_UPcxx . . $ `usrsctplib/netinet/sctp.h:528:9`!;
7315 }
7316 sctp_m_freemcxx . . $ `usrsctplib/netinet/sctputil.h:57:9`!(ca->mcxx . . $ sctp_copy_all#m.);
7317 SCTP_FREEcxx . . $ `usrsctplib/netinet/sctp_os_userspace.h:668:9`!(ca, SCTP_M_COPYAL);
7318 }
7319
7320 static struct mbufcxx . . $ mbuf# *
7321 sctp_copy_out_allcxx . . $ sctp_copy_out_all(e732592a7a4e9c2c).(struct uiocxx . . $ uio# *uio, ssize_tcxx . . $ ssize_t# len)
7322 {
7323 struct mbufcxx . . $ mbuf# *ret, *at;
7324 ssize_tcxx . . $ ssize_t# left, willcpy, cancpy, error;
7325
7326 ret = sctp_get_mbuf_for_msgcxx . . $ sctp_get_mbuf_for_msg(c7c30fc329598377).(MCLBYTEScxx . . $ `usrsctplib/user_mbuf.h:51:9`!, 0, M_WAITOKcxx . . $ `usrsctplib/user_malloc.h:61:9`!, 1, MT_DATAcxx . . $ `usrsctplib/user_mbuf.h:289:9`!);
7327 if (ret == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!) {
7328 /* TSNH */
7329 return (NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!);
7330 }
7331 left = len;
7332 SCTP_BUF_LENcxx . . $ `usrsctplib/netinet/sctp_os_userspace.h:790:9`!(ret) = 0;
7333 /* save space for the data chunk header */
7334 cancpy = (int)M_TRAILINGSPACEcxx . . $ `usrsctplib/user_mbuf.h:355:9`!(ret);
7335 willcpy = mincxx . . $ `usrsctplib/user_environment.h:66:9`!(cancpy, left);
7336 at = ret;
7337 while (left > 0) {
7338 /* Align data to the end */
7339 error = uiomovecxx . . $ uiomove(76b2b074f1e589d6).(mtodcxx . . $ `usrsctplib/user_mbuf.h:96:9`!(at, caddr_t), (int)willcpy, uio);
7340 if (error) {
7341 err_out_now:
7342 sctp_m_freemcxx . . $ `usrsctplib/netinet/sctputil.h:57:9`!(at);
7343 return (NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!);
7344 }
7345 SCTP_BUF_LENcxx . . $ `usrsctplib/netinet/sctp_os_userspace.h:790:9`!(at) = (int)willcpy;
7346 SCTP_BUF_NEXT_PKTcxx . . $ `usrsctplib/netinet/sctp_os_userspace.h:792:9`!(at) = SCTP_BUF_NEXTcxx . . $ `usrsctplib/netinet/sctp_os_userspace.h:791:9`!(at) = 0;
7347 left -= willcpy;
7348 if (left > 0) {
7349 SCTP_BUF_NEXTcxx . . $ `usrsctplib/netinet/sctp_os_userspace.h:791:9`!(at) = sctp_get_mbuf_for_msgcxx . . $ sctp_get_mbuf_for_msg(c7c30fc329598377).((unsigned int)left, 0, M_WAITOKcxx . . $ `usrsctplib/user_malloc.h:61:9`!, 1, MT_DATAcxx . . $ `usrsctplib/user_mbuf.h:289:9`!);
7350 if (SCTP_BUF_NEXTcxx . . $ `usrsctplib/netinet/sctp_os_userspace.h:791:9`!(at) == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!) {
7351 goto err_out_now;
7352 }
7353 at = SCTP_BUF_NEXTcxx . . $ `usrsctplib/netinet/sctp_os_userspace.h:791:9`!(at);
7354 SCTP_BUF_LENcxx . . $ `usrsctplib/netinet/sctp_os_userspace.h:790:9`!(at) = 0;
7355 cancpy = (int)M_TRAILINGSPACEcxx . . $ `usrsctplib/user_mbuf.h:355:9`!(at);
7356 willcpy = mincxx . . $ `usrsctplib/user_environment.h:66:9`!(cancpy, left);
7357 }
7358 }
7359 return (ret);
7360 }
7361
7362 static int
7363 sctp_sendallcxx . . $ sctp_sendall(ed2c7081b85208c6).(struct sctp_inpcbcxx . . $ sctp_inpcb# *inp, struct uiocxx . . $ uio# *uio, struct mbufcxx . . $ mbuf# *m,
7364 struct sctp_sndrcvinfo *srcv)
7365 {
7366 int ret;
7367 struct sctp_copy_allcxx . . $ sctp_copy_all# *ca;
7368
7369 if (inp->sctp_flagscxx . . $ sctp_inpcb#sctp_flags. & SCTP_PCB_FLAGS_SND_ITERATOR_UPcxx . . $ `usrsctplib/netinet/sctp.h:528:9`!) {
7370 /* There is another. */
7371 return (EBUSYcxx . . $ `<external>/8987895939074593727/errno-base.h:20:9`!);
7372 }
7373 #if defined(__APPLE__) && !defined(__Userspace__cxx . . $ `<built-in>:442:9`!)
7374 #if defined(APPLE_LEOPARD)
7375 if (uio->uio_resid > SCTP_BASE_SYSCTL(sctp_sendall_limit)) {
7376 #else
7377 if (uio_resid(uio) > SCTP_BASE_SYSCTL(sctp_sendall_limit)) {
7378 #endif
7379 #else
7380 if (uio->uio_residcxx . . $ uio#uio_resid. > (ssize_tcxx . . $ ssize_t#)SCTP_BASE_SYSCTLcxx . . $ `usrsctplib/netinet/sctp_os_userspace.h:579:9`!(sctp_sendall_limit)) {
7381 #endif
7382 /* You must not be larger than the limit! */
7383 return (EMSGSIZEcxx . . $ `<external>/17922322188510340118/errno.h:74:9`!);
7384 }
7385 SCTP_MALLOCcxx . . $ `usrsctplib/netinet/sctp_os_userspace.h:663:9`!(ca, struct sctp_copy_all *, sizeof(struct sctp_copy_all),
7386 SCTP_M_COPYAL);
7387 if (ca == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!) {
7388 sctp_m_freemcxx . . $ `usrsctplib/netinet/sctputil.h:57:9`!(m);
7389 SCTP_LTRACE_ERR_RETcxx . . $ `usrsctplib/netinet/sctp_os_userspace.h:629:9`!(inp, NULL, NULL, SCTP_FROM_SCTP_OUTPUT, ENOMEM);
7390 return (ENOMEMcxx . . $ `<external>/8987895939074593727/errno-base.h:16:9`!);
7391 }
7392 memsetcxx . . $ memset(d1de1e4fb215f1c6).(ca, 0, sizeof(struct sctp_copy_allcxx . . $ sctp_copy_all#));
7393
7394 ca->inpcxx . . $ sctp_copy_all#inp. = inp;
7395 if (srcv) {
7396 memcpycxx . . $ memcpy(cc817cb175f282d).(&ca->sndrcvcxx . . $ sctp_copy_all#sndrcv., srcv, sizeof(struct sctp_nonpad_sndrcvinfocxx . . $ sctp_nonpad_sndrcvinfo#));
7397 }
7398 /*
7399 * take off the sendall flag, it would be bad if we failed to do
7400 * this :-0
7401 */
7402 ca->sndrcvcxx . . $ sctp_copy_all#sndrcv..sinfo_flags &= ~SCTP_SENDALLcxx . . $ `./netinet/sctp_uio.h:266:9`!;
7403 /* get length and mbuf chain */
7404 if (uio) {
7405 #if defined(__APPLE__) && !defined(__Userspace__cxx . . $ `<built-in>:442:9`!)
7406 #if defined(APPLE_LEOPARD)
7407 ca->sndlen = uio->uio_resid;
7408 #else
7409 ca->sndlen = uio_resid(uio);
7410 #endif
7411 #else
7412 ca->sndlencxx . . $ sctp_copy_all#sndlen. = uio->uio_residcxx . . $ uio#uio_resid.;
7413 #endif
7414 #if defined(__APPLE__) && !defined(__Userspace__cxx . . $ `<built-in>:442:9`!)
7415 SCTP_SOCKET_UNLOCK(SCTP_INP_SO(inp), 0);
7416 #endif
7417 ca->mcxx . . $ sctp_copy_all#m. = sctp_copy_out_allcxx . . $ sctp_copy_out_all(e732592a7a4e9c2c).(uio, ca->sndlencxx . . $ sctp_copy_all#sndlen.);
7418 #if defined(__APPLE__) && !defined(__Userspace__cxx . . $ `<built-in>:442:9`!)
7419 SCTP_SOCKET_LOCK(SCTP_INP_SO(inp), 0);
7420 #endif
7421 if (ca->mcxx . . $ sctp_copy_all#m. == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!) {
7422 SCTP_FREEcxx . . $ `usrsctplib/netinet/sctp_os_userspace.h:668:9`!(ca, SCTP_M_COPYAL);
7423 SCTP_LTRACE_ERR_RETcxx . . $ `usrsctplib/netinet/sctp_os_userspace.h:629:9`!(inp, NULL, NULL, SCTP_FROM_SCTP_OUTPUT, ENOMEM);
7424 return (ENOMEMcxx . . $ `<external>/8987895939074593727/errno-base.h:16:9`!);
7425 }
7426 } else {
7427 /* Gather the length of the send */
7428 struct mbufcxx . . $ mbuf# *mat;
7429
7430 ca->sndlencxx . . $ sctp_copy_all#sndlen. = 0;
7431 for (mat = m; mat; mat = SCTP_BUF_NEXTcxx . . $ `usrsctplib/netinet/sctp_os_userspace.h:791:9`!(mat)) {
7432 ca->sndlencxx . . $ sctp_copy_all#sndlen. += SCTP_BUF_LENcxx . . $ `usrsctplib/netinet/sctp_os_userspace.h:790:9`!(mat);
7433 }
7434 }
7435 inp->sctp_flagscxx . . $ sctp_inpcb#sctp_flags. |= SCTP_PCB_FLAGS_SND_ITERATOR_UPcxx . . $ `usrsctplib/netinet/sctp.h:528:9`!;
7436 ret = sctp_initiate_iteratorcxx . . $ sctp_initiate_iterator(3748de500f742bd1).(NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!, sctp_sendall_iteratorcxx . . $ sctp_sendall_iterator(3f64057379ebb9ec)., NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!,
7437 SCTP_PCB_ANY_FLAGScxx . . $ `usrsctplib/netinet/sctp_structs.h:105:9`!, SCTP_PCB_ANY_FEATUREScxx . . $ `usrsctplib/netinet/sctp_structs.h:106:9`!,
7438 SCTP_ASOC_ANY_STATEcxx . . $ `usrsctplib/netinet/sctp_structs.h:107:9`!,
7439 (void *)ca, 0,
7440 sctp_sendall_completescxx . . $ sctp_sendall_completes(67abb4dd43ac34c5)., inp, 1);
7441 if (ret) {
7442 inp->sctp_flagscxx . . $ sctp_inpcb#sctp_flags. &= ~SCTP_PCB_FLAGS_SND_ITERATOR_UPcxx . . $ `usrsctplib/netinet/sctp.h:528:9`!;
7443 SCTP_FREEcxx . . $ `usrsctplib/netinet/sctp_os_userspace.h:668:9`!(ca, SCTP_M_COPYAL);
7444 SCTP_LTRACE_ERR_RET_PKTcxx . . $ `usrsctplib/netinet/sctp_os_userspace.h:628:9`!(m, inp, NULL, NULL, SCTP_FROM_SCTP_OUTPUT, EFAULT);
7445 return (EFAULTcxx . . $ `<external>/8987895939074593727/errno-base.h:18:9`!);
7446 }
7447 return (0);
7448 }
7449
7450 void
7451 sctp_toss_old_cookiescxx . . $ sctp_toss_old_cookies(3638db9184331deb).(struct sctp_tcbcxx . . $ sctp_tcb# *stcb, struct sctp_associationcxx . . $ sctp_association# *asoc)
7452 {
7453 struct sctp_tmit_chunkcxx . . $ sctp_tmit_chunk# *chk, *nchk;
7454
7455 TAILQ_FOREACH_SAFEcxx . . $ `usrsctplib/netinet/sctp_os_userspace.h:1109:9`!(chk, &asoc->control_send_queue, sctp_next, nchk) {
7456 if (chk->reccxx . . $ sctp_tmit_chunk#rec..chunk_idcxx . . $ sctp_tmit_chunk#$anonymous_type_3#chunk_id..idcxx . . $ chk_id#id. == SCTP_COOKIE_ECHOcxx . . $ `usrsctplib/netinet/sctp.h:459:9`!) {
7457 TAILQ_REMOVEcxx . . $ `<external>/2546723208511035544/queue.h:426:9`!(&asoc->control_send_queue, chk, sctp_next);
7458 asoc->ctrl_queue_cntcxx . . $ sctp_association#ctrl_queue_cnt.--;
7459 if (chk->datacxx . . $ sctp_tmit_chunk#data.) {
7460 sctp_m_freemcxx . . $ `usrsctplib/netinet/sctputil.h:57:9`!(chk->datacxx . . $ sctp_tmit_chunk#data.);
7461 chk->datacxx . . $ sctp_tmit_chunk#data. = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!;
7462 }
7463 sctp_free_a_chunkcxx . . $ `usrsctplib/netinet/sctp_var.h:144:9`!(stcb, chk, SCTP_SO_NOT_LOCKEDcxx . . $ `usrsctplib/netinet/sctp_constants.h:964:9`!);
7464 }
7465 }
7466 }
7467
7468 void
7469 sctp_toss_old_asconfcxx . . $ sctp_toss_old_asconf(5e56bbb8005ef9b0).(struct sctp_tcbcxx . . $ sctp_tcb# *stcb)
7470 {
7471 struct sctp_associationcxx . . $ sctp_association# *asoc;
7472 struct sctp_tmit_chunkcxx . . $ sctp_tmit_chunk# *chk, *nchk;
7473 struct sctp_asconf_chunkcxx . . $ sctp_asconf_chunk# *acp;
7474
7475 asoc = &stcb->asoccxx . . $ sctp_tcb#asoc.;
7476 TAILQ_FOREACH_SAFEcxx . . $ `usrsctplib/netinet/sctp_os_userspace.h:1109:9`!(chk, &asoc->asconf_send_queue, sctp_next, nchk) {
7477 /* find SCTP_ASCONF chunk in queue */
7478 if (chk->reccxx . . $ sctp_tmit_chunk#rec..chunk_idcxx . . $ sctp_tmit_chunk#$anonymous_type_3#chunk_id..idcxx . . $ chk_id#id. == SCTP_ASCONFcxx . . $ `usrsctplib/netinet/sctp.h:484:9`!) {
7479 if (chk->datacxx . . $ sctp_tmit_chunk#data.) {
7480 acp = mtodcxx . . $ `usrsctplib/user_mbuf.h:96:9`!(chk->data, struct sctp_asconf_chunk *);
7481 if (SCTP_TSN_GTcxx . . $ `usrsctplib/netinet/sctp_constants.h:893:9`!(ntohl(acp->serial_number), asoc->asconf_seq_out_acked)) {
7482 /* Not Acked yet */
7483 break;
7484 }
7485 }
7486 TAILQ_REMOVEcxx . . $ `<external>/2546723208511035544/queue.h:426:9`!(&asoc->asconf_send_queue, chk, sctp_next);
7487 asoc->ctrl_queue_cntcxx . . $ sctp_association#ctrl_queue_cnt.--;
7488 if (chk->datacxx . . $ sctp_tmit_chunk#data.) {
7489 sctp_m_freemcxx . . $ `usrsctplib/netinet/sctputil.h:57:9`!(chk->datacxx . . $ sctp_tmit_chunk#data.);
7490 chk->datacxx . . $ sctp_tmit_chunk#data. = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!;
7491 }
7492 sctp_free_a_chunkcxx . . $ `usrsctplib/netinet/sctp_var.h:144:9`!(stcb, chk, SCTP_SO_NOT_LOCKEDcxx . . $ `usrsctplib/netinet/sctp_constants.h:964:9`!);
7493 }
7494 }
7495 }
7496
7497 static void
7498 sctp_clean_up_datalistcxx . . $ sctp_clean_up_datalist(19c631143ae78ffc).(struct sctp_tcbcxx . . $ sctp_tcb# *stcb,
7499 struct sctp_associationcxx . . $ sctp_association# *asoc,
7500 struct sctp_tmit_chunkcxx . . $ sctp_tmit_chunk# **data_list,
7501 int bundle_at,
7502 struct sctp_netscxx . . $ sctp_nets# *net)
7503 {
7504 int i;
7505 struct sctp_tmit_chunkcxx . . $ sctp_tmit_chunk# *tp1;
7506
7507 for (i = 0; i < bundle_at; i++) {
7508 /* off of the send queue */
7509 TAILQ_REMOVEcxx . . $ `<external>/2546723208511035544/queue.h:426:9`!(&asoc->send_queue, data_list[i], sctp_next);
7510 asoc->send_queue_cntcxx . . $ sctp_association#send_queue_cnt.--;
7511 if (i > 0) {
7512 /*
7513 * Any chunk NOT 0 you zap the time chunk 0 gets
7514 * zapped or set based on if a RTO measurment is
7515 * needed.
7516 */
7517 data_list[i]->do_rttcxx . . $ sctp_tmit_chunk#do_rtt. = 0;
7518 }
7519 /* record time */
7520 data_list[i]->sent_rcv_timecxx . . $ sctp_tmit_chunk#sent_rcv_time. = net->last_sent_timecxx . . $ sctp_nets#last_sent_time.;
7521 data_list[i]->reccxx . . $ sctp_tmit_chunk#rec..datacxx . . $ sctp_tmit_chunk#$anonymous_type_3#data..cwnd_at_sendcxx . . $ sctp_data_chunkrec#cwnd_at_send. = net->cwndcxx . . $ sctp_nets#cwnd.;
7522 data_list[i]->reccxx . . $ sctp_tmit_chunk#rec..datacxx . . $ sctp_tmit_chunk#$anonymous_type_3#data..fast_retran_tsncxx . . $ sctp_data_chunkrec#fast_retran_tsn. = data_list[i]->reccxx . . $ sctp_tmit_chunk#rec..datacxx . . $ sctp_tmit_chunk#$anonymous_type_3#data..tsncxx . . $ sctp_data_chunkrec#tsn.;
7523 if (data_list[i]->whoTocxx . . $ sctp_tmit_chunk#whoTo. == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!) {
7524 data_list[i]->whoTocxx . . $ sctp_tmit_chunk#whoTo. = net;
7525 atomic_add_intcxx . . $ `usrsctplib/user_atomic.h:94:9`!(&net->ref_count, 1);
7526 }
7527 /* on to the sent queue */
7528 tp1 = TAILQ_LASTcxx . . $ `<external>/2546723208511035544/queue.h:461:9`!(&asoc->sent_queue, sctpchunk_listhead);
7529 if ((tp1) && SCTP_TSN_GTcxx . . $ `usrsctplib/netinet/sctp_constants.h:893:9`!(tp1->rec.data.tsn, data_list[i]->rec.data.tsn)) {
7530 struct sctp_tmit_chunkcxx . . $ sctp_tmit_chunk# *tpp;
7531
7532 /* need to move back */
7533 back_up_more:
7534 tpp = TAILQ_PREVcxx . . $ `<external>/2546723208511035544/queue.h:463:9`!(tp1, sctpchunk_listhead, sctp_next);
7535 if (tpp == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!) {
7536 TAILQ_INSERT_BEFOREcxx . . $ `<external>/2546723208511035544/queue.h:419:9`!(tp1, data_list[i], sctp_next);
7537 goto all_done;
7538 }
7539 tp1 = tpp;
7540 if (SCTP_TSN_GTcxx . . $ `usrsctplib/netinet/sctp_constants.h:893:9`!(tp1->rec.data.tsn, data_list[i]->rec.data.tsn)) {
7541 goto back_up_more;
7542 }
7543 TAILQ_INSERT_AFTERcxx . . $ `<external>/2546723208511035544/queue.h:409:9`!(&asoc->sent_queue, tp1, data_list[i], sctp_next);
7544 } else {
7545 TAILQ_INSERT_TAILcxx . . $ `<external>/2546723208511035544/queue.h:402:9`!(&asoc->sent_queue,
7546 data_list[i],
7547 sctp_next);
7548 }
7549 all_done:
7550 /* This does not lower until the cum-ack passes it */
7551 asoc->sent_queue_cntcxx . . $ sctp_association#sent_queue_cnt.++;
7552 if ((asoc->peers_rwndcxx . . $ sctp_association#peers_rwnd. <= 0) &&
7553 (asoc->total_flightcxx . . $ sctp_association#total_flight. == 0) &&
7554 (bundle_at == 1)) {
7555 /* Mark the chunk as being a window probe */
7556 SCTP_STAT_INCRcxx . . $ `./netinet/sctp_uio.h:1111:9`!(sctps_windowprobed);
7557 }
7558 #ifdef SCTP_AUDITING_ENABLED
7559 sctp_audit_log(0xC2, 3);
7560 #endif
7561 data_list[i]->sentcxx . . $ sctp_tmit_chunk#sent. = SCTP_DATAGRAM_SENTcxx . . $ `usrsctplib/netinet/sctp_constants.h:354:9`!;
7562 data_list[i]->snd_countcxx . . $ sctp_tmit_chunk#snd_count. = 1;
7563 data_list[i]->reccxx . . $ sctp_tmit_chunk#rec..datacxx . . $ sctp_tmit_chunk#$anonymous_type_3#data..chunk_was_revokedcxx . . $ sctp_data_chunkrec#chunk_was_revoked. = 0;
7564 if (SCTP_BASE_SYSCTLcxx . . $ `usrsctplib/netinet/sctp_os_userspace.h:579:9`!(sctp_logging_level) & SCTP_FLIGHT_LOGGING_ENABLEcxx . . $ `usrsctplib/netinet/sctp.h:641:9`!) {
7565 sctp_misc_intscxx . . $ sctp_misc_ints(da1ccf5149f5690e).(SCTP_FLIGHT_LOG_UPcxx . . $ `usrsctplib/netinet/sctp_constants.h:217:9`!,
7566 data_list[i]->whoTocxx . . $ sctp_tmit_chunk#whoTo.->flight_sizecxx . . $ sctp_nets#flight_size.,
7567 data_list[i]->book_sizecxx . . $ sctp_tmit_chunk#book_size.,
7568 (uint32_tcxx . . $ uint32_t#)(uintptr_tcxx . . $ uintptr_t#)data_list[i]->whoTocxx . . $ sctp_tmit_chunk#whoTo.,
7569 data_list[i]->reccxx . . $ sctp_tmit_chunk#rec..datacxx . . $ sctp_tmit_chunk#$anonymous_type_3#data..tsncxx . . $ sctp_data_chunkrec#tsn.);
7570 }
7571 sctp_flight_size_increasecxx . . $ `usrsctplib/netinet/sctp_var.h:297:9`!(data_list[i]);
7572 sctp_total_flight_increasecxx . . $ `usrsctplib/netinet/sctp_var.h:351:9`!(stcb, data_list[i]);
7573 if (SCTP_BASE_SYSCTLcxx . . $ `usrsctplib/netinet/sctp_os_userspace.h:579:9`!(sctp_logging_level) & SCTP_LOG_RWND_ENABLEcxx . . $ `usrsctplib/netinet/sctp.h:656:9`!) {
7574 sctp_log_rwndcxx . . $ sctp_log_rwnd(ff6ad2c433048b0).(SCTP_DECREASE_PEER_RWNDcxx . . $ `usrsctplib/netinet/sctp_constants.h:146:9`!,
7575 asoc->peers_rwndcxx . . $ sctp_association#peers_rwnd., data_list[i]->send_sizecxx . . $ sctp_tmit_chunk#send_size., SCTP_BASE_SYSCTLcxx . . $ `usrsctplib/netinet/sctp_os_userspace.h:579:9`!(sctp_peer_chunk_oh));
7576 }
7577 asoc->peers_rwndcxx . . $ sctp_association#peers_rwnd. = sctp_sbspace_subcxx . . $ `usrsctplib/netinet/sctp_var.h:94:9`!(asoc->peers_rwnd,
7578 (uint32_t) (data_list[i]->send_size + SCTP_BASE_SYSCTLcxx . . $ `usrsctplib/netinet/sctp_os_userspace.h:579:9`!(sctp_peer_chunk_oh)));
7579 if (asoc->peers_rwndcxx . . $ sctp_association#peers_rwnd. < stcb->sctp_epcxx . . $ sctp_tcb#sctp_ep.->sctp_epcxx . . $ sctp_inpcb#sctp_ep..sctp_sws_sendercxx . . $ sctp_pcb#sctp_sws_sender.) {
7580 /* SWS sender side engages */
7581 asoc->peers_rwndcxx . . $ sctp_association#peers_rwnd. = 0;
7582 }
7583 }
7584 if (asoc->cc_functionscxx . . $ sctp_association#cc_functions..sctp_cwnd_update_packet_transmittedcxx . . $ sctp_cc_functions#sctp_cwnd_update_packet_transmitted.) {
7585 (*asoc->cc_functionscxx . . $ sctp_association#cc_functions..sctp_cwnd_update_packet_transmittedcxx . . $ sctp_cc_functions#sctp_cwnd_update_packet_transmitted.)(stcb, net);
7586 }
7587 }
7588
7589 static void
7590 sctp_clean_up_ctlcxx . . $ sctp_clean_up_ctl(1b508a31e65fdabe).(struct sctp_tcbcxx . . $ sctp_tcb# *stcb, struct sctp_associationcxx . . $ sctp_association# *asoc, int so_locked)
7591 {
7592 struct sctp_tmit_chunkcxx . . $ sctp_tmit_chunk# *chk, *nchk;
7593
7594 TAILQ_FOREACH_SAFEcxx . . $ `usrsctplib/netinet/sctp_os_userspace.h:1109:9`!(chk, &asoc->control_send_queue, sctp_next, nchk) {
7595 if ((chk->reccxx . . $ sctp_tmit_chunk#rec..chunk_idcxx . . $ sctp_tmit_chunk#$anonymous_type_3#chunk_id..idcxx . . $ chk_id#id. == SCTP_SELECTIVE_ACKcxx . . $ `usrsctplib/netinet/sctp.h:452:9`!) ||
7596 (chk->reccxx . . $ sctp_tmit_chunk#rec..chunk_idcxx . . $ sctp_tmit_chunk#$anonymous_type_3#chunk_id..idcxx . . $ chk_id#id. == SCTP_NR_SELECTIVE_ACKcxx . . $ `usrsctplib/netinet/sctp.h:467:9`!) || /* EY */
7597 (chk->reccxx . . $ sctp_tmit_chunk#rec..chunk_idcxx . . $ sctp_tmit_chunk#$anonymous_type_3#chunk_id..idcxx . . $ chk_id#id. == SCTP_HEARTBEAT_REQUESTcxx . . $ `usrsctplib/netinet/sctp.h:453:9`!) ||
7598 (chk->reccxx . . $ sctp_tmit_chunk#rec..chunk_idcxx . . $ sctp_tmit_chunk#$anonymous_type_3#chunk_id..idcxx . . $ chk_id#id. == SCTP_HEARTBEAT_ACKcxx . . $ `usrsctplib/netinet/sctp.h:454:9`!) ||
7599 (chk->reccxx . . $ sctp_tmit_chunk#rec..chunk_idcxx . . $ sctp_tmit_chunk#$anonymous_type_3#chunk_id..idcxx . . $ chk_id#id. == SCTP_FORWARD_CUM_TSNcxx . . $ `usrsctplib/netinet/sctp.h:482:9`!) ||
7600 (chk->reccxx . . $ sctp_tmit_chunk#rec..chunk_idcxx . . $ sctp_tmit_chunk#$anonymous_type_3#chunk_id..idcxx . . $ chk_id#id. == SCTP_SHUTDOWNcxx . . $ `usrsctplib/netinet/sctp.h:456:9`!) ||
7601 (chk->reccxx . . $ sctp_tmit_chunk#rec..chunk_idcxx . . $ sctp_tmit_chunk#$anonymous_type_3#chunk_id..idcxx . . $ chk_id#id. == SCTP_SHUTDOWN_ACKcxx . . $ `usrsctplib/netinet/sctp.h:457:9`!) ||
7602 (chk->reccxx . . $ sctp_tmit_chunk#rec..chunk_idcxx . . $ sctp_tmit_chunk#$anonymous_type_3#chunk_id..idcxx . . $ chk_id#id. == SCTP_OPERATION_ERRORcxx . . $ `usrsctplib/netinet/sctp.h:458:9`!) ||
7603 (chk->reccxx . . $ sctp_tmit_chunk#rec..chunk_idcxx . . $ sctp_tmit_chunk#$anonymous_type_3#chunk_id..idcxx . . $ chk_id#id. == SCTP_PACKET_DROPPEDcxx . . $ `usrsctplib/netinet/sctp.h:474:9`!) ||
7604 (chk->reccxx . . $ sctp_tmit_chunk#rec..chunk_idcxx . . $ sctp_tmit_chunk#$anonymous_type_3#chunk_id..idcxx . . $ chk_id#id. == SCTP_COOKIE_ACKcxx . . $ `usrsctplib/netinet/sctp.h:460:9`!) ||
7605 (chk->reccxx . . $ sctp_tmit_chunk#rec..chunk_idcxx . . $ sctp_tmit_chunk#$anonymous_type_3#chunk_id..idcxx . . $ chk_id#id. == SCTP_ECN_CWRcxx . . $ `usrsctplib/netinet/sctp.h:462:9`!) ||
7606 (chk->reccxx . . $ sctp_tmit_chunk#rec..chunk_idcxx . . $ sctp_tmit_chunk#$anonymous_type_3#chunk_id..idcxx . . $ chk_id#id. == SCTP_ASCONF_ACKcxx . . $ `usrsctplib/netinet/sctp.h:472:9`!)) {
7607 /* Stray chunks must be cleaned up */
7608 clean_up_anyway:
7609 TAILQ_REMOVEcxx . . $ `<external>/2546723208511035544/queue.h:426:9`!(&asoc->control_send_queue, chk, sctp_next);
7610 asoc->ctrl_queue_cntcxx . . $ sctp_association#ctrl_queue_cnt.--;
7611 if (chk->datacxx . . $ sctp_tmit_chunk#data.) {
7612 sctp_m_freemcxx . . $ `usrsctplib/netinet/sctputil.h:57:9`!(chk->datacxx . . $ sctp_tmit_chunk#data.);
7613 chk->datacxx . . $ sctp_tmit_chunk#data. = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!;
7614 }
7615 if (chk->reccxx . . $ sctp_tmit_chunk#rec..chunk_idcxx . . $ sctp_tmit_chunk#$anonymous_type_3#chunk_id..idcxx . . $ chk_id#id. == SCTP_FORWARD_CUM_TSNcxx . . $ `usrsctplib/netinet/sctp.h:482:9`!) {
7616 asoc->fwd_tsn_cntcxx . . $ sctp_association#fwd_tsn_cnt.--;
7617 }
7618 sctp_free_a_chunkcxx . . $ `usrsctplib/netinet/sctp_var.h:144:9`!(stcb, chk, so_locked);
7619 } else if (chk->reccxx . . $ sctp_tmit_chunk#rec..chunk_idcxx . . $ sctp_tmit_chunk#$anonymous_type_3#chunk_id..idcxx . . $ chk_id#id. == SCTP_STREAM_RESETcxx . . $ `usrsctplib/netinet/sctp.h:476:9`!) {
7620 /* special handling, we must look into the param */
7621 if (chk != asoc->str_resetcxx . . $ sctp_association#str_reset.) {
7622 goto clean_up_anyway;
7623 }
7624 }
7625 }
7626 }
7627
7628 static uint32_tcxx . . $ uint32_t#
7629 sctp_can_we_split_thiscxx . . $ sctp_can_we_split_this(8761b9c6c397f07).(struct sctp_tcbcxx . . $ sctp_tcb# *stcb, uint32_tcxx . . $ uint32_t# length,
7630 uint32_tcxx . . $ uint32_t# space_left, uint32_tcxx . . $ uint32_t# frag_point, int eeor_on)
7631 {
7632 /* Make a decision on if I should split a
7633 * msg into multiple parts. This is only asked of
7634 * incomplete messages.
7635 */
7636 if (eeor_on) {
7637 /* If we are doing EEOR we need to always send
7638 * it if its the entire thing, since it might
7639 * be all the guy is putting in the hopper.
7640 */
7641 if (space_left >= length) {
7642 /*-
7643 * If we have data outstanding,
7644 * we get another chance when the sack
7645 * arrives to transmit - wait for more data
7646 */
7647 if (stcb->asoccxx . . $ sctp_tcb#asoc..total_flightcxx . . $ sctp_association#total_flight. == 0) {
7648 /* If nothing is in flight, we zero
7649 * the packet counter.
7650 */
7651 return (length);
7652 }
7653 return (0);
7654
7655 } else {
7656 /* You can fill the rest */
7657 return (space_left);
7658 }
7659 }
7660 /*-
7661 * For those strange folk that make the send buffer
7662 * smaller than our fragmentation point, we can't
7663 * get a full msg in so we have to allow splitting.
7664 */
7665 if (SCTP_SB_LIMIT_SNDcxx . . $ `usrsctplib/netinet/sctp_os_userspace.h:965:9`!(stcb->sctp_socket) < frag_point) {
7666 return (length);
7667 }
7668 if ((length <= space_left) ||
7669 ((length - space_left) < SCTP_BASE_SYSCTLcxx . . $ `usrsctplib/netinet/sctp_os_userspace.h:579:9`!(sctp_min_residual))) {
7670 /* Sub-optimial residual don't split in non-eeor mode. */
7671 return (0);
7672 }
7673 /* If we reach here length is larger
7674 * than the space_left. Do we wish to split
7675 * it for the sake of packet putting together?
7676 */
7677 if (space_left >= mincxx . . $ `usrsctplib/user_environment.h:66:9`!(SCTP_BASE_SYSCTLcxx . . $ `usrsctplib/netinet/sctp_os_userspace.h:579:9`!(sctp_min_split_point), frag_point)) {
7678 /* Its ok to split it */
7679 return (mincxx . . $ `usrsctplib/user_environment.h:66:9`!(space_left, frag_point));
7680 }
7681 /* Nope, can't split */
7682 return (0);
7683 }
7684
7685 static uint32_tcxx . . $ uint32_t#
7686 sctp_move_to_outqueuecxx . . $ sctp_move_to_outqueue(537d89157cb06edd).(struct sctp_tcbcxx . . $ sctp_tcb# *stcb,
7687 struct sctp_stream_outcxx . . $ sctp_stream_out# *strq,
7688 uint32_tcxx . . $ uint32_t# space_left,
7689 uint32_tcxx . . $ uint32_t# frag_point,
7690 int *giveup,
7691 int eeor_mode,
7692 int *bail,
7693 int so_locked)
7694 {
7695 /* Move from the stream to the send_queue keeping track of the total */
7696 struct sctp_associationcxx . . $ sctp_association# *asoc;
7697 struct sctp_stream_queue_pendingcxx . . $ sctp_stream_queue_pending# *sp;
7698 struct sctp_tmit_chunkcxx . . $ sctp_tmit_chunk# *chk;
7699 struct sctp_data_chunkcxx . . $ sctp_data_chunk# *dchkh=NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!;
7700 struct sctp_idata_chunkcxx . . $ sctp_idata_chunk# *ndchkh=NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!;
7701 uint32_tcxx . . $ uint32_t# to_move, length;
7702 int leading;
7703 uint8_tcxx . . $ uint8_t# rcv_flags = 0;
7704 uint8_tcxx . . $ uint8_t# some_taken;
7705 uint8_tcxx . . $ uint8_t# send_lock_up = 0;
7706
7707 SCTP_TCB_LOCK_ASSERTcxx . . $ `usrsctplib/netinet/sctp_process_lock.h:478:9`!(stcb);
7708 asoc = &stcb->asoccxx . . $ sctp_tcb#asoc.;
7709 one_more_time:
7710 /*sa_ignore FREED_MEMORY*/
7711 sp = TAILQ_FIRSTcxx . . $ `<external>/2546723208511035544/queue.h:458:9`!(&strq->outqueue);
7712 if (sp == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!) {
7713 if (send_lock_up == 0) {
7714 SCTP_TCB_SEND_LOCKcxx . . $ `usrsctplib/netinet/sctp_process_lock.h:403:9`!(stcb);
7715 send_lock_up = 1;
7716 }
7717 sp = TAILQ_FIRSTcxx . . $ `<external>/2546723208511035544/queue.h:458:9`!(&strq->outqueue);
7718 if (sp) {
7719 goto one_more_time;
7720 }
7721 if ((sctp_is_feature_oncxx . . $ `usrsctplib/netinet/sctp_var.h:53:9`!(stcb->sctp_ep, SCTP_PCB_FLAGS_EXPLICIT_EORcxx . . $ `usrsctplib/netinet/sctp.h:584:9`!) == 0) &&
7722 (stcb->asoccxx . . $ sctp_tcb#asoc..idata_supportedcxx . . $ sctp_association#idata_supported. == 0) &&
7723 (strq->last_msg_incompletecxx . . $ sctp_stream_out#last_msg_incomplete.)) {
7724 SCTP_PRINTFcxx . . $ `usrsctplib/netinet/sctp_os_userspace.h:536:9`!("Huh? Stream:%d lm_in_c=%d but queue is NULL\n",
7725 strq->sid,
7726 strq->last_msg_incomplete);
7727 strq->last_msg_incompletecxx . . $ sctp_stream_out#last_msg_incomplete. = 0;
7728 }
7729 to_move = 0;
7730 if (send_lock_up) {
7731 SCTP_TCB_SEND_UNLOCKcxx . . $ `usrsctplib/netinet/sctp_process_lock.h:405:9`!(stcb);
7732 send_lock_up = 0;
7733 }
7734 goto out_of;
7735 }
7736 if ((sp->msg_is_completecxx . . $ sctp_stream_queue_pending#msg_is_complete.) && (sp->lengthcxx . . $ sctp_stream_queue_pending#length. == 0)) {
7737 if (sp->sender_all_donecxx . . $ sctp_stream_queue_pending#sender_all_done.) {
7738 /* We are doing deferred cleanup. Last
7739 * time through when we took all the data
7740 * the sender_all_done was not set.
7741 */
7742 if ((sp->put_last_outcxx . . $ sctp_stream_queue_pending#put_last_out. == 0) && (sp->discard_restcxx . . $ sctp_stream_queue_pending#discard_rest. == 0)) {
7743 SCTP_PRINTFcxx . . $ `usrsctplib/netinet/sctp_os_userspace.h:536:9`!("Gak, put out entire msg with NO end!-1\n");
7744 SCTP_PRINTFcxx . . $ `usrsctplib/netinet/sctp_os_userspace.h:536:9`!("sender_done:%d len:%d msg_comp:%d put_last_out:%d send_lock:%d\n",
7745 sp->sender_all_done,
7746 sp->length,
7747 sp->msg_is_complete,
7748 sp->put_last_out,
7749 send_lock_up);
7750 }
7751 if ((TAILQ_NEXTcxx . . $ `<external>/2546723208511035544/queue.h:459:9`!(sp, next) == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!) && (send_lock_up == 0)) {
7752 SCTP_TCB_SEND_LOCKcxx . . $ `usrsctplib/netinet/sctp_process_lock.h:403:9`!(stcb);
7753 send_lock_up = 1;
7754 }
7755 atomic_subtract_intcxx . . $ `usrsctplib/user_atomic.h:97:9`!(&asoc->stream_queue_cnt, 1);
7756 TAILQ_REMOVEcxx . . $ `<external>/2546723208511035544/queue.h:426:9`!(&strq->outqueue, sp, next);
7757 stcb->asoccxx . . $ sctp_tcb#asoc..ss_functionscxx . . $ sctp_association#ss_functions..sctp_ss_remove_from_streamcxx . . $ sctp_ss_functions#sctp_ss_remove_from_stream.(stcb, asoc, strq, sp, send_lock_up);
7758 if ((strq->statecxx . . $ sctp_stream_out#state. == SCTP_STREAM_RESET_PENDINGcxx . . $ `usrsctplib/netinet/sctp_structs.h:651:9`!) &&
7759 (strq->chunks_on_queuescxx . . $ sctp_stream_out#chunks_on_queues. == 0) &&
7760 TAILQ_EMPTYcxx . . $ `<external>/2546723208511035544/queue.h:457:9`!(&strq->outqueue)) {
7761 stcb->asoccxx . . $ sctp_tcb#asoc..trigger_resetcxx . . $ sctp_association#trigger_reset. = 1;
7762 }
7763 if (sp->netcxx . . $ sctp_stream_queue_pending#net.) {
7764 sctp_free_remote_addrcxx . . $ `usrsctplib/netinet/sctp_var.h:229:9`!(sp->net);
7765 sp->netcxx . . $ sctp_stream_queue_pending#net. = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!;
7766 }
7767 if (sp->datacxx . . $ sctp_stream_queue_pending#data.) {
7768 sctp_m_freemcxx . . $ `usrsctplib/netinet/sctputil.h:57:9`!(sp->datacxx . . $ sctp_stream_queue_pending#data.);
7769 sp->datacxx . . $ sctp_stream_queue_pending#data. = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!;
7770 }
7771 sctp_free_a_strmoqcxx . . $ `usrsctplib/netinet/sctp_var.h:126:9`!(stcb, sp, so_locked);
7772 /* we can't be locked to it */
7773 if (send_lock_up) {
7774 SCTP_TCB_SEND_UNLOCKcxx . . $ `usrsctplib/netinet/sctp_process_lock.h:405:9`!(stcb);
7775 send_lock_up = 0;
7776 }
7777 /* back to get the next msg */
7778 goto one_more_time;
7779 } else {
7780 /* sender just finished this but
7781 * still holds a reference
7782 */
7783 *giveup = 1;
7784 to_move = 0;
7785 goto out_of;
7786 }
7787 } else {
7788 /* is there some to get */
7789 if (sp->lengthcxx . . $ sctp_stream_queue_pending#length. == 0) {
7790 /* no */
7791 *giveup = 1;
7792 to_move = 0;
7793 goto out_of;
7794 } else if (sp->discard_restcxx . . $ sctp_stream_queue_pending#discard_rest.) {
7795 if (send_lock_up == 0) {
7796 SCTP_TCB_SEND_LOCKcxx . . $ `usrsctplib/netinet/sctp_process_lock.h:403:9`!(stcb);
7797 send_lock_up = 1;
7798 }
7799 /* Whack down the size */
7800 atomic_subtract_intcxx . . $ `usrsctplib/user_atomic.h:97:9`!(&stcb->asoc.total_output_queue_size, sp->length);
7801 if ((stcb->sctp_socketcxx . . $ sctp_tcb#sctp_socket. != NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!) &&
7802 ((stcb->sctp_epcxx . . $ sctp_tcb#sctp_ep.->sctp_flagscxx . . $ sctp_inpcb#sctp_flags. & SCTP_PCB_FLAGS_TCPTYPEcxx . . $ `usrsctplib/netinet/sctp.h:524:9`!) ||
7803 (stcb->sctp_epcxx . . $ sctp_tcb#sctp_ep.->sctp_flagscxx . . $ sctp_inpcb#sctp_flags. & SCTP_PCB_FLAGS_IN_TCPPOOLcxx . . $ `usrsctplib/netinet/sctp.h:535:9`!))) {
7804 atomic_subtract_intcxx . . $ `usrsctplib/user_atomic.h:97:9`!(&stcb->sctp_socket->so_snd.sb_cc, sp->length);
7805 }
7806 if (sp->datacxx . . $ sctp_stream_queue_pending#data.) {
7807 sctp_m_freemcxx . . $ `usrsctplib/netinet/sctputil.h:57:9`!(sp->datacxx . . $ sctp_stream_queue_pending#data.);
7808 sp->datacxx . . $ sctp_stream_queue_pending#data. = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!;
7809 sp->tail_mbufcxx . . $ sctp_stream_queue_pending#tail_mbuf. = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!;
7810 }
7811 sp->lengthcxx . . $ sctp_stream_queue_pending#length. = 0;
7812 sp->some_takencxx . . $ sctp_stream_queue_pending#some_taken. = 1;
7813 *giveup = 1;
7814 to_move = 0;
7815 goto out_of;
7816 }
7817 }
7818 some_taken = sp->some_takencxx . . $ sctp_stream_queue_pending#some_taken.;
7819 re_look:
7820 length = sp->lengthcxx . . $ sctp_stream_queue_pending#length.;
7821 if (sp->msg_is_completecxx . . $ sctp_stream_queue_pending#msg_is_complete.) {
7822 /* The message is complete */
7823 to_move = mincxx . . $ `usrsctplib/user_environment.h:66:9`!(length, frag_point);
7824 if (to_move == length) {
7825 /* All of it fits in the MTU */
7826 if (sp->some_takencxx . . $ sctp_stream_queue_pending#some_taken.) {
7827 rcv_flags |= SCTP_DATA_LAST_FRAGcxx . . $ `usrsctplib/netinet/sctp.h:507:9`!;
7828 } else {
7829 rcv_flags |= SCTP_DATA_NOT_FRAGcxx . . $ `usrsctplib/netinet/sctp.h:509:9`!;
7830 }
7831 sp->put_last_outcxx . . $ sctp_stream_queue_pending#put_last_out. = 1;
7832 if (sp->sinfo_flagscxx . . $ sctp_stream_queue_pending#sinfo_flags. & SCTP_SACK_IMMEDIATELYcxx . . $ `./netinet/sctp_uio.h:268:9`!) {
7833 rcv_flags |= SCTP_DATA_SACK_IMMEDIATELYcxx . . $ `usrsctplib/netinet/sctp.h:511:9`!;
7834 }
7835 } else {
7836 /* Not all of it fits, we fragment */
7837 if (sp->some_takencxx . . $ sctp_stream_queue_pending#some_taken. == 0) {
7838 rcv_flags |= SCTP_DATA_FIRST_FRAGcxx . . $ `usrsctplib/netinet/sctp.h:508:9`!;
7839 }
7840 sp->some_takencxx . . $ sctp_stream_queue_pending#some_taken. = 1;
7841 }
7842 } else {
7843 to_move = sctp_can_we_split_thiscxx . . $ sctp_can_we_split_this(8761b9c6c397f07).(stcb, length, space_left, frag_point, eeor_mode);
7844 if (to_move) {
7845 /*-
7846 * We use a snapshot of length in case it
7847 * is expanding during the compare.
7848 */
7849 uint32_tcxx . . $ uint32_t# llen;
7850
7851 llen = length;
7852 if (to_move >= llen) {
7853 to_move = llen;
7854 if (send_lock_up == 0) {
7855 /*-
7856 * We are taking all of an incomplete msg
7857 * thus we need a send lock.
7858 */
7859 SCTP_TCB_SEND_LOCKcxx . . $ `usrsctplib/netinet/sctp_process_lock.h:403:9`!(stcb);
7860 send_lock_up = 1;
7861 if (sp->msg_is_completecxx . . $ sctp_stream_queue_pending#msg_is_complete.) {
7862 /* the sender finished the msg */
7863 goto re_look;
7864 }
7865 }
7866 }
7867 if (sp->some_takencxx . . $ sctp_stream_queue_pending#some_taken. == 0) {
7868 rcv_flags |= SCTP_DATA_FIRST_FRAGcxx . . $ `usrsctplib/netinet/sctp.h:508:9`!;
7869 sp->some_takencxx . . $ sctp_stream_queue_pending#some_taken. = 1;
7870 }
7871 } else {
7872 /* Nothing to take. */
7873 *giveup = 1;
7874 to_move = 0;
7875 goto out_of;
7876 }
7877 }
7878
7879 /* If we reach here, we can copy out a chunk */
7880 sctp_alloc_a_chunkcxx . . $ `usrsctplib/netinet/sctp_var.h:170:9`!(stcb, chk);
7881 if (chk == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!) {
7882 /* No chunk memory */
7883 *giveup = 1;
7884 to_move = 0;
7885 goto out_of;
7886 }
7887 /* Setup for unordered if needed by looking
7888 * at the user sent info flags.
7889 */
7890 if (sp->sinfo_flagscxx . . $ sctp_stream_queue_pending#sinfo_flags. & SCTP_UNORDEREDcxx . . $ `./netinet/sctp_uio.h:264:9`!) {
7891 rcv_flags |= SCTP_DATA_UNORDEREDcxx . . $ `usrsctplib/netinet/sctp.h:510:9`!;
7892 }
7893 if (SCTP_BASE_SYSCTLcxx . . $ `usrsctplib/netinet/sctp_os_userspace.h:579:9`!(sctp_enable_sack_immediately) &&
7894 (sp->sinfo_flagscxx . . $ sctp_stream_queue_pending#sinfo_flags. & SCTP_EOFcxx . . $ `./netinet/sctp_uio.h:262:9`!) == SCTP_EOFcxx . . $ `./netinet/sctp_uio.h:262:9`!) {
7895 rcv_flags |= SCTP_DATA_SACK_IMMEDIATELYcxx . . $ `usrsctplib/netinet/sctp.h:511:9`!;
7896 }
7897 /* clear out the chunk before setting up */
7898 memsetcxx . . $ memset(d1de1e4fb215f1c6).(chk, 0, sizeof(*chk));
7899 chk->reccxx . . $ sctp_tmit_chunk#rec..datacxx . . $ sctp_tmit_chunk#$anonymous_type_3#data..rcv_flagscxx . . $ sctp_data_chunkrec#rcv_flags. = rcv_flags;
7900
7901 if (to_move >= length) {
7902 /* we think we can steal the whole thing */
7903 if ((sp->sender_all_donecxx . . $ sctp_stream_queue_pending#sender_all_done. == 0) && (send_lock_up == 0)) {
7904 SCTP_TCB_SEND_LOCKcxx . . $ `usrsctplib/netinet/sctp_process_lock.h:403:9`!(stcb);
7905 send_lock_up = 1;
7906 }
7907 if (to_move < sp->lengthcxx . . $ sctp_stream_queue_pending#length.) {
7908 /* bail, it changed */
7909 goto dont_do_it;
7910 }
7911 chk->datacxx . . $ sctp_tmit_chunk#data. = sp->datacxx . . $ sctp_stream_queue_pending#data.;
7912 chk->last_mbufcxx . . $ sctp_tmit_chunk#last_mbuf. = sp->tail_mbufcxx . . $ sctp_stream_queue_pending#tail_mbuf.;
7913 /* register the stealing */
7914 sp->datacxx . . $ sctp_stream_queue_pending#data. = sp->tail_mbufcxx . . $ sctp_stream_queue_pending#tail_mbuf. = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!;
7915 } else {
7916 struct mbufcxx . . $ mbuf# *m;
7917 dont_do_it:
7918 chk->datacxx . . $ sctp_tmit_chunk#data. = SCTP_M_COPYMcxx . . $ `usrsctplib/netinet/sctp_os_userspace.h:759:9`!(sp->datacxx . . $ sctp_stream_queue_pending#data., 0, to_move, M_NOWAITcxx . . $ `usrsctplib/user_malloc.h:60:9`!);
7919 chk->last_mbufcxx . . $ sctp_tmit_chunk#last_mbuf. = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!;
7920 if (chk->datacxx . . $ sctp_tmit_chunk#data. == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!) {
7921 sp->some_takencxx . . $ sctp_stream_queue_pending#some_taken. = some_taken;
7922 sctp_free_a_chunkcxx . . $ `usrsctplib/netinet/sctp_var.h:144:9`!(stcb, chk, so_locked);
7923 *bail = 1;
7924 to_move = 0;
7925 goto out_of;
7926 }
7927 #ifdef SCTP_MBUF_LOGGING
7928 if (SCTP_BASE_SYSCTL(sctp_logging_level) & SCTP_MBUF_LOGGING_ENABLE) {
7929 sctp_log_mbc(chk->data, SCTP_MBUF_ICOPY);
7930 }
7931 #endif
7932 /* Pull off the data */
7933 m_adjcxx . . $ m_adj(4e734734e44217f4).(sp->datacxx . . $ sctp_stream_queue_pending#data., to_move);
7934 /* Now lets work our way down and compact it */
7935 m = sp->datacxx . . $ sctp_stream_queue_pending#data.;
7936 while (m && (SCTP_BUF_LENcxx . . $ `usrsctplib/netinet/sctp_os_userspace.h:790:9`!(m) == 0)) {
7937 sp->datacxx . . $ sctp_stream_queue_pending#data. = SCTP_BUF_NEXTcxx . . $ `usrsctplib/netinet/sctp_os_userspace.h:791:9`!(m);
7938 SCTP_BUF_NEXTcxx . . $ `usrsctplib/netinet/sctp_os_userspace.h:791:9`!(m) = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!;
7939 if (sp->tail_mbufcxx . . $ sctp_stream_queue_pending#tail_mbuf. == m) {
7940 /*-
7941 * Freeing tail? TSNH since
7942 * we supposedly were taking less
7943 * than the sp->length.
7944 */
7945 #ifdef INVARIANTS
7946 panic("Huh, freing tail? - TSNH");
7947 #else
7948 SCTP_PRINTFcxx . . $ `usrsctplib/netinet/sctp_os_userspace.h:536:9`!("Huh, freeing tail? - TSNH\n");
7949 sp->tail_mbufcxx . . $ sctp_stream_queue_pending#tail_mbuf. = sp->datacxx . . $ sctp_stream_queue_pending#data. = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!;
7950 sp->lengthcxx . . $ sctp_stream_queue_pending#length. = 0;
7951 #endif
7952 }
7953 sctp_m_freecxx . . $ `usrsctplib/netinet/sctputil.h:56:9`!(m);
7954 m = sp->datacxx . . $ sctp_stream_queue_pending#data.;
7955 }
7956 }
7957 if (SCTP_BUF_IS_EXTENDEDcxx . . $ `usrsctplib/netinet/sctp_os_userspace.h:795:9`!(chk->data)) {
7958 chk->copy_by_refcxx . . $ sctp_tmit_chunk#copy_by_ref. = 1;
7959 } else {
7960 chk->copy_by_refcxx . . $ sctp_tmit_chunk#copy_by_ref. = 0;
7961 }
7962 /* get last_mbuf and counts of mb usage
7963 * This is ugly but hopefully its only one mbuf.
7964 */
7965 if (chk->last_mbufcxx . . $ sctp_tmit_chunk#last_mbuf. == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!) {
7966 chk->last_mbufcxx . . $ sctp_tmit_chunk#last_mbuf. = chk->datacxx . . $ sctp_tmit_chunk#data.;
7967 while (SCTP_BUF_NEXTcxx . . $ `usrsctplib/netinet/sctp_os_userspace.h:791:9`!(chk->last_mbuf) != NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!) {
7968 chk->last_mbufcxx . . $ sctp_tmit_chunk#last_mbuf. = SCTP_BUF_NEXTcxx . . $ `usrsctplib/netinet/sctp_os_userspace.h:791:9`!(chk->last_mbuf);
7969 }
7970 }
7971
7972 if (to_move > length) {
7973 /*- This should not happen either
7974 * since we always lower to_move to the size
7975 * of sp->length if its larger.
7976 */
7977 #ifdef INVARIANTS
7978 panic("Huh, how can to_move be larger?");
7979 #else
7980 SCTP_PRINTFcxx . . $ `usrsctplib/netinet/sctp_os_userspace.h:536:9`!("Huh, how can to_move be larger?\n");
7981 sp->lengthcxx . . $ sctp_stream_queue_pending#length. = 0;
7982 #endif
7983 } else {
7984 atomic_subtract_intcxx . . $ `usrsctplib/user_atomic.h:97:9`!(&sp->length, to_move);
7985 }
7986 leading = SCTP_DATA_CHUNK_OVERHEADcxx . . $ `usrsctplib/netinet/sctp_output.h:137:9`!(stcb);
7987 if (M_LEADINGSPACEcxx . . $ `usrsctplib/user_mbuf.h:343:9`!(chk->data) < leading) {
7988 /* Not enough room for a chunk header, get some */
7989 struct mbufcxx . . $ mbuf# *m;
7990
7991 m = sctp_get_mbuf_for_msgcxx . . $ sctp_get_mbuf_for_msg(c7c30fc329598377).(1, 0, M_NOWAITcxx . . $ `usrsctplib/user_malloc.h:60:9`!, 1, MT_DATAcxx . . $ `usrsctplib/user_mbuf.h:289:9`!);
7992 if (m == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!) {
7993 /*
7994 * we're in trouble here. _PREPEND below will free
7995 * all the data if there is no leading space, so we
7996 * must put the data back and restore.
7997 */
7998 if (send_lock_up == 0) {
7999 SCTP_TCB_SEND_LOCKcxx . . $ `usrsctplib/netinet/sctp_process_lock.h:403:9`!(stcb);
8000 send_lock_up = 1;
8001 }
8002 if (sp->datacxx . . $ sctp_stream_queue_pending#data. == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!) {
8003 /* unsteal the data */
8004 sp->datacxx . . $ sctp_stream_queue_pending#data. = chk->datacxx . . $ sctp_tmit_chunk#data.;
8005 sp->tail_mbufcxx . . $ sctp_stream_queue_pending#tail_mbuf. = chk->last_mbufcxx . . $ sctp_tmit_chunk#last_mbuf.;
8006 } else {
8007 struct mbufcxx . . $ mbuf# *m_tmp;
8008 /* reassemble the data */
8009 m_tmp = sp->datacxx . . $ sctp_stream_queue_pending#data.;
8010 sp->datacxx . . $ sctp_stream_queue_pending#data. = chk->datacxx . . $ sctp_tmit_chunk#data.;
8011 SCTP_BUF_NEXTcxx . . $ `usrsctplib/netinet/sctp_os_userspace.h:791:9`!(chk->last_mbuf) = m_tmp;
8012 }
8013 sp->some_takencxx . . $ sctp_stream_queue_pending#some_taken. = some_taken;
8014 atomic_add_intcxx . . $ `usrsctplib/user_atomic.h:94:9`!(&sp->length, to_move);
8015 chk->datacxx . . $ sctp_tmit_chunk#data. = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!;
8016 *bail = 1;
8017 sctp_free_a_chunkcxx . . $ `usrsctplib/netinet/sctp_var.h:144:9`!(stcb, chk, so_locked);
8018 to_move = 0;
8019 goto out_of;
8020 } else {
8021 SCTP_BUF_LENcxx . . $ `usrsctplib/netinet/sctp_os_userspace.h:790:9`!(m) = 0;
8022 SCTP_BUF_NEXTcxx . . $ `usrsctplib/netinet/sctp_os_userspace.h:791:9`!(m) = chk->datacxx . . $ sctp_tmit_chunk#data.;
8023 chk->datacxx . . $ sctp_tmit_chunk#data. = m;
8024 M_ALIGNcxx . . $ `usrsctplib/user_mbuf.h:388:9`!(chk->data, 4);
8025 }
8026 }
8027 SCTP_BUF_PREPENDcxx . . $ `usrsctplib/netinet/sctp_os_userspace.h:799:9`!(chk->data, SCTP_DATA_CHUNK_OVERHEADcxx . . $ `usrsctplib/netinet/sctp_output.h:137:9`!(stcb), M_NOWAITcxx . . $ `usrsctplib/user_malloc.h:60:9`!);
8028 if (chk->datacxx . . $ sctp_tmit_chunk#data. == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!) {
8029 /* HELP, TSNH since we assured it would not above? */
8030 #ifdef INVARIANTS
8031 panic("prepend failes HELP?");
8032 #else
8033 SCTP_PRINTFcxx . . $ `usrsctplib/netinet/sctp_os_userspace.h:536:9`!("prepend fails HELP?\n");
8034 sctp_free_a_chunkcxx . . $ `usrsctplib/netinet/sctp_var.h:144:9`!(stcb, chk, so_locked);
8035 #endif
8036 *bail = 1;
8037 to_move = 0;
8038 goto out_of;
8039 }
8040 sctp_snd_sb_alloccxx . . $ `usrsctplib/netinet/sctputil.h:327:9`!(stcb, SCTP_DATA_CHUNK_OVERHEADcxx . . $ `usrsctplib/netinet/sctp_output.h:137:9`!(stcb));
8041 chk->book_sizecxx . . $ sctp_tmit_chunk#book_size. = chk->send_sizecxx . . $ sctp_tmit_chunk#send_size. = (uint16_tcxx . . $ uint16_t#)(to_move + SCTP_DATA_CHUNK_OVERHEADcxx . . $ `usrsctplib/netinet/sctp_output.h:137:9`!(stcb));
8042 chk->book_size_scalecxx . . $ sctp_tmit_chunk#book_size_scale. = 0;
8043 chk->sentcxx . . $ sctp_tmit_chunk#sent. = SCTP_DATAGRAM_UNSENTcxx . . $ `usrsctplib/netinet/sctp_constants.h:353:9`!;
8044
8045 chk->flagscxx . . $ sctp_tmit_chunk#flags. = 0;
8046 chk->asoccxx . . $ sctp_tmit_chunk#asoc. = &stcb->asoccxx . . $ sctp_tcb#asoc.;
8047 chk->pad_inplacecxx . . $ sctp_tmit_chunk#pad_inplace. = 0;
8048 chk->no_fr_allowedcxx . . $ sctp_tmit_chunk#no_fr_allowed. = 0;
8049 if (stcb->asoccxx . . $ sctp_tcb#asoc..idata_supportedcxx . . $ sctp_association#idata_supported. == 0) {
8050 if (rcv_flags & SCTP_DATA_UNORDEREDcxx . . $ `usrsctplib/netinet/sctp.h:510:9`!) {
8051 /* Just use 0. The receiver ignores the values. */
8052 chk->reccxx . . $ sctp_tmit_chunk#rec..datacxx . . $ sctp_tmit_chunk#$anonymous_type_3#data..midcxx . . $ sctp_data_chunkrec#mid. = 0;
8053 } else {
8054 chk->reccxx . . $ sctp_tmit_chunk#rec..datacxx . . $ sctp_tmit_chunk#$anonymous_type_3#data..midcxx . . $ sctp_data_chunkrec#mid. = strq->next_mid_orderedcxx . . $ sctp_stream_out#next_mid_ordered.;
8055 if (rcv_flags & SCTP_DATA_LAST_FRAGcxx . . $ `usrsctplib/netinet/sctp.h:507:9`!) {
8056 strq->next_mid_orderedcxx . . $ sctp_stream_out#next_mid_ordered.++;
8057 }
8058 }
8059 } else {
8060 if (rcv_flags & SCTP_DATA_UNORDEREDcxx . . $ `usrsctplib/netinet/sctp.h:510:9`!) {
8061 chk->reccxx . . $ sctp_tmit_chunk#rec..datacxx . . $ sctp_tmit_chunk#$anonymous_type_3#data..midcxx . . $ sctp_data_chunkrec#mid. = strq->next_mid_unorderedcxx . . $ sctp_stream_out#next_mid_unordered.;
8062 if (rcv_flags & SCTP_DATA_LAST_FRAGcxx . . $ `usrsctplib/netinet/sctp.h:507:9`!) {
8063 strq->next_mid_unorderedcxx . . $ sctp_stream_out#next_mid_unordered.++;
8064 }
8065 } else {
8066 chk->reccxx . . $ sctp_tmit_chunk#rec..datacxx . . $ sctp_tmit_chunk#$anonymous_type_3#data..midcxx . . $ sctp_data_chunkrec#mid. = strq->next_mid_orderedcxx . . $ sctp_stream_out#next_mid_ordered.;
8067 if (rcv_flags & SCTP_DATA_LAST_FRAGcxx . . $ `usrsctplib/netinet/sctp.h:507:9`!) {
8068 strq->next_mid_orderedcxx . . $ sctp_stream_out#next_mid_ordered.++;
8069 }
8070 }
8071 }
8072 chk->reccxx . . $ sctp_tmit_chunk#rec..datacxx . . $ sctp_tmit_chunk#$anonymous_type_3#data..sidcxx . . $ sctp_data_chunkrec#sid. = sp->sidcxx . . $ sctp_stream_queue_pending#sid.;
8073 chk->reccxx . . $ sctp_tmit_chunk#rec..datacxx . . $ sctp_tmit_chunk#$anonymous_type_3#data..ppidcxx . . $ sctp_data_chunkrec#ppid. = sp->ppidcxx . . $ sctp_stream_queue_pending#ppid.;
8074 chk->reccxx . . $ sctp_tmit_chunk#rec..datacxx . . $ sctp_tmit_chunk#$anonymous_type_3#data..contextcxx . . $ sctp_data_chunkrec#context. = sp->contextcxx . . $ sctp_stream_queue_pending#context.;
8075 chk->reccxx . . $ sctp_tmit_chunk#rec..datacxx . . $ sctp_tmit_chunk#$anonymous_type_3#data..doing_fast_retransmitcxx . . $ sctp_data_chunkrec#doing_fast_retransmit. = 0;
8076
8077 chk->reccxx . . $ sctp_tmit_chunk#rec..datacxx . . $ sctp_tmit_chunk#$anonymous_type_3#data..timetodropcxx . . $ sctp_data_chunkrec#timetodrop. = sp->tscxx . . $ sctp_stream_queue_pending#ts.;
8078 chk->flagscxx . . $ sctp_tmit_chunk#flags. = sp->act_flagscxx . . $ sctp_stream_queue_pending#act_flags.;
8079
8080 if (sp->netcxx . . $ sctp_stream_queue_pending#net.) {
8081 chk->whoTocxx . . $ sctp_tmit_chunk#whoTo. = sp->netcxx . . $ sctp_stream_queue_pending#net.;
8082 atomic_add_intcxx . . $ `usrsctplib/user_atomic.h:94:9`!(&chk->whoTo->ref_count, 1);
8083 } else
8084 chk->whoTocxx . . $ sctp_tmit_chunk#whoTo. = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!;
8085
8086 if (sp->holds_key_refcxx . . $ sctp_stream_queue_pending#holds_key_ref.) {
8087 chk->auth_keyidcxx . . $ sctp_tmit_chunk#auth_keyid. = sp->auth_keyidcxx . . $ sctp_stream_queue_pending#auth_keyid.;
8088 sctp_auth_key_acquirecxx . . $ sctp_auth_key_acquire(f17400a79897d6ee).(stcb, chk->auth_keyidcxx . . $ sctp_tmit_chunk#auth_keyid.);
8089 chk->holds_key_refcxx . . $ sctp_tmit_chunk#holds_key_ref. = 1;
8090 }
8091 #if defined(__FreeBSD__) && !defined(__Userspace__cxx . . $ `<built-in>:442:9`!)
8092 chk->rec.data.tsn = atomic_fetchadd_int(&asoc->sending_seq, 1);
8093 #else
8094 chk->reccxx . . $ sctp_tmit_chunk#rec..datacxx . . $ sctp_tmit_chunk#$anonymous_type_3#data..tsncxx . . $ sctp_data_chunkrec#tsn. = asoc->sending_seqcxx . . $ sctp_association#sending_seq.++;
8095 #endif
8096 if (SCTP_BASE_SYSCTLcxx . . $ `usrsctplib/netinet/sctp_os_userspace.h:579:9`!(sctp_logging_level) & SCTP_LOG_AT_SEND_2_OUTQcxx . . $ `usrsctplib/netinet/sctp.h:663:9`!) {
8097 sctp_misc_intscxx . . $ sctp_misc_ints(da1ccf5149f5690e).(SCTP_STRMOUT_LOG_SENDcxx . . $ `usrsctplib/netinet/sctp_constants.h:215:9`!,
8098 (uint32_tcxx . . $ uint32_t#)(uintptr_tcxx . . $ uintptr_t#)stcb, sp->lengthcxx . . $ sctp_stream_queue_pending#length.,
8099 (uint32_tcxx . . $ uint32_t#)((chk->reccxx . . $ sctp_tmit_chunk#rec..datacxx . . $ sctp_tmit_chunk#$anonymous_type_3#data..sidcxx . . $ sctp_data_chunkrec#sid. << 16) | (0x0000ffff & chk->reccxx . . $ sctp_tmit_chunk#rec..datacxx . . $ sctp_tmit_chunk#$anonymous_type_3#data..midcxx . . $ sctp_data_chunkrec#mid.)),
8100 chk->reccxx . . $ sctp_tmit_chunk#rec..datacxx . . $ sctp_tmit_chunk#$anonymous_type_3#data..tsncxx . . $ sctp_data_chunkrec#tsn.);
8101 }
8102 if (stcb->asoccxx . . $ sctp_tcb#asoc..idata_supportedcxx . . $ sctp_association#idata_supported. == 0) {
8103 dchkh = mtodcxx . . $ `usrsctplib/user_mbuf.h:96:9`!(chk->data, struct sctp_data_chunk *);
8104 } else {
8105 ndchkh = mtodcxx . . $ `usrsctplib/user_mbuf.h:96:9`!(chk->data, struct sctp_idata_chunk *);
8106 }
8107 /*
8108 * Put the rest of the things in place now. Size was done
8109 * earlier in previous loop prior to padding.
8110 */
8111
8112 #ifdef SCTP_ASOCLOG_OF_TSNS
8113 SCTP_TCB_LOCK_ASSERT(stcb);
8114 if (asoc->tsn_out_at >= SCTP_TSN_LOG_SIZE) {
8115 asoc->tsn_out_at = 0;
8116 asoc->tsn_out_wrapped = 1;
8117 }
8118 asoc->out_tsnlog[asoc->tsn_out_at].tsn = chk->rec.data.tsn;
8119 asoc->out_tsnlog[asoc->tsn_out_at].strm = chk->rec.data.sid;
8120 asoc->out_tsnlog[asoc->tsn_out_at].seq = chk->rec.data.mid;
8121 asoc->out_tsnlog[asoc->tsn_out_at].sz = chk->send_size;
8122 asoc->out_tsnlog[asoc->tsn_out_at].flgs = chk->rec.data.rcv_flags;
8123 asoc->out_tsnlog[asoc->tsn_out_at].stcb = (void *)stcb;
8124 asoc->out_tsnlog[asoc->tsn_out_at].in_pos = asoc->tsn_out_at;
8125 asoc->out_tsnlog[asoc->tsn_out_at].in_out = 2;
8126 asoc->tsn_out_at++;
8127 #endif
8128 if (stcb->asoccxx . . $ sctp_tcb#asoc..idata_supportedcxx . . $ sctp_association#idata_supported. == 0) {
8129 dchkh->chcxx . . $ sctp_data_chunk#ch..chunk_typecxx . . $ sctp_chunkhdr#chunk_type. = SCTP_DATAcxx . . $ `usrsctplib/netinet/sctp.h:449:9`!;
8130 dchkh->chcxx . . $ sctp_data_chunk#ch..chunk_flagscxx . . $ sctp_chunkhdr#chunk_flags. = chk->reccxx . . $ sctp_tmit_chunk#rec..datacxx . . $ sctp_tmit_chunk#$anonymous_type_3#data..rcv_flagscxx . . $ sctp_data_chunkrec#rcv_flags.;
8131 dchkh->dpcxx . . $ sctp_data_chunk#dp..tsncxx . . $ sctp_data#tsn. = htonlcxx . . $ htonl(2141b656ce2cc063).(chk->reccxx . . $ sctp_tmit_chunk#rec..datacxx . . $ sctp_tmit_chunk#$anonymous_type_3#data..tsncxx . . $ sctp_data_chunkrec#tsn.);
8132 dchkh->dpcxx . . $ sctp_data_chunk#dp..sidcxx . . $ sctp_data#sid. = htonscxx . . $ htons(a18c05e4017afb3d).(strq->sidcxx . . $ sctp_stream_out#sid.);
8133 dchkh->dpcxx . . $ sctp_data_chunk#dp..ssncxx . . $ sctp_data#ssn. = htonscxx . . $ htons(a18c05e4017afb3d).((uint16_tcxx . . $ uint16_t#)chk->reccxx . . $ sctp_tmit_chunk#rec..datacxx . . $ sctp_tmit_chunk#$anonymous_type_3#data..midcxx . . $ sctp_data_chunkrec#mid.);
8134 dchkh->dpcxx . . $ sctp_data_chunk#dp..ppidcxx . . $ sctp_data#ppid. = chk->reccxx . . $ sctp_tmit_chunk#rec..datacxx . . $ sctp_tmit_chunk#$anonymous_type_3#data..ppidcxx . . $ sctp_data_chunkrec#ppid.;
8135 dchkh->chcxx . . $ sctp_data_chunk#ch..chunk_lengthcxx . . $ sctp_chunkhdr#chunk_length. = htonscxx . . $ htons(a18c05e4017afb3d).(chk->send_sizecxx . . $ sctp_tmit_chunk#send_size.);
8136 } else {
8137 ndchkh->chcxx . . $ sctp_idata_chunk#ch..chunk_typecxx . . $ sctp_chunkhdr#chunk_type. = SCTP_IDATAcxx . . $ `usrsctplib/netinet/sctp.h:469:9`!;
8138 ndchkh->chcxx . . $ sctp_idata_chunk#ch..chunk_flagscxx . . $ sctp_chunkhdr#chunk_flags. = chk->reccxx . . $ sctp_tmit_chunk#rec..datacxx . . $ sctp_tmit_chunk#$anonymous_type_3#data..rcv_flagscxx . . $ sctp_data_chunkrec#rcv_flags.;
8139 ndchkh->dpcxx . . $ sctp_idata_chunk#dp..tsncxx . . $ sctp_idata#tsn. = htonlcxx . . $ htonl(2141b656ce2cc063).(chk->reccxx . . $ sctp_tmit_chunk#rec..datacxx . . $ sctp_tmit_chunk#$anonymous_type_3#data..tsncxx . . $ sctp_data_chunkrec#tsn.);
8140 ndchkh->dpcxx . . $ sctp_idata_chunk#dp..sidcxx . . $ sctp_idata#sid. = htonscxx . . $ htons(a18c05e4017afb3d).(strq->sidcxx . . $ sctp_stream_out#sid.);
8141 ndchkh->dpcxx . . $ sctp_idata_chunk#dp..reservedcxx . . $ sctp_idata#reserved. = htonscxx . . $ htons(a18c05e4017afb3d).(0);
8142 ndchkh->dpcxx . . $ sctp_idata_chunk#dp..midcxx . . $ sctp_idata#mid. = htonlcxx . . $ htonl(2141b656ce2cc063).(chk->reccxx . . $ sctp_tmit_chunk#rec..datacxx . . $ sctp_tmit_chunk#$anonymous_type_3#data..midcxx . . $ sctp_data_chunkrec#mid.);
8143 if (sp->fsncxx . . $ sctp_stream_queue_pending#fsn. == 0)
8144 ndchkh->dpcxx . . $ sctp_idata_chunk#dp..ppid_fsncxx . . $ sctp_idata#ppid_fsn..ppidcxx . . $ sctp_idata#$anonymous_type_0#ppid. = chk->reccxx . . $ sctp_tmit_chunk#rec..datacxx . . $ sctp_tmit_chunk#$anonymous_type_3#data..ppidcxx . . $ sctp_data_chunkrec#ppid.;
8145 else
8146 ndchkh->dpcxx . . $ sctp_idata_chunk#dp..ppid_fsncxx . . $ sctp_idata#ppid_fsn..fsncxx . . $ sctp_idata#$anonymous_type_0#fsn. = htonlcxx . . $ htonl(2141b656ce2cc063).(sp->fsncxx . . $ sctp_stream_queue_pending#fsn.);
8147 sp->fsncxx . . $ sctp_stream_queue_pending#fsn.++;
8148 ndchkh->chcxx . . $ sctp_idata_chunk#ch..chunk_lengthcxx . . $ sctp_chunkhdr#chunk_length. = htonscxx . . $ htons(a18c05e4017afb3d).(chk->send_sizecxx . . $ sctp_tmit_chunk#send_size.);
8149 }
8150 /* Now advance the chk->send_size by the actual pad needed. */
8151 if (chk->send_sizecxx . . $ sctp_tmit_chunk#send_size. < SCTP_SIZE32cxx . . $ `usrsctplib/netinet/sctp_constants.h:388:9`!(chk->book_size)) {
8152 /* need a pad */
8153 struct mbufcxx . . $ mbuf# *lm;
8154 int pads;
8155
8156 pads = SCTP_SIZE32cxx . . $ `usrsctplib/netinet/sctp_constants.h:388:9`!(chk->book_size) - chk->send_sizecxx . . $ sctp_tmit_chunk#send_size.;
8157 lm = sctp_pad_lastmbufcxx . . $ sctp_pad_lastmbuf(d56025566d40237d).(chk->datacxx . . $ sctp_tmit_chunk#data., pads, chk->last_mbufcxx . . $ sctp_tmit_chunk#last_mbuf.);
8158 if (lm != NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!) {
8159 chk->last_mbufcxx . . $ sctp_tmit_chunk#last_mbuf. = lm;
8160 chk->pad_inplacecxx . . $ sctp_tmit_chunk#pad_inplace. = 1;
8161 }
8162 chk->send_sizecxx . . $ sctp_tmit_chunk#send_size. += pads;
8163 }
8164 if (PR_SCTP_ENABLEDcxx . . $ `./netinet/sctp_uio.h:286:9`!(chk->flags)) {
8165 asoc->pr_sctp_cntcxx . . $ sctp_association#pr_sctp_cnt.++;
8166 }
8167 if (sp->msg_is_completecxx . . $ sctp_stream_queue_pending#msg_is_complete. && (sp->lengthcxx . . $ sctp_stream_queue_pending#length. == 0) && (sp->sender_all_donecxx . . $ sctp_stream_queue_pending#sender_all_done.)) {
8168 /* All done pull and kill the message */
8169 if (sp->put_last_outcxx . . $ sctp_stream_queue_pending#put_last_out. == 0) {
8170 SCTP_PRINTFcxx . . $ `usrsctplib/netinet/sctp_os_userspace.h:536:9`!("Gak, put out entire msg with NO end!-2\n");
8171 SCTP_PRINTFcxx . . $ `usrsctplib/netinet/sctp_os_userspace.h:536:9`!("sender_done:%d len:%d msg_comp:%d put_last_out:%d send_lock:%d\n",
8172 sp->sender_all_done,
8173 sp->length,
8174 sp->msg_is_complete,
8175 sp->put_last_out,
8176 send_lock_up);
8177 }
8178 if ((send_lock_up == 0) && (TAILQ_NEXTcxx . . $ `<external>/2546723208511035544/queue.h:459:9`!(sp, next) == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!)) {
8179 SCTP_TCB_SEND_LOCKcxx . . $ `usrsctplib/netinet/sctp_process_lock.h:403:9`!(stcb);
8180 send_lock_up = 1;
8181 }
8182 atomic_subtract_intcxx . . $ `usrsctplib/user_atomic.h:97:9`!(&asoc->stream_queue_cnt, 1);
8183 TAILQ_REMOVEcxx . . $ `<external>/2546723208511035544/queue.h:426:9`!(&strq->outqueue, sp, next);
8184 stcb->asoccxx . . $ sctp_tcb#asoc..ss_functionscxx . . $ sctp_association#ss_functions..sctp_ss_remove_from_streamcxx . . $ sctp_ss_functions#sctp_ss_remove_from_stream.(stcb, asoc, strq, sp, send_lock_up);
8185 if ((strq->statecxx . . $ sctp_stream_out#state. == SCTP_STREAM_RESET_PENDINGcxx . . $ `usrsctplib/netinet/sctp_structs.h:651:9`!) &&
8186 (strq->chunks_on_queuescxx . . $ sctp_stream_out#chunks_on_queues. == 0) &&
8187 TAILQ_EMPTYcxx . . $ `<external>/2546723208511035544/queue.h:457:9`!(&strq->outqueue)) {
8188 stcb->asoccxx . . $ sctp_tcb#asoc..trigger_resetcxx . . $ sctp_association#trigger_reset. = 1;
8189 }
8190 if (sp->netcxx . . $ sctp_stream_queue_pending#net.) {
8191 sctp_free_remote_addrcxx . . $ `usrsctplib/netinet/sctp_var.h:229:9`!(sp->net);
8192 sp->netcxx . . $ sctp_stream_queue_pending#net. = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!;
8193 }
8194 if (sp->datacxx . . $ sctp_stream_queue_pending#data.) {
8195 sctp_m_freemcxx . . $ `usrsctplib/netinet/sctputil.h:57:9`!(sp->datacxx . . $ sctp_stream_queue_pending#data.);
8196 sp->datacxx . . $ sctp_stream_queue_pending#data. = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!;
8197 }
8198 sctp_free_a_strmoqcxx . . $ `usrsctplib/netinet/sctp_var.h:126:9`!(stcb, sp, so_locked);
8199 }
8200 asoc->chunks_on_out_queuecxx . . $ sctp_association#chunks_on_out_queue.++;
8201 strq->chunks_on_queuescxx . . $ sctp_stream_out#chunks_on_queues.++;
8202 TAILQ_INSERT_TAILcxx . . $ `<external>/2546723208511035544/queue.h:402:9`!(&asoc->send_queue, chk, sctp_next);
8203 asoc->send_queue_cntcxx . . $ sctp_association#send_queue_cnt.++;
8204 out_of:
8205 if (send_lock_up) {
8206 SCTP_TCB_SEND_UNLOCKcxx . . $ `usrsctplib/netinet/sctp_process_lock.h:405:9`!(stcb);
8207 }
8208 return (to_move);
8209 }
8210
8211 static void
8212 sctp_fill_outqueuecxx . . $ sctp_fill_outqueue(3baa703259065aa).(struct sctp_tcbcxx . . $ sctp_tcb# *stcb,
8213 struct sctp_netscxx . . $ sctp_nets# *net, int frag_point, int eeor_mode, int *quit_now, int so_locked)
8214 {
8215 struct sctp_associationcxx . . $ sctp_association# *asoc;
8216 struct sctp_stream_outcxx . . $ sctp_stream_out# *strq;
8217 uint32_tcxx . . $ uint32_t# space_left, moved, total_moved;
8218 int bail, giveup;
8219
8220 SCTP_TCB_LOCK_ASSERTcxx . . $ `usrsctplib/netinet/sctp_process_lock.h:478:9`!(stcb);
8221 asoc = &stcb->asoccxx . . $ sctp_tcb#asoc.;
8222 total_moved = 0;
8223 switch (net->rocxx . . $ sctp_nets#ro.._l_addrcxx . . $ sctp_net_route#_l_addr..sa.sa_familycxx . . $ sockaddr#sa_family.) {
8224 #ifdef INETcxx . . $ `<built-in>:431:9`!
8225 case AF_INETcxx . . $ `<external>/8962547315054503424/socket.h:97:9`!:
8226 space_left = net->mtucxx . . $ sctp_nets#mtu. - SCTP_MIN_V4_OVERHEADcxx . . $ `usrsctplib/netinet/sctp_header.h:585:9`!;
8227 break;
8228 #endif
8229 #ifdef INET6cxx . . $ `<built-in>:432:9`!
8230 case AF_INET6cxx . . $ `<external>/8962547315054503424/socket.h:105:9`!:
8231 space_left = net->mtucxx . . $ sctp_nets#mtu. - SCTP_MIN_OVERHEADcxx . . $ `usrsctplib/netinet/sctp_header.h:561:9`!;
8232 break;
8233 #endif
8234 #if defined(__Userspace__cxx . . $ `<built-in>:442:9`!)
8235 case AF_CONNcxx . . $ `usrsctplib/netinet/sctp_os_userspace.h:995:9`!:
8236 space_left = net->mtucxx . . $ sctp_nets#mtu. - sizeof(struct sctphdrcxx . . $ sctphdr#);
8237 break;
8238 #endif
8239 default:
8240 /* TSNH */
8241 space_left = net->mtucxx . . $ sctp_nets#mtu.;
8242 break;
8243 }
8244 /* Need an allowance for the data chunk header too */
8245 space_left -= SCTP_DATA_CHUNK_OVERHEADcxx . . $ `usrsctplib/netinet/sctp_output.h:137:9`!(stcb);
8246
8247 /* must make even word boundary */
8248 space_left &= 0xfffffffc;
8249 strq = stcb->asoccxx . . $ sctp_tcb#asoc..ss_functionscxx . . $ sctp_association#ss_functions..sctp_ss_select_streamcxx . . $ sctp_ss_functions#sctp_ss_select_stream.(stcb, net, asoc);
8250 giveup = 0;
8251 bail = 0;
8252 while ((space_left > 0) && (strq != NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!)) {
8253 moved = sctp_move_to_outqueuecxx . . $ sctp_move_to_outqueue(537d89157cb06edd).(stcb, strq, space_left, frag_point,
8254 &giveup, eeor_mode, &bail, so_locked);
8255 stcb->asoccxx . . $ sctp_tcb#asoc..ss_functionscxx . . $ sctp_association#ss_functions..sctp_ss_scheduledcxx . . $ sctp_ss_functions#sctp_ss_scheduled.(stcb, net, asoc, strq, moved);
8256 if ((giveup != 0) || (bail != 0)) {
8257 break;
8258 }
8259 strq = stcb->asoccxx . . $ sctp_tcb#asoc..ss_functionscxx . . $ sctp_association#ss_functions..sctp_ss_select_streamcxx . . $ sctp_ss_functions#sctp_ss_select_stream.(stcb, net, asoc);
8260 total_moved += moved;
8261 if (space_left >= moved) {
8262 space_left -= moved;
8263 } else {
8264 space_left = 0;
8265 }
8266 if (space_left >= SCTP_DATA_CHUNK_OVERHEADcxx . . $ `usrsctplib/netinet/sctp_output.h:137:9`!(stcb)) {
8267 space_left -= SCTP_DATA_CHUNK_OVERHEADcxx . . $ `usrsctplib/netinet/sctp_output.h:137:9`!(stcb);
8268 } else {
8269 space_left = 0;
8270 }
8271 space_left &= 0xfffffffc;
8272 }
8273 if (bail != 0)
8274 *quit_now = 1;
8275
8276 stcb->asoccxx . . $ sctp_tcb#asoc..ss_functionscxx . . $ sctp_association#ss_functions..sctp_ss_packet_donecxx . . $ sctp_ss_functions#sctp_ss_packet_done.(stcb, net, asoc);
8277
8278 if (total_moved == 0) {
8279 if ((stcb->asoccxx . . $ sctp_tcb#asoc..sctp_cmt_on_offcxx . . $ sctp_association#sctp_cmt_on_off. == 0) &&
8280 (net == stcb->asoccxx . . $ sctp_tcb#asoc..primary_destinationcxx . . $ sctp_association#primary_destination.)) {
8281 /* ran dry for primary network net */
8282 SCTP_STAT_INCRcxx . . $ `./netinet/sctp_uio.h:1111:9`!(sctps_primary_randry);
8283 } else if (stcb->asoccxx . . $ sctp_tcb#asoc..sctp_cmt_on_offcxx . . $ sctp_association#sctp_cmt_on_off. > 0) {
8284 /* ran dry with CMT on */
8285 SCTP_STAT_INCRcxx . . $ `./netinet/sctp_uio.h:1111:9`!(sctps_cmt_randry);
8286 }
8287 }
8288 }
8289
8290 void
8291 sctp_fix_ecn_echocxx . . $ sctp_fix_ecn_echo(63e1d2357fd698a9).(struct sctp_associationcxx . . $ sctp_association# *asoc)
8292 {
8293 struct sctp_tmit_chunkcxx . . $ sctp_tmit_chunk# *chk;
8294
8295 TAILQ_FOREACHcxx . . $ `<external>/2546723208511035544/queue.h:435:9`!(chk, &asoc->control_send_queue, sctp_next) {
8296 if (chk->reccxx . . $ sctp_tmit_chunk#rec..chunk_idcxx . . $ sctp_tmit_chunk#$anonymous_type_3#chunk_id..idcxx . . $ chk_id#id. == SCTP_ECN_ECHOcxx . . $ `usrsctplib/netinet/sctp.h:461:9`!) {
8297 chk->sentcxx . . $ sctp_tmit_chunk#sent. = SCTP_DATAGRAM_UNSENTcxx . . $ `usrsctplib/netinet/sctp_constants.h:353:9`!;
8298 }
8299 }
8300 }
8301
8302 void
8303 sctp_move_chunks_from_netcxx . . $ sctp_move_chunks_from_net(2ed2c3ddd2bbab6a).(struct sctp_tcbcxx . . $ sctp_tcb# *stcb, struct sctp_netscxx . . $ sctp_nets# *net)
8304 {
8305 struct sctp_associationcxx . . $ sctp_association# *asoc;
8306 struct sctp_tmit_chunkcxx . . $ sctp_tmit_chunk# *chk;
8307 struct sctp_stream_queue_pendingcxx . . $ sctp_stream_queue_pending# *sp;
8308 unsigned int i;
8309
8310 if (net == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!) {
8311 return;
8312 }
8313 asoc = &stcb->asoccxx . . $ sctp_tcb#asoc.;
8314 for (i = 0; i < stcb->asoccxx . . $ sctp_tcb#asoc..streamoutcntcxx . . $ sctp_association#streamoutcnt.; i++) {
8315 TAILQ_FOREACHcxx . . $ `<external>/2546723208511035544/queue.h:435:9`!(sp, &stcb->asoc.strmout[i].outqueue, next) {
8316 if (sp->netcxx . . $ sctp_stream_queue_pending#net. == net) {
8317 sctp_free_remote_addrcxx . . $ `usrsctplib/netinet/sctp_var.h:229:9`!(sp->net);
8318 sp->netcxx . . $ sctp_stream_queue_pending#net. = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!;
8319 }
8320 }
8321 }
8322 TAILQ_FOREACHcxx . . $ `<external>/2546723208511035544/queue.h:435:9`!(chk, &asoc->send_queue, sctp_next) {
8323 if (chk->whoTocxx . . $ sctp_tmit_chunk#whoTo. == net) {
8324 sctp_free_remote_addrcxx . . $ `usrsctplib/netinet/sctp_var.h:229:9`!(chk->whoTo);
8325 chk->whoTocxx . . $ sctp_tmit_chunk#whoTo. = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!;
8326 }
8327 }
8328 }
8329
8330 int
8331 sctp_med_chunk_outputcxx . . $ sctp_med_chunk_output(ae2c5cc94a0e278d).(struct sctp_inpcbcxx . . $ sctp_inpcb# *inp,
8332 struct sctp_tcbcxx . . $ sctp_tcb# *stcb,
8333 struct sctp_associationcxx . . $ sctp_association# *asoc,
8334 int *num_out,
8335 int *reason_code,
8336 int control_only, int from_where,
8337 struct timevalcxx . . $ timeval# *now, int *now_filled, int frag_point, int so_locked)
8338 {
8339 /**
8340 * Ok this is the generic chunk service queue. we must do the
8341 * following:
8342 * - Service the stream queue that is next, moving any
8343 * message (note I must get a complete message i.e. FIRST/MIDDLE and
8344 * LAST to the out queue in one pass) and assigning TSN's. This
8345 * only applys though if the peer does not support NDATA. For NDATA
8346 * chunks its ok to not send the entire message ;-)
8347 * - Check to see if the cwnd/rwnd allows any output, if so we go ahead and
8348 * fomulate and send the low level chunks. Making sure to combine
8349 * any control in the control chunk queue also.
8350 */
8351 struct sctp_netscxx . . $ sctp_nets# *net, *start_at, *sack_goes_to = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!, *old_start_at = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!;
8352 struct mbufcxx . . $ mbuf# *outchain, *endoutchain;
8353 struct sctp_tmit_chunkcxx . . $ sctp_tmit_chunk# *chk, *nchk;
8354
8355 /* temp arrays for unlinking */
8356 struct sctp_tmit_chunkcxx . . $ sctp_tmit_chunk# *data_list[SCTP_MAX_DATA_BUNDLINGcxx . . $ `usrsctplib/netinet/sctp_constants.h:880:9`!];
8357 int no_fragmentflg, error;
8358 unsigned int max_rwnd_per_dest, max_send_per_dest;
8359 int one_chunk, hbflag, skip_data_for_this_net;
8360 int asconf, cookie, no_out_cnt;
8361 int bundle_at, ctl_cnt, no_data_chunks, eeor_mode;
8362 unsigned int mtu, r_mtu, omtu, mx_mtu, to_out;
8363 int tsns_sent = 0;
8364 uint32_tcxx . . $ uint32_t# auth_offset;
8365 struct sctp_auth_chunkcxx . . $ sctp_auth_chunk# *auth;
8366 uint16_tcxx . . $ uint16_t# auth_keyid;
8367 int override_ok = 1;
8368 int skip_fill_up = 0;
8369 int data_auth_reqd = 0;
8370 /* JRS 5/14/07 - Add flag for whether a heartbeat is sent to
8371 the destination. */
8372 int quit_now = 0;
8373
8374 #if defined(__APPLE__) && !defined(__Userspace__cxx . . $ `<built-in>:442:9`!)
8375 if (so_locked) {
8376 sctp_lock_assert(SCTP_INP_SO(inp));
8377 } else {
8378 sctp_unlock_assert(SCTP_INP_SO(inp));
8379 }
8380 #endif
8381 *num_out = 0;
8382 *reason_code = 0;
8383 auth_keyid = stcb->asoccxx . . $ sctp_tcb#asoc..authinfocxx . . $ sctp_association#authinfo..active_keyidcxx . . $ sctp_authinformation#active_keyid.;
8384 if ((asoc->statecxx . . $ sctp_association#state. & SCTP_STATE_SHUTDOWN_PENDINGcxx . . $ `usrsctplib/netinet/sctp_constants.h:468:9`!) ||
8385 (SCTP_GET_STATEcxx . . $ `usrsctplib/netinet/sctp_constants.h:476:9`!(stcb) == SCTP_STATE_SHUTDOWN_RECEIVEDcxx . . $ `usrsctplib/netinet/sctp_constants.h:466:9`!) ||
8386 (sctp_is_feature_oncxx . . $ `usrsctplib/netinet/sctp_var.h:53:9`!(inp, SCTP_PCB_FLAGS_EXPLICIT_EORcxx . . $ `usrsctplib/netinet/sctp.h:584:9`!))) {
8387 eeor_mode = 1;
8388 } else {
8389 eeor_mode = 0;
8390 }
8391 ctl_cnt = no_out_cnt = asconf = cookie = 0;
8392 /*
8393 * First lets prime the pump. For each destination, if there is room
8394 * in the flight size, attempt to pull an MTU's worth out of the
8395 * stream queues into the general send_queue
8396 */
8397 #ifdef SCTP_AUDITING_ENABLED
8398 sctp_audit_log(0xC2, 2);
8399 #endif
8400 SCTP_TCB_LOCK_ASSERTcxx . . $ `usrsctplib/netinet/sctp_process_lock.h:478:9`!(stcb);
8401 hbflag = 0;
8402 if (control_only)
8403 no_data_chunks = 1;
8404 else
8405 no_data_chunks = 0;
8406
8407 /* Nothing to possible to send? */
8408 if ((TAILQ_EMPTYcxx . . $ `<external>/2546723208511035544/queue.h:457:9`!(&asoc->control_send_queue) ||
8409 (asoc->ctrl_queue_cntcxx . . $ sctp_association#ctrl_queue_cnt. == stcb->asoccxx . . $ sctp_tcb#asoc..ecn_echo_cnt_onqcxx . . $ sctp_association#ecn_echo_cnt_onq.)) &&
8410 TAILQ_EMPTYcxx . . $ `<external>/2546723208511035544/queue.h:457:9`!(&asoc->asconf_send_queue) &&
8411 TAILQ_EMPTYcxx . . $ `<external>/2546723208511035544/queue.h:457:9`!(&asoc->send_queue) &&
8412 sctp_is_there_unsent_datacxx . . $ sctp_is_there_unsent_data(ac3aa47b47eaac09).(stcb, so_locked) == 0) {
8413 nothing_to_send:
8414 *reason_code = 9;
8415 return (0);
8416 }
8417 if (asoc->peers_rwndcxx . . $ sctp_association#peers_rwnd. == 0) {
8418 /* No room in peers rwnd */
8419 *reason_code = 1;
8420 if (asoc->total_flightcxx . . $ sctp_association#total_flight. > 0) {
8421 /* we are allowed one chunk in flight */
8422 no_data_chunks = 1;
8423 }
8424 }
8425 if (stcb->asoccxx . . $ sctp_tcb#asoc..ecn_echo_cnt_onqcxx . . $ sctp_association#ecn_echo_cnt_onq.) {
8426 /* Record where a sack goes, if any */
8427 if (no_data_chunks &&
8428 (asoc->ctrl_queue_cntcxx . . $ sctp_association#ctrl_queue_cnt. == stcb->asoccxx . . $ sctp_tcb#asoc..ecn_echo_cnt_onqcxx . . $ sctp_association#ecn_echo_cnt_onq.)) {
8429 /* Nothing but ECNe to send - we don't do that */
8430 goto nothing_to_send;
8431 }
8432 TAILQ_FOREACHcxx . . $ `<external>/2546723208511035544/queue.h:435:9`!(chk, &asoc->control_send_queue, sctp_next) {
8433 if ((chk->reccxx . . $ sctp_tmit_chunk#rec..chunk_idcxx . . $ sctp_tmit_chunk#$anonymous_type_3#chunk_id..idcxx . . $ chk_id#id. == SCTP_SELECTIVE_ACKcxx . . $ `usrsctplib/netinet/sctp.h:452:9`!) ||
8434 (chk->reccxx . . $ sctp_tmit_chunk#rec..chunk_idcxx . . $ sctp_tmit_chunk#$anonymous_type_3#chunk_id..idcxx . . $ chk_id#id. == SCTP_NR_SELECTIVE_ACKcxx . . $ `usrsctplib/netinet/sctp.h:467:9`!)) {
8435 sack_goes_to = chk->whoTocxx . . $ sctp_tmit_chunk#whoTo.;
8436 break;
8437 }
8438 }
8439 }
8440 max_rwnd_per_dest = ((asoc->peers_rwndcxx . . $ sctp_association#peers_rwnd. + asoc->total_flightcxx . . $ sctp_association#total_flight.) / asoc->numnetscxx . . $ sctp_association#numnets.);
8441 if (stcb->sctp_socketcxx . . $ sctp_tcb#sctp_socket.)
8442 max_send_per_dest = SCTP_SB_LIMIT_SNDcxx . . $ `usrsctplib/netinet/sctp_os_userspace.h:965:9`!(stcb->sctp_socket) / asoc->numnetscxx . . $ sctp_association#numnets.;
8443 else
8444 max_send_per_dest = 0;
8445 if (no_data_chunks == 0) {
8446 /* How many non-directed chunks are there? */
8447 TAILQ_FOREACHcxx . . $ `<external>/2546723208511035544/queue.h:435:9`!(chk, &asoc->send_queue, sctp_next) {
8448 if (chk->whoTocxx . . $ sctp_tmit_chunk#whoTo. == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!) {
8449 /* We already have non-directed
8450 * chunks on the queue, no need
8451 * to do a fill-up.
8452 */
8453 skip_fill_up = 1;
8454 break;
8455 }
8456 }
8457 }
8458 if ((no_data_chunks == 0) &&
8459 (skip_fill_up == 0) &&
8460 (!stcb->asoccxx . . $ sctp_tcb#asoc..ss_functionscxx . . $ sctp_association#ss_functions..sctp_ss_is_emptycxx . . $ sctp_ss_functions#sctp_ss_is_empty.(stcb, asoc))) {
8461 TAILQ_FOREACHcxx . . $ `<external>/2546723208511035544/queue.h:435:9`!(net, &asoc->nets, sctp_next) {
8462 /*
8463 * This for loop we are in takes in
8464 * each net, if its's got space in cwnd and
8465 * has data sent to it (when CMT is off) then it
8466 * calls sctp_fill_outqueue for the net. This gets
8467 * data on the send queue for that network.
8468 *
8469 * In sctp_fill_outqueue TSN's are assigned and
8470 * data is copied out of the stream buffers. Note
8471 * mostly copy by reference (we hope).
8472 */
8473 net->window_probecxx . . $ sctp_nets#window_probe. = 0;
8474 if ((net != stcb->asoccxx . . $ sctp_tcb#asoc..alternatecxx . . $ sctp_association#alternate.) &&
8475 ((net->dest_statecxx . . $ sctp_nets#dest_state. & SCTP_ADDR_PFcxx . . $ `usrsctplib/netinet/sctp_constants.h:495:9`!) ||
8476 (!(net->dest_statecxx . . $ sctp_nets#dest_state. & SCTP_ADDR_REACHABLEcxx . . $ `usrsctplib/netinet/sctp_constants.h:486:9`!)) ||
8477 (net->dest_statecxx . . $ sctp_nets#dest_state. & SCTP_ADDR_UNCONFIRMEDcxx . . $ `usrsctplib/netinet/sctp_constants.h:492:9`!))) {
8478 if (SCTP_BASE_SYSCTLcxx . . $ `usrsctplib/netinet/sctp_os_userspace.h:579:9`!(sctp_logging_level) & SCTP_CWND_LOGGING_ENABLEcxx . . $ `usrsctplib/netinet/sctp.h:640:9`!) {
8479 sctp_log_cwndcxx . . $ sctp_log_cwnd(b2b0f138897254c).(stcb, net, 1,
8480 SCTP_CWND_LOG_FILL_OUTQ_CALLEDcxx . . $ `usrsctplib/netinet/sctp_constants.h:178:9`!);
8481 }
8482 continue;
8483 }
8484 if ((stcb->asoccxx . . $ sctp_tcb#asoc..cc_functionscxx . . $ sctp_association#cc_functions..sctp_cwnd_new_transmission_beginscxx . . $ sctp_cc_functions#sctp_cwnd_new_transmission_begins.) &&
8485 (net->flight_sizecxx . . $ sctp_nets#flight_size. == 0)) {
8486 (*stcb->asoccxx . . $ sctp_tcb#asoc..cc_functionscxx . . $ sctp_association#cc_functions..sctp_cwnd_new_transmission_beginscxx . . $ sctp_cc_functions#sctp_cwnd_new_transmission_begins.)(stcb, net);
8487 }
8488 if (net->flight_sizecxx . . $ sctp_nets#flight_size. >= net->cwndcxx . . $ sctp_nets#cwnd.) {
8489 /* skip this network, no room - can't fill */
8490 if (SCTP_BASE_SYSCTLcxx . . $ `usrsctplib/netinet/sctp_os_userspace.h:579:9`!(sctp_logging_level) & SCTP_CWND_LOGGING_ENABLEcxx . . $ `usrsctplib/netinet/sctp.h:640:9`!) {
8491 sctp_log_cwndcxx . . $ sctp_log_cwnd(b2b0f138897254c).(stcb, net, 3,
8492 SCTP_CWND_LOG_FILL_OUTQ_CALLEDcxx . . $ `usrsctplib/netinet/sctp_constants.h:178:9`!);
8493 }
8494 continue;
8495 }
8496 if (SCTP_BASE_SYSCTLcxx . . $ `usrsctplib/netinet/sctp_os_userspace.h:579:9`!(sctp_logging_level) & SCTP_CWND_LOGGING_ENABLEcxx . . $ `usrsctplib/netinet/sctp.h:640:9`!) {
8497 sctp_log_cwndcxx . . $ sctp_log_cwnd(b2b0f138897254c).(stcb, net, 4, SCTP_CWND_LOG_FILL_OUTQ_CALLEDcxx . . $ `usrsctplib/netinet/sctp_constants.h:178:9`!);
8498 }
8499 sctp_fill_outqueuecxx . . $ sctp_fill_outqueue(3baa703259065aa).(stcb, net, frag_point, eeor_mode, &quit_now, so_locked);
8500 if (quit_now) {
8501 /* memory alloc failure */
8502 no_data_chunks = 1;
8503 break;
8504 }
8505 }
8506 }
8507 /* now service each destination and send out what we can for it */
8508 /* Nothing to send? */
8509 if (TAILQ_EMPTYcxx . . $ `<external>/2546723208511035544/queue.h:457:9`!(&asoc->control_send_queue) &&
8510 TAILQ_EMPTYcxx . . $ `<external>/2546723208511035544/queue.h:457:9`!(&asoc->asconf_send_queue) &&
8511 TAILQ_EMPTYcxx . . $ `<external>/2546723208511035544/queue.h:457:9`!(&asoc->send_queue)) {
8512 *reason_code = 8;
8513 return (0);
8514 }
8515
8516 if (asoc->sctp_cmt_on_offcxx . . $ sctp_association#sctp_cmt_on_off. > 0) {
8517 /* get the last start point */
8518 start_at = asoc->last_net_cmt_send_startedcxx . . $ sctp_association#last_net_cmt_send_started.;
8519 if (start_at == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!) {
8520 /* null so to beginning */
8521 start_at = TAILQ_FIRSTcxx . . $ `<external>/2546723208511035544/queue.h:458:9`!(&asoc->nets);
8522 } else {
8523 start_at = TAILQ_NEXTcxx . . $ `<external>/2546723208511035544/queue.h:459:9`!(asoc->last_net_cmt_send_started, sctp_next);
8524 if (start_at == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!) {
8525 start_at = TAILQ_FIRSTcxx . . $ `<external>/2546723208511035544/queue.h:458:9`!(&asoc->nets);
8526 }
8527 }
8528 asoc->last_net_cmt_send_startedcxx . . $ sctp_association#last_net_cmt_send_started. = start_at;
8529 } else {
8530 start_at = TAILQ_FIRSTcxx . . $ `<external>/2546723208511035544/queue.h:458:9`!(&asoc->nets);
8531 }
8532 TAILQ_FOREACHcxx . . $ `<external>/2546723208511035544/queue.h:435:9`!(chk, &asoc->control_send_queue, sctp_next) {
8533 if (chk->whoTocxx . . $ sctp_tmit_chunk#whoTo. == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!) {
8534 if (asoc->alternatecxx . . $ sctp_association#alternate.) {
8535 chk->whoTocxx . . $ sctp_tmit_chunk#whoTo. = asoc->alternatecxx . . $ sctp_association#alternate.;
8536 } else {
8537 chk->whoTocxx . . $ sctp_tmit_chunk#whoTo. = asoc->primary_destinationcxx . . $ sctp_association#primary_destination.;
8538 }
8539 atomic_add_intcxx . . $ `usrsctplib/user_atomic.h:94:9`!(&chk->whoTo->ref_count, 1);
8540 }
8541 }
8542 old_start_at = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!;
8543 again_one_more_time:
8544 for (net = start_at; net != NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!; net = TAILQ_NEXTcxx . . $ `<external>/2546723208511035544/queue.h:459:9`!(net, sctp_next)) {
8545 /* how much can we send? */
8546 /* SCTPDBG("Examine for sending net:%x\n", (uint32_t)net); */
8547 if (old_start_at && (old_start_at == net)) {
8548 /* through list ocmpletely. */
8549 break;
8550 }
8551 tsns_sent = 0xa;
8552 if (TAILQ_EMPTYcxx . . $ `<external>/2546723208511035544/queue.h:457:9`!(&asoc->control_send_queue) &&
8553 TAILQ_EMPTYcxx . . $ `<external>/2546723208511035544/queue.h:457:9`!(&asoc->asconf_send_queue) &&
8554 (net->flight_sizecxx . . $ sctp_nets#flight_size. >= net->cwndcxx . . $ sctp_nets#cwnd.)) {
8555 /* Nothing on control or asconf and flight is full, we can skip
8556 * even in the CMT case.
8557 */
8558 continue;
8559 }
8560 bundle_at = 0;
8561 endoutchain = outchain = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!;
8562 auth = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!;
8563 auth_offset = 0;
8564 no_fragmentflg = 1;
8565 one_chunk = 0;
8566 if (net->dest_statecxx . . $ sctp_nets#dest_state. & SCTP_ADDR_UNCONFIRMEDcxx . . $ `usrsctplib/netinet/sctp_constants.h:492:9`!) {
8567 skip_data_for_this_net = 1;
8568 } else {
8569 skip_data_for_this_net = 0;
8570 }
8571 switch (((struct sockaddrcxx . . $ sockaddr# *)&net->rocxx . . $ sctp_nets#ro.._l_addrcxx . . $ sctp_net_route#_l_addr.)->sa_familycxx . . $ sockaddr#sa_family.) {
8572 #ifdef INETcxx . . $ `<built-in>:431:9`!
8573 case AF_INETcxx . . $ `<external>/8962547315054503424/socket.h:97:9`!:
8574 mtu = net->mtucxx . . $ sctp_nets#mtu. - SCTP_MIN_V4_OVERHEADcxx . . $ `usrsctplib/netinet/sctp_header.h:585:9`!;
8575 break;
8576 #endif
8577 #ifdef INET6cxx . . $ `<built-in>:432:9`!
8578 case AF_INET6cxx . . $ `<external>/8962547315054503424/socket.h:105:9`!:
8579 mtu = net->mtucxx . . $ sctp_nets#mtu. - SCTP_MIN_OVERHEADcxx . . $ `usrsctplib/netinet/sctp_header.h:561:9`!;
8580 break;
8581 #endif
8582 #if defined(__Userspace__cxx . . $ `<built-in>:442:9`!)
8583 case AF_CONNcxx . . $ `usrsctplib/netinet/sctp_os_userspace.h:995:9`!:
8584 mtu = net->mtucxx . . $ sctp_nets#mtu. - sizeof(struct sctphdrcxx . . $ sctphdr#);
8585 break;
8586 #endif
8587 default:
8588 /* TSNH */
8589 mtu = net->mtucxx . . $ sctp_nets#mtu.;
8590 break;
8591 }
8592 mx_mtu = mtu;
8593 to_out = 0;
8594 if (mtu > asoc->peers_rwndcxx . . $ sctp_association#peers_rwnd.) {
8595 if (asoc->total_flightcxx . . $ sctp_association#total_flight. > 0) {
8596 /* We have a packet in flight somewhere */
8597 r_mtu = asoc->peers_rwndcxx . . $ sctp_association#peers_rwnd.;
8598 } else {
8599 /* We are always allowed to send one MTU out */
8600 one_chunk = 1;
8601 r_mtu = mtu;
8602 }
8603 } else {
8604 r_mtu = mtu;
8605 }
8606 error = 0;
8607 /************************/
8608 /* ASCONF transmission */
8609 /************************/
8610 /* Now first lets go through the asconf queue */
8611 TAILQ_FOREACH_SAFEcxx . . $ `usrsctplib/netinet/sctp_os_userspace.h:1109:9`!(chk, &asoc->asconf_send_queue, sctp_next, nchk) {
8612 if (chk->reccxx . . $ sctp_tmit_chunk#rec..chunk_idcxx . . $ sctp_tmit_chunk#$anonymous_type_3#chunk_id..idcxx . . $ chk_id#id. != SCTP_ASCONFcxx . . $ `usrsctplib/netinet/sctp.h:484:9`!) {
8613 continue;
8614 }
8615 if (chk->whoTocxx . . $ sctp_tmit_chunk#whoTo. == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!) {
8616 if (asoc->alternatecxx . . $ sctp_association#alternate. == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!) {
8617 if (asoc->primary_destinationcxx . . $ sctp_association#primary_destination. != net) {
8618 break;
8619 }
8620 } else {
8621 if (asoc->alternatecxx . . $ sctp_association#alternate. != net) {
8622 break;
8623 }
8624 }
8625 } else {
8626 if (chk->whoTocxx . . $ sctp_tmit_chunk#whoTo. != net) {
8627 break;
8628 }
8629 }
8630 if (chk->datacxx . . $ sctp_tmit_chunk#data. == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!) {
8631 break;
8632 }
8633 if (chk->sentcxx . . $ sctp_tmit_chunk#sent. != SCTP_DATAGRAM_UNSENTcxx . . $ `usrsctplib/netinet/sctp_constants.h:353:9`! &&
8634 chk->sentcxx . . $ sctp_tmit_chunk#sent. != SCTP_DATAGRAM_RESENDcxx . . $ `usrsctplib/netinet/sctp_constants.h:359:9`!) {
8635 break;
8636 }
8637 /*
8638 * if no AUTH is yet included and this chunk
8639 * requires it, make sure to account for it. We
8640 * don't apply the size until the AUTH chunk is
8641 * actually added below in case there is no room for
8642 * this chunk. NOTE: we overload the use of "omtu"
8643 * here
8644 */
8645 if ((auth == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!) &&
8646 sctp_auth_is_required_chunkcxx . . $ `usrsctplib/netinet/sctp_auth.h:105:9`!(chk->rec.chunk_id.id,
8647 stcb->asoc.peer_auth_chunks)) {
8648 omtu = sctp_get_auth_chunk_lencxx . . $ sctp_get_auth_chunk_len(909d59720f161188).(stcb->asoccxx . . $ sctp_tcb#asoc..peer_hmac_idcxx . . $ sctp_association#peer_hmac_id.);
8649 } else
8650 omtu = 0;
8651 /* Here we do NOT factor the r_mtu */
8652 if ((chk->send_sizecxx . . $ sctp_tmit_chunk#send_size. < (int)(mtu - omtu)) ||
8653 (chk->flagscxx . . $ sctp_tmit_chunk#flags. & CHUNK_FLAGS_FRAGMENT_OKcxx . . $ `usrsctplib/netinet/sctp_structs.h:466:9`!)) {
8654 /*
8655 * We probably should glom the mbuf chain
8656 * from the chk->data for control but the
8657 * problem is it becomes yet one more level
8658 * of tracking to do if for some reason
8659 * output fails. Then I have got to
8660 * reconstruct the merged control chain.. el
8661 * yucko.. for now we take the easy way and
8662 * do the copy
8663 */
8664 /*
8665 * Add an AUTH chunk, if chunk requires it
8666 * save the offset into the chain for AUTH
8667 */
8668 if ((auth == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!) &&
8669 (sctp_auth_is_required_chunkcxx . . $ `usrsctplib/netinet/sctp_auth.h:105:9`!(chk->rec.chunk_id.id,
8670 stcb->asoc.peer_auth_chunks))) {
8671 outchain = sctp_add_auth_chunkcxx . . $ sctp_add_auth_chunk(c0b2bf5d35b7e5c6).(outchain,
8672 &endoutchain,
8673 &auth,
8674 &auth_offset,
8675 stcb,
8676 chk->reccxx . . $ sctp_tmit_chunk#rec..chunk_idcxx . . $ sctp_tmit_chunk#$anonymous_type_3#chunk_id..idcxx . . $ chk_id#id.);
8677 SCTP_STAT_INCR_COUNTER64cxx . . $ `./netinet/sctp_uio.h:1127:9`!(sctps_outcontrolchunks);
8678 }
8679 outchain = sctp_copy_mbufchaincxx . . $ sctp_copy_mbufchain(161b07f3a70427c7).(chk->datacxx . . $ sctp_tmit_chunk#data., outchain, &endoutchain,
8680 (int)chk->reccxx . . $ sctp_tmit_chunk#rec..chunk_idcxx . . $ sctp_tmit_chunk#$anonymous_type_3#chunk_id..can_take_datacxx . . $ chk_id#can_take_data.,
8681 chk->send_sizecxx . . $ sctp_tmit_chunk#send_size., chk->copy_by_refcxx . . $ sctp_tmit_chunk#copy_by_ref.);
8682 if (outchain == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!) {
8683 *reason_code = 8;
8684 SCTP_LTRACE_ERR_RETcxx . . $ `usrsctplib/netinet/sctp_os_userspace.h:629:9`!(inp, stcb, NULL, SCTP_FROM_SCTP_OUTPUT, ENOMEM);
8685 return (ENOMEMcxx . . $ `<external>/8987895939074593727/errno-base.h:16:9`!);
8686 }
8687 SCTP_STAT_INCR_COUNTER64cxx . . $ `./netinet/sctp_uio.h:1127:9`!(sctps_outcontrolchunks);
8688 /* update our MTU size */
8689 if (mtu > (chk->send_sizecxx . . $ sctp_tmit_chunk#send_size. + omtu))
8690 mtu -= (chk->send_sizecxx . . $ sctp_tmit_chunk#send_size. + omtu);
8691 else
8692 mtu = 0;
8693 to_out += (chk->send_sizecxx . . $ sctp_tmit_chunk#send_size. + omtu);
8694 /* Do clear IP_DF ? */
8695 if (chk->flagscxx . . $ sctp_tmit_chunk#flags. & CHUNK_FLAGS_FRAGMENT_OKcxx . . $ `usrsctplib/netinet/sctp_structs.h:466:9`!) {
8696 no_fragmentflg = 0;
8697 }
8698 if (chk->reccxx . . $ sctp_tmit_chunk#rec..chunk_idcxx . . $ sctp_tmit_chunk#$anonymous_type_3#chunk_id..can_take_datacxx . . $ chk_id#can_take_data.)
8699 chk->datacxx . . $ sctp_tmit_chunk#data. = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!;
8700 /*
8701 * set hb flag since we can
8702 * use these for RTO
8703 */
8704 hbflag = 1;
8705 asconf = 1;
8706 /*
8707 * should sysctl this: don't
8708 * bundle data with ASCONF
8709 * since it requires AUTH
8710 */
8711 no_data_chunks = 1;
8712 chk->sentcxx . . $ sctp_tmit_chunk#sent. = SCTP_DATAGRAM_SENTcxx . . $ `usrsctplib/netinet/sctp_constants.h:354:9`!;
8713 if (chk->whoTocxx . . $ sctp_tmit_chunk#whoTo. == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!) {
8714 chk->whoTocxx . . $ sctp_tmit_chunk#whoTo. = net;
8715 atomic_add_intcxx . . $ `usrsctplib/user_atomic.h:94:9`!(&net->ref_count, 1);
8716 }
8717 chk->snd_countcxx . . $ sctp_tmit_chunk#snd_count.++;
8718 if (mtu == 0) {
8719 /*
8720 * Ok we are out of room but we can
8721 * output without effecting the
8722 * flight size since this little guy
8723 * is a control only packet.
8724 */
8725 sctp_timer_startcxx . . $ sctp_timer_start(73c9263bfa4b937d).(SCTP_TIMER_TYPE_ASCONFcxx . . $ `usrsctplib/netinet/sctp_constants.h:546:9`!, inp, stcb, net);
8726 /*
8727 * do NOT clear the asconf
8728 * flag as it is used to do
8729 * appropriate source address
8730 * selection.
8731 */
8732 if (*now_filled == 0) {
8733 (void)SCTP_GETTIME_TIMEVALcxx . . $ `usrsctplib/netinet/sctp_constants.h:995:9`!(now);
8734 *now_filled = 1;
8735 }
8736 net->last_sent_timecxx . . $ sctp_nets#last_sent_time. = *now;
8737 hbflag = 0;
8738 if ((error = sctp_lowlevel_chunk_outputcxx . . $ sctp_lowlevel_chunk_output(4859f95fdecd7401).(inp, stcb, net,
8739 (struct sockaddrcxx . . $ sockaddr# *)&net->rocxx . . $ sctp_nets#ro.._l_addrcxx . . $ sctp_net_route#_l_addr.,
8740 outchain, auth_offset, auth,
8741 stcb->asoccxx . . $ sctp_tcb#asoc..authinfocxx . . $ sctp_association#authinfo..active_keyidcxx . . $ sctp_authinformation#active_keyid.,
8742 no_fragmentflg, 0, asconf,
8743 inp->sctp_lportcxx . . $ `usrsctplib/netinet/sctp_pcb.h:430:9`!, stcb->rportcxx . . $ sctp_tcb#rport.,
8744 htonlcxx . . $ htonl(2141b656ce2cc063).(stcb->asoccxx . . $ sctp_tcb#asoc..peer_vtagcxx . . $ sctp_association#peer_vtag.),
8745 net->portcxx . . $ sctp_nets#port., NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!,
8746 #if defined(__FreeBSD__) && !defined(__Userspace__cxx . . $ `<built-in>:442:9`!)
8747 0, 0,
8748 #endif
8749 so_locked))) {
8750 /* error, we could not output */
8751 SCTPDBGcxx . . $ `usrsctplib/netinet/sctp_os_userspace.h:591:9`!(SCTP_DEBUG_OUTPUT3cxx . . $ `usrsctplib/netinet/sctp_constants.h:645:9`!, "Gak send error %d\n", error);
8752 if (from_where == 0) {
8753 SCTP_STAT_INCRcxx . . $ `./netinet/sctp_uio.h:1111:9`!(sctps_lowlevelerrusr);
8754 }
8755 if (error == ENOBUFScxx . . $ `<external>/17922322188510340118/errno.h:89:9`!) {
8756 asoc->ifp_had_enobufcxx . . $ sctp_association#ifp_had_enobuf. = 1;
8757 SCTP_STAT_INCRcxx . . $ `./netinet/sctp_uio.h:1111:9`!(sctps_lowlevelerr);
8758 }
8759 /* error, could not output */
8760 if (error == EHOSTUNREACHcxx . . $ `<external>/17922322188510340118/errno.h:97:9`!) {
8761 /*
8762 * Destination went
8763 * unreachable
8764 * during this send
8765 */
8766 sctp_move_chunks_from_netcxx . . $ sctp_move_chunks_from_net(2ed2c3ddd2bbab6a).(stcb, net);
8767 }
8768 *reason_code = 7;
8769 break;
8770 } else {
8771 asoc->ifp_had_enobufcxx . . $ sctp_association#ifp_had_enobuf. = 0;
8772 }
8773 /*
8774 * increase the number we sent, if a
8775 * cookie is sent we don't tell them
8776 * any was sent out.
8777 */
8778 outchain = endoutchain = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!;
8779 auth = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!;
8780 auth_offset = 0;
8781 if (!no_out_cnt)
8782 *num_out += ctl_cnt;
8783 /* recalc a clean slate and setup */
8784 switch (net->rocxx . . $ sctp_nets#ro.._l_addrcxx . . $ sctp_net_route#_l_addr..sa.sa_familycxx . . $ sockaddr#sa_family.) {
8785 #ifdef INETcxx . . $ `<built-in>:431:9`!
8786 case AF_INETcxx . . $ `<external>/8962547315054503424/socket.h:97:9`!:
8787 mtu = net->mtucxx . . $ sctp_nets#mtu. - SCTP_MIN_V4_OVERHEADcxx . . $ `usrsctplib/netinet/sctp_header.h:585:9`!;
8788 break;
8789 #endif
8790 #ifdef INET6cxx . . $ `<built-in>:432:9`!
8791 case AF_INET6cxx . . $ `<external>/8962547315054503424/socket.h:105:9`!:
8792 mtu = net->mtucxx . . $ sctp_nets#mtu. - SCTP_MIN_OVERHEADcxx . . $ `usrsctplib/netinet/sctp_header.h:561:9`!;
8793 break;
8794 #endif
8795 #if defined(__Userspace__cxx . . $ `<built-in>:442:9`!)
8796 case AF_CONNcxx . . $ `usrsctplib/netinet/sctp_os_userspace.h:995:9`!:
8797 mtu = net->mtucxx . . $ sctp_nets#mtu. - sizeof(struct sctphdrcxx . . $ sctphdr#);
8798 break;
8799 #endif
8800 default:
8801 /* TSNH */
8802 mtu = net->mtucxx . . $ sctp_nets#mtu.;
8803 break;
8804 }
8805 to_out = 0;
8806 no_fragmentflg = 1;
8807 }
8808 }
8809 }
8810 if (error != 0) {
8811 /* try next net */
8812 continue;
8813 }
8814 /************************/
8815 /* Control transmission */
8816 /************************/
8817 /* Now first lets go through the control queue */
8818 TAILQ_FOREACH_SAFEcxx . . $ `usrsctplib/netinet/sctp_os_userspace.h:1109:9`!(chk, &asoc->control_send_queue, sctp_next, nchk) {
8819 if ((sack_goes_to) &&
8820 (chk->reccxx . . $ sctp_tmit_chunk#rec..chunk_idcxx . . $ sctp_tmit_chunk#$anonymous_type_3#chunk_id..idcxx . . $ chk_id#id. == SCTP_ECN_ECHOcxx . . $ `usrsctplib/netinet/sctp.h:461:9`!) &&
8821 (chk->whoTocxx . . $ sctp_tmit_chunk#whoTo. != sack_goes_to)) {
8822 /*
8823 * if we have a sack in queue, and we are looking at an
8824 * ecn echo that is NOT queued to where the sack is going..
8825 */
8826 if (chk->whoTocxx . . $ sctp_tmit_chunk#whoTo. == net) {
8827 /* Don't transmit it to where its going (current net) */
8828 continue;
8829 } else if (sack_goes_to == net) {
8830 /* But do transmit it to this address */
8831 goto skip_net_check;
8832 }
8833 }
8834 if (chk->whoTocxx . . $ sctp_tmit_chunk#whoTo. == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!) {
8835 if (asoc->alternatecxx . . $ sctp_association#alternate. == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!) {
8836 if (asoc->primary_destinationcxx . . $ sctp_association#primary_destination. != net) {
8837 continue;
8838 }
8839 } else {
8840 if (asoc->alternatecxx . . $ sctp_association#alternate. != net) {
8841 continue;
8842 }
8843 }
8844 } else {
8845 if (chk->whoTocxx . . $ sctp_tmit_chunk#whoTo. != net) {
8846 continue;
8847 }
8848 }
8849 skip_net_check:
8850 if (chk->datacxx . . $ sctp_tmit_chunk#data. == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!) {
8851 continue;
8852 }
8853 if (chk->sentcxx . . $ sctp_tmit_chunk#sent. != SCTP_DATAGRAM_UNSENTcxx . . $ `usrsctplib/netinet/sctp_constants.h:353:9`!) {
8854 /*
8855 * It must be unsent. Cookies and ASCONF's
8856 * hang around but there timers will force
8857 * when marked for resend.
8858 */
8859 continue;
8860 }
8861 /*
8862 * if no AUTH is yet included and this chunk
8863 * requires it, make sure to account for it. We
8864 * don't apply the size until the AUTH chunk is
8865 * actually added below in case there is no room for
8866 * this chunk. NOTE: we overload the use of "omtu"
8867 * here
8868 */
8869 if ((auth == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!) &&
8870 sctp_auth_is_required_chunkcxx . . $ `usrsctplib/netinet/sctp_auth.h:105:9`!(chk->rec.chunk_id.id,
8871 stcb->asoc.peer_auth_chunks)) {
8872 omtu = sctp_get_auth_chunk_lencxx . . $ sctp_get_auth_chunk_len(909d59720f161188).(stcb->asoccxx . . $ sctp_tcb#asoc..peer_hmac_idcxx . . $ sctp_association#peer_hmac_id.);
8873 } else
8874 omtu = 0;
8875 /* Here we do NOT factor the r_mtu */
8876 if ((chk->send_sizecxx . . $ sctp_tmit_chunk#send_size. <= (int)(mtu - omtu)) ||
8877 (chk->flagscxx . . $ sctp_tmit_chunk#flags. & CHUNK_FLAGS_FRAGMENT_OKcxx . . $ `usrsctplib/netinet/sctp_structs.h:466:9`!)) {
8878 /*
8879 * We probably should glom the mbuf chain
8880 * from the chk->data for control but the
8881 * problem is it becomes yet one more level
8882 * of tracking to do if for some reason
8883 * output fails. Then I have got to
8884 * reconstruct the merged control chain.. el
8885 * yucko.. for now we take the easy way and
8886 * do the copy
8887 */
8888 /*
8889 * Add an AUTH chunk, if chunk requires it
8890 * save the offset into the chain for AUTH
8891 */
8892 if ((auth == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!) &&
8893 (sctp_auth_is_required_chunkcxx . . $ `usrsctplib/netinet/sctp_auth.h:105:9`!(chk->rec.chunk_id.id,
8894 stcb->asoc.peer_auth_chunks))) {
8895 outchain = sctp_add_auth_chunkcxx . . $ sctp_add_auth_chunk(c0b2bf5d35b7e5c6).(outchain,
8896 &endoutchain,
8897 &auth,
8898 &auth_offset,
8899 stcb,
8900 chk->reccxx . . $ sctp_tmit_chunk#rec..chunk_idcxx . . $ sctp_tmit_chunk#$anonymous_type_3#chunk_id..idcxx . . $ chk_id#id.);
8901 SCTP_STAT_INCR_COUNTER64cxx . . $ `./netinet/sctp_uio.h:1127:9`!(sctps_outcontrolchunks);
8902 }
8903 outchain = sctp_copy_mbufchaincxx . . $ sctp_copy_mbufchain(161b07f3a70427c7).(chk->datacxx . . $ sctp_tmit_chunk#data., outchain, &endoutchain,
8904 (int)chk->reccxx . . $ sctp_tmit_chunk#rec..chunk_idcxx . . $ sctp_tmit_chunk#$anonymous_type_3#chunk_id..can_take_datacxx . . $ chk_id#can_take_data.,
8905 chk->send_sizecxx . . $ sctp_tmit_chunk#send_size., chk->copy_by_refcxx . . $ sctp_tmit_chunk#copy_by_ref.);
8906 if (outchain == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!) {
8907 *reason_code = 8;
8908 SCTP_LTRACE_ERR_RETcxx . . $ `usrsctplib/netinet/sctp_os_userspace.h:629:9`!(inp, stcb, NULL, SCTP_FROM_SCTP_OUTPUT, ENOMEM);
8909 return (ENOMEMcxx . . $ `<external>/8987895939074593727/errno-base.h:16:9`!);
8910 }
8911 SCTP_STAT_INCR_COUNTER64cxx . . $ `./netinet/sctp_uio.h:1127:9`!(sctps_outcontrolchunks);
8912 /* update our MTU size */
8913 if (mtu > (chk->send_sizecxx . . $ sctp_tmit_chunk#send_size. + omtu))
8914 mtu -= (chk->send_sizecxx . . $ sctp_tmit_chunk#send_size. + omtu);
8915 else
8916 mtu = 0;
8917 to_out += (chk->send_sizecxx . . $ sctp_tmit_chunk#send_size. + omtu);
8918 /* Do clear IP_DF ? */
8919 if (chk->flagscxx . . $ sctp_tmit_chunk#flags. & CHUNK_FLAGS_FRAGMENT_OKcxx . . $ `usrsctplib/netinet/sctp_structs.h:466:9`!) {
8920 no_fragmentflg = 0;
8921 }
8922 if (chk->reccxx . . $ sctp_tmit_chunk#rec..chunk_idcxx . . $ sctp_tmit_chunk#$anonymous_type_3#chunk_id..can_take_datacxx . . $ chk_id#can_take_data.)
8923 chk->datacxx . . $ sctp_tmit_chunk#data. = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!;
8924 /* Mark things to be removed, if needed */
8925 if ((chk->reccxx . . $ sctp_tmit_chunk#rec..chunk_idcxx . . $ sctp_tmit_chunk#$anonymous_type_3#chunk_id..idcxx . . $ chk_id#id. == SCTP_SELECTIVE_ACKcxx . . $ `usrsctplib/netinet/sctp.h:452:9`!) ||
8926 (chk->reccxx . . $ sctp_tmit_chunk#rec..chunk_idcxx . . $ sctp_tmit_chunk#$anonymous_type_3#chunk_id..idcxx . . $ chk_id#id. == SCTP_NR_SELECTIVE_ACKcxx . . $ `usrsctplib/netinet/sctp.h:467:9`!) || /* EY */
8927 (chk->reccxx . . $ sctp_tmit_chunk#rec..chunk_idcxx . . $ sctp_tmit_chunk#$anonymous_type_3#chunk_id..idcxx . . $ chk_id#id. == SCTP_HEARTBEAT_REQUESTcxx . . $ `usrsctplib/netinet/sctp.h:453:9`!) ||
8928 (chk->reccxx . . $ sctp_tmit_chunk#rec..chunk_idcxx . . $ sctp_tmit_chunk#$anonymous_type_3#chunk_id..idcxx . . $ chk_id#id. == SCTP_HEARTBEAT_ACKcxx . . $ `usrsctplib/netinet/sctp.h:454:9`!) ||
8929 (chk->reccxx . . $ sctp_tmit_chunk#rec..chunk_idcxx . . $ sctp_tmit_chunk#$anonymous_type_3#chunk_id..idcxx . . $ chk_id#id. == SCTP_SHUTDOWNcxx . . $ `usrsctplib/netinet/sctp.h:456:9`!) ||
8930 (chk->reccxx . . $ sctp_tmit_chunk#rec..chunk_idcxx . . $ sctp_tmit_chunk#$anonymous_type_3#chunk_id..idcxx . . $ chk_id#id. == SCTP_SHUTDOWN_ACKcxx . . $ `usrsctplib/netinet/sctp.h:457:9`!) ||
8931 (chk->reccxx . . $ sctp_tmit_chunk#rec..chunk_idcxx . . $ sctp_tmit_chunk#$anonymous_type_3#chunk_id..idcxx . . $ chk_id#id. == SCTP_OPERATION_ERRORcxx . . $ `usrsctplib/netinet/sctp.h:458:9`!) ||
8932 (chk->reccxx . . $ sctp_tmit_chunk#rec..chunk_idcxx . . $ sctp_tmit_chunk#$anonymous_type_3#chunk_id..idcxx . . $ chk_id#id. == SCTP_COOKIE_ACKcxx . . $ `usrsctplib/netinet/sctp.h:460:9`!) ||
8933 (chk->reccxx . . $ sctp_tmit_chunk#rec..chunk_idcxx . . $ sctp_tmit_chunk#$anonymous_type_3#chunk_id..idcxx . . $ chk_id#id. == SCTP_ECN_CWRcxx . . $ `usrsctplib/netinet/sctp.h:462:9`!) ||
8934 (chk->reccxx . . $ sctp_tmit_chunk#rec..chunk_idcxx . . $ sctp_tmit_chunk#$anonymous_type_3#chunk_id..idcxx . . $ chk_id#id. == SCTP_PACKET_DROPPEDcxx . . $ `usrsctplib/netinet/sctp.h:474:9`!) ||
8935 (chk->reccxx . . $ sctp_tmit_chunk#rec..chunk_idcxx . . $ sctp_tmit_chunk#$anonymous_type_3#chunk_id..idcxx . . $ chk_id#id. == SCTP_ASCONF_ACKcxx . . $ `usrsctplib/netinet/sctp.h:472:9`!)) {
8936 if (chk->reccxx . . $ sctp_tmit_chunk#rec..chunk_idcxx . . $ sctp_tmit_chunk#$anonymous_type_3#chunk_id..idcxx . . $ chk_id#id. == SCTP_HEARTBEAT_REQUESTcxx . . $ `usrsctplib/netinet/sctp.h:453:9`!) {
8937 hbflag = 1;
8938 }
8939 /* remove these chunks at the end */
8940 if ((chk->reccxx . . $ sctp_tmit_chunk#rec..chunk_idcxx . . $ sctp_tmit_chunk#$anonymous_type_3#chunk_id..idcxx . . $ chk_id#id. == SCTP_SELECTIVE_ACKcxx . . $ `usrsctplib/netinet/sctp.h:452:9`!) ||
8941 (chk->reccxx . . $ sctp_tmit_chunk#rec..chunk_idcxx . . $ sctp_tmit_chunk#$anonymous_type_3#chunk_id..idcxx . . $ chk_id#id. == SCTP_NR_SELECTIVE_ACKcxx . . $ `usrsctplib/netinet/sctp.h:467:9`!)) {
8942 /* turn off the timer */
8943 if (SCTP_OS_TIMER_PENDINGcxx . . $ `usrsctplib/netinet/sctp_callout.h:107:9`!(&stcb->asoc.dack_timer.timer)) {
8944 sctp_timer_stopcxx . . $ sctp_timer_stop(dc50a43aa5f83109).(SCTP_TIMER_TYPE_RECVcxx . . $ `usrsctplib/netinet/sctp_constants.h:539:9`!,
8945 inp, stcb, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!,
8946 SCTP_FROM_SCTP_OUTPUTcxx . . $ `usrsctplib/netinet/sctp_constants.h:767:9`! + SCTP_LOC_1cxx . . $ `usrsctplib/netinet/sctp_constants.h:773:9`!);
8947 }
8948 }
8949 ctl_cnt++;
8950 } else {
8951 /*
8952 * Other chunks, since they have
8953 * timers running (i.e. COOKIE)
8954 * we just "trust" that it
8955 * gets sent or retransmitted.
8956 */
8957 ctl_cnt++;
8958 if (chk->reccxx . . $ sctp_tmit_chunk#rec..chunk_idcxx . . $ sctp_tmit_chunk#$anonymous_type_3#chunk_id..idcxx . . $ chk_id#id. == SCTP_COOKIE_ECHOcxx . . $ `usrsctplib/netinet/sctp.h:459:9`!) {
8959 cookie = 1;
8960 no_out_cnt = 1;
8961 } else if (chk->reccxx . . $ sctp_tmit_chunk#rec..chunk_idcxx . . $ sctp_tmit_chunk#$anonymous_type_3#chunk_id..idcxx . . $ chk_id#id. == SCTP_ECN_ECHOcxx . . $ `usrsctplib/netinet/sctp.h:461:9`!) {
8962 /*
8963 * Increment ecne send count here
8964 * this means we may be over-zealous in
8965 * our counting if the send fails, but its
8966 * the best place to do it (we used to do
8967 * it in the queue of the chunk, but that did
8968 * not tell how many times it was sent.
8969 */
8970 SCTP_STAT_INCRcxx . . $ `./netinet/sctp_uio.h:1111:9`!(sctps_sendecne);
8971 }
8972 chk->sentcxx . . $ sctp_tmit_chunk#sent. = SCTP_DATAGRAM_SENTcxx . . $ `usrsctplib/netinet/sctp_constants.h:354:9`!;
8973 if (chk->whoTocxx . . $ sctp_tmit_chunk#whoTo. == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!) {
8974 chk->whoTocxx . . $ sctp_tmit_chunk#whoTo. = net;
8975 atomic_add_intcxx . . $ `usrsctplib/user_atomic.h:94:9`!(&net->ref_count, 1);
8976 }
8977 chk->snd_countcxx . . $ sctp_tmit_chunk#snd_count.++;
8978 }
8979 if (mtu == 0) {
8980 /*
8981 * Ok we are out of room but we can
8982 * output without effecting the
8983 * flight size since this little guy
8984 * is a control only packet.
8985 */
8986 if (asconf) {
8987 sctp_timer_startcxx . . $ sctp_timer_start(73c9263bfa4b937d).(SCTP_TIMER_TYPE_ASCONFcxx . . $ `usrsctplib/netinet/sctp_constants.h:546:9`!, inp, stcb, net);
8988 /*
8989 * do NOT clear the asconf
8990 * flag as it is used to do
8991 * appropriate source address
8992 * selection.
8993 */
8994 }
8995 if (cookie) {
8996 sctp_timer_startcxx . . $ sctp_timer_start(73c9263bfa4b937d).(SCTP_TIMER_TYPE_COOKIEcxx . . $ `usrsctplib/netinet/sctp_constants.h:542:9`!, inp, stcb, net);
8997 cookie = 0;
8998 }
8999 /* Only HB or ASCONF advances time */
9000 if (hbflag) {
9001 if (*now_filled == 0) {
9002 (void)SCTP_GETTIME_TIMEVALcxx . . $ `usrsctplib/netinet/sctp_constants.h:995:9`!(now);
9003 *now_filled = 1;
9004 }
9005 net->last_sent_timecxx . . $ sctp_nets#last_sent_time. = *now;
9006 hbflag = 0;
9007 }
9008 if ((error = sctp_lowlevel_chunk_outputcxx . . $ sctp_lowlevel_chunk_output(4859f95fdecd7401).(inp, stcb, net,
9009 (struct sockaddrcxx . . $ sockaddr# *)&net->rocxx . . $ sctp_nets#ro.._l_addrcxx . . $ sctp_net_route#_l_addr.,
9010 outchain,
9011 auth_offset, auth,
9012 stcb->asoccxx . . $ sctp_tcb#asoc..authinfocxx . . $ sctp_association#authinfo..active_keyidcxx . . $ sctp_authinformation#active_keyid.,
9013 no_fragmentflg, 0, asconf,
9014 inp->sctp_lportcxx . . $ `usrsctplib/netinet/sctp_pcb.h:430:9`!, stcb->rportcxx . . $ sctp_tcb#rport.,
9015 htonlcxx . . $ htonl(2141b656ce2cc063).(stcb->asoccxx . . $ sctp_tcb#asoc..peer_vtagcxx . . $ sctp_association#peer_vtag.),
9016 net->portcxx . . $ sctp_nets#port., NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!,
9017 #if defined(__FreeBSD__) && !defined(__Userspace__cxx . . $ `<built-in>:442:9`!)
9018 0, 0,
9019 #endif
9020 so_locked))) {
9021 /* error, we could not output */
9022 SCTPDBGcxx . . $ `usrsctplib/netinet/sctp_os_userspace.h:591:9`!(SCTP_DEBUG_OUTPUT3cxx . . $ `usrsctplib/netinet/sctp_constants.h:645:9`!, "Gak send error %d\n", error);
9023 if (from_where == 0) {
9024 SCTP_STAT_INCRcxx . . $ `./netinet/sctp_uio.h:1111:9`!(sctps_lowlevelerrusr);
9025 }
9026 if (error == ENOBUFScxx . . $ `<external>/17922322188510340118/errno.h:89:9`!) {
9027 asoc->ifp_had_enobufcxx . . $ sctp_association#ifp_had_enobuf. = 1;
9028 SCTP_STAT_INCRcxx . . $ `./netinet/sctp_uio.h:1111:9`!(sctps_lowlevelerr);
9029 }
9030 if (error == EHOSTUNREACHcxx . . $ `<external>/17922322188510340118/errno.h:97:9`!) {
9031 /*
9032 * Destination went
9033 * unreachable
9034 * during this send
9035 */
9036 sctp_move_chunks_from_netcxx . . $ sctp_move_chunks_from_net(2ed2c3ddd2bbab6a).(stcb, net);
9037 }
9038 *reason_code = 7;
9039 break;
9040 } else {
9041 asoc->ifp_had_enobufcxx . . $ sctp_association#ifp_had_enobuf. = 0;
9042 }
9043 /*
9044 * increase the number we sent, if a
9045 * cookie is sent we don't tell them
9046 * any was sent out.
9047 */
9048 outchain = endoutchain = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!;
9049 auth = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!;
9050 auth_offset = 0;
9051 if (!no_out_cnt)
9052 *num_out += ctl_cnt;
9053 /* recalc a clean slate and setup */
9054 switch (net->rocxx . . $ sctp_nets#ro.._l_addrcxx . . $ sctp_net_route#_l_addr..sa.sa_familycxx . . $ sockaddr#sa_family.) {
9055 #ifdef INETcxx . . $ `<built-in>:431:9`!
9056 case AF_INETcxx . . $ `<external>/8962547315054503424/socket.h:97:9`!:
9057 mtu = net->mtucxx . . $ sctp_nets#mtu. - SCTP_MIN_V4_OVERHEADcxx . . $ `usrsctplib/netinet/sctp_header.h:585:9`!;
9058 break;
9059 #endif
9060 #ifdef INET6cxx . . $ `<built-in>:432:9`!
9061 case AF_INET6cxx . . $ `<external>/8962547315054503424/socket.h:105:9`!:
9062 mtu = net->mtucxx . . $ sctp_nets#mtu. - SCTP_MIN_OVERHEADcxx . . $ `usrsctplib/netinet/sctp_header.h:561:9`!;
9063 break;
9064 #endif
9065 #if defined(__Userspace__cxx . . $ `<built-in>:442:9`!)
9066 case AF_CONNcxx . . $ `usrsctplib/netinet/sctp_os_userspace.h:995:9`!:
9067 mtu = net->mtucxx . . $ sctp_nets#mtu. - sizeof(struct sctphdrcxx . . $ sctphdr#);
9068 break;
9069 #endif
9070 default:
9071 /* TSNH */
9072 mtu = net->mtucxx . . $ sctp_nets#mtu.;
9073 break;
9074 }
9075 to_out = 0;
9076 no_fragmentflg = 1;
9077 }
9078 }
9079 }
9080 if (error != 0) {
9081 /* try next net */
9082 continue;
9083 }
9084 /* JRI: if dest is in PF state, do not send data to it */
9085 if ((asoc->sctp_cmt_on_offcxx . . $ sctp_association#sctp_cmt_on_off. > 0) &&
9086 (net != stcb->asoccxx . . $ sctp_tcb#asoc..alternatecxx . . $ sctp_association#alternate.) &&
9087 (net->dest_statecxx . . $ sctp_nets#dest_state. & SCTP_ADDR_PFcxx . . $ `usrsctplib/netinet/sctp_constants.h:495:9`!)) {
9088 goto no_data_fill;
9089 }
9090 if (net->flight_sizecxx . . $ sctp_nets#flight_size. >= net->cwndcxx . . $ sctp_nets#cwnd.) {
9091 goto no_data_fill;
9092 }
9093 if ((asoc->sctp_cmt_on_offcxx . . $ sctp_association#sctp_cmt_on_off. > 0) &&
9094 (SCTP_BASE_SYSCTLcxx . . $ `usrsctplib/netinet/sctp_os_userspace.h:579:9`!(sctp_buffer_splitting) & SCTP_RECV_BUFFER_SPLITTINGcxx . . $ `usrsctplib/netinet/sctp_constants.h:947:9`!) &&
9095 (net->flight_sizecxx . . $ sctp_nets#flight_size. > max_rwnd_per_dest)) {
9096 goto no_data_fill;
9097 }
9098 /*
9099 * We need a specific accounting for the usage of the
9100 * send buffer. We also need to check the number of messages
9101 * per net. For now, this is better than nothing and it
9102 * disabled by default...
9103 */
9104 if ((asoc->sctp_cmt_on_offcxx . . $ sctp_association#sctp_cmt_on_off. > 0) &&
9105 (SCTP_BASE_SYSCTLcxx . . $ `usrsctplib/netinet/sctp_os_userspace.h:579:9`!(sctp_buffer_splitting) & SCTP_SEND_BUFFER_SPLITTINGcxx . . $ `usrsctplib/netinet/sctp_constants.h:946:9`!) &&
9106 (max_send_per_dest > 0) &&
9107 (net->flight_sizecxx . . $ sctp_nets#flight_size. > max_send_per_dest)) {
9108 goto no_data_fill;
9109 }
9110 /*********************/
9111 /* Data transmission */
9112 /*********************/
9113 /*
9114 * if AUTH for DATA is required and no AUTH has been added
9115 * yet, account for this in the mtu now... if no data can be
9116 * bundled, this adjustment won't matter anyways since the
9117 * packet will be going out...
9118 */
9119 data_auth_reqd = sctp_auth_is_required_chunkcxx . . $ `usrsctplib/netinet/sctp_auth.h:105:9`!(SCTP_DATAcxx . . $ `usrsctplib/netinet/sctp.h:449:9`!,
9120 stcb->asoc.peer_auth_chunks);
9121 if (data_auth_reqd && (auth == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!)) {
9122 mtu -= sctp_get_auth_chunk_lencxx . . $ sctp_get_auth_chunk_len(909d59720f161188).(stcb->asoccxx . . $ sctp_tcb#asoc..peer_hmac_idcxx . . $ sctp_association#peer_hmac_id.);
9123 }
9124 /* now lets add any data within the MTU constraints */
9125 switch (((struct sockaddrcxx . . $ sockaddr# *)&net->rocxx . . $ sctp_nets#ro.._l_addrcxx . . $ sctp_net_route#_l_addr.)->sa_familycxx . . $ sockaddr#sa_family.) {
9126 #ifdef INETcxx . . $ `<built-in>:431:9`!
9127 case AF_INETcxx . . $ `<external>/8962547315054503424/socket.h:97:9`!:
9128 if (net->mtucxx . . $ sctp_nets#mtu. > SCTP_MIN_V4_OVERHEADcxx . . $ `usrsctplib/netinet/sctp_header.h:585:9`!)
9129 omtu = net->mtucxx . . $ sctp_nets#mtu. - SCTP_MIN_V4_OVERHEADcxx . . $ `usrsctplib/netinet/sctp_header.h:585:9`!;
9130 else
9131 omtu = 0;
9132 break;
9133 #endif
9134 #ifdef INET6cxx . . $ `<built-in>:432:9`!
9135 case AF_INET6cxx . . $ `<external>/8962547315054503424/socket.h:105:9`!:
9136 if (net->mtucxx . . $ sctp_nets#mtu. > SCTP_MIN_OVERHEADcxx . . $ `usrsctplib/netinet/sctp_header.h:561:9`!)
9137 omtu = net->mtucxx . . $ sctp_nets#mtu. - SCTP_MIN_OVERHEADcxx . . $ `usrsctplib/netinet/sctp_header.h:561:9`!;
9138 else
9139 omtu = 0;
9140 break;
9141 #endif
9142 #if defined(__Userspace__cxx . . $ `<built-in>:442:9`!)
9143 case AF_CONNcxx . . $ `usrsctplib/netinet/sctp_os_userspace.h:995:9`!:
9144 if (net->mtucxx . . $ sctp_nets#mtu. > sizeof(struct sctphdrcxx . . $ sctphdr#)) {
9145 omtu = net->mtucxx . . $ sctp_nets#mtu. - sizeof(struct sctphdrcxx . . $ sctphdr#);
9146 } else {
9147 omtu = 0;
9148 }
9149 break;
9150 #endif
9151 default:
9152 /* TSNH */
9153 omtu = 0;
9154 break;
9155 }
9156 if ((((SCTP_GET_STATEcxx . . $ `usrsctplib/netinet/sctp_constants.h:476:9`!(stcb) == SCTP_STATE_OPENcxx . . $ `usrsctplib/netinet/sctp_constants.h:464:9`!) ||
9157 (SCTP_GET_STATEcxx . . $ `usrsctplib/netinet/sctp_constants.h:476:9`!(stcb) == SCTP_STATE_SHUTDOWN_RECEIVEDcxx . . $ `usrsctplib/netinet/sctp_constants.h:466:9`!)) &&
9158 (skip_data_for_this_net == 0)) ||
9159 (cookie)) {
9160 TAILQ_FOREACH_SAFEcxx . . $ `usrsctplib/netinet/sctp_os_userspace.h:1109:9`!(chk, &asoc->send_queue, sctp_next, nchk) {
9161 if (no_data_chunks) {
9162 /* let only control go out */
9163 *reason_code = 1;
9164 break;
9165 }
9166 if (net->flight_sizecxx . . $ sctp_nets#flight_size. >= net->cwndcxx . . $ sctp_nets#cwnd.) {
9167 /* skip this net, no room for data */
9168 *reason_code = 2;
9169 break;
9170 }
9171 if ((chk->whoTocxx . . $ sctp_tmit_chunk#whoTo. != NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!) &&
9172 (chk->whoTocxx . . $ sctp_tmit_chunk#whoTo. != net)) {
9173 /* Don't send the chunk on this net */
9174 continue;
9175 }
9176
9177 if (asoc->sctp_cmt_on_offcxx . . $ sctp_association#sctp_cmt_on_off. == 0) {
9178 if ((asoc->alternatecxx . . $ sctp_association#alternate.) &&
9179 (asoc->alternatecxx . . $ sctp_association#alternate. != net) &&
9180 (chk->whoTocxx . . $ sctp_tmit_chunk#whoTo. == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!)) {
9181 continue;
9182 } else if ((net != asoc->primary_destinationcxx . . $ sctp_association#primary_destination.) &&
9183 (asoc->alternatecxx . . $ sctp_association#alternate. == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!) &&
9184 (chk->whoTocxx . . $ sctp_tmit_chunk#whoTo. == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!)) {
9185 continue;
9186 }
9187 }
9188 if ((chk->send_sizecxx . . $ sctp_tmit_chunk#send_size. > omtu) && ((chk->flagscxx . . $ sctp_tmit_chunk#flags. & CHUNK_FLAGS_FRAGMENT_OKcxx . . $ `usrsctplib/netinet/sctp_structs.h:466:9`!) == 0)) {
9189 /*-
9190 * strange, we have a chunk that is
9191 * to big for its destination and
9192 * yet no fragment ok flag.
9193 * Something went wrong when the
9194 * PMTU changed...we did not mark
9195 * this chunk for some reason?? I
9196 * will fix it here by letting IP
9197 * fragment it for now and printing
9198 * a warning. This really should not
9199 * happen ...
9200 */
9201 SCTP_PRINTFcxx . . $ `usrsctplib/netinet/sctp_os_userspace.h:536:9`!("Warning chunk of %d bytes > mtu:%d and yet PMTU disc missed\n",
9202 chk->send_size, mtu);
9203 chk->flagscxx . . $ sctp_tmit_chunk#flags. |= CHUNK_FLAGS_FRAGMENT_OKcxx . . $ `usrsctplib/netinet/sctp_structs.h:466:9`!;
9204 }
9205 if (SCTP_BASE_SYSCTLcxx . . $ `usrsctplib/netinet/sctp_os_userspace.h:579:9`!(sctp_enable_sack_immediately) &&
9206 (asoc->statecxx . . $ sctp_association#state. & SCTP_STATE_SHUTDOWN_PENDINGcxx . . $ `usrsctplib/netinet/sctp_constants.h:468:9`!)) {
9207 struct sctp_data_chunkcxx . . $ sctp_data_chunk# *dchkh;
9208
9209 dchkh = mtodcxx . . $ `usrsctplib/user_mbuf.h:96:9`!(chk->data, struct sctp_data_chunk *);
9210 dchkh->chcxx . . $ sctp_data_chunk#ch..chunk_flagscxx . . $ sctp_chunkhdr#chunk_flags. |= SCTP_DATA_SACK_IMMEDIATELYcxx . . $ `usrsctplib/netinet/sctp.h:511:9`!;
9211 }
9212 if (((chk->send_sizecxx . . $ sctp_tmit_chunk#send_size. <= mtu) && (chk->send_sizecxx . . $ sctp_tmit_chunk#send_size. <= r_mtu)) ||
9213 ((chk->flagscxx . . $ sctp_tmit_chunk#flags. & CHUNK_FLAGS_FRAGMENT_OKcxx . . $ `usrsctplib/netinet/sctp_structs.h:466:9`!) && (chk->send_sizecxx . . $ sctp_tmit_chunk#send_size. <= asoc->peers_rwndcxx . . $ sctp_association#peers_rwnd.))) {
9214 /* ok we will add this one */
9215
9216 /*
9217 * Add an AUTH chunk, if chunk
9218 * requires it, save the offset into
9219 * the chain for AUTH
9220 */
9221 if (data_auth_reqd) {
9222 if (auth == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!) {
9223 outchain = sctp_add_auth_chunkcxx . . $ sctp_add_auth_chunk(c0b2bf5d35b7e5c6).(outchain,
9224 &endoutchain,
9225 &auth,
9226 &auth_offset,
9227 stcb,
9228 SCTP_DATAcxx . . $ `usrsctplib/netinet/sctp.h:449:9`!);
9229 auth_keyid = chk->auth_keyidcxx . . $ sctp_tmit_chunk#auth_keyid.;
9230 override_ok = 0;
9231 SCTP_STAT_INCR_COUNTER64cxx . . $ `./netinet/sctp_uio.h:1127:9`!(sctps_outcontrolchunks);
9232 } else if (override_ok) {
9233 /* use this data's keyid */
9234 auth_keyid = chk->auth_keyidcxx . . $ sctp_tmit_chunk#auth_keyid.;
9235 override_ok = 0;
9236 } else if (auth_keyid != chk->auth_keyidcxx . . $ sctp_tmit_chunk#auth_keyid.) {
9237 /* different keyid, so done bundling */
9238 break;
9239 }
9240 }
9241 outchain = sctp_copy_mbufchaincxx . . $ sctp_copy_mbufchain(161b07f3a70427c7).(chk->datacxx . . $ sctp_tmit_chunk#data., outchain, &endoutchain, 0,
9242 chk->send_sizecxx . . $ sctp_tmit_chunk#send_size., chk->copy_by_refcxx . . $ sctp_tmit_chunk#copy_by_ref.);
9243 if (outchain == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!) {
9244 SCTPDBGcxx . . $ `usrsctplib/netinet/sctp_os_userspace.h:591:9`!(SCTP_DEBUG_OUTPUT3cxx . . $ `usrsctplib/netinet/sctp_constants.h:645:9`!, "No memory?\n");
9245 if (!SCTP_OS_TIMER_PENDINGcxx . . $ `usrsctplib/netinet/sctp_callout.h:107:9`!(&net->rxt_timer.timer)) {
9246 sctp_timer_startcxx . . $ sctp_timer_start(73c9263bfa4b937d).(SCTP_TIMER_TYPE_SENDcxx . . $ `usrsctplib/netinet/sctp_constants.h:537:9`!, inp, stcb, net);
9247 }
9248 *reason_code = 3;
9249 SCTP_LTRACE_ERR_RETcxx . . $ `usrsctplib/netinet/sctp_os_userspace.h:629:9`!(inp, stcb, NULL, SCTP_FROM_SCTP_OUTPUT, ENOMEM);
9250 return (ENOMEMcxx . . $ `<external>/8987895939074593727/errno-base.h:16:9`!);
9251 }
9252 /* upate our MTU size */
9253 /* Do clear IP_DF ? */
9254 if (chk->flagscxx . . $ sctp_tmit_chunk#flags. & CHUNK_FLAGS_FRAGMENT_OKcxx . . $ `usrsctplib/netinet/sctp_structs.h:466:9`!) {
9255 no_fragmentflg = 0;
9256 }
9257 /* unsigned subtraction of mtu */
9258 if (mtu > chk->send_sizecxx . . $ sctp_tmit_chunk#send_size.)
9259 mtu -= chk->send_sizecxx . . $ sctp_tmit_chunk#send_size.;
9260 else
9261 mtu = 0;
9262 /* unsigned subtraction of r_mtu */
9263 if (r_mtu > chk->send_sizecxx . . $ sctp_tmit_chunk#send_size.)
9264 r_mtu -= chk->send_sizecxx . . $ sctp_tmit_chunk#send_size.;
9265 else
9266 r_mtu = 0;
9267
9268 to_out += chk->send_sizecxx . . $ sctp_tmit_chunk#send_size.;
9269 if ((to_out > mx_mtu) && no_fragmentflg) {
9270 #ifdef INVARIANTS
9271 panic("Exceeding mtu of %d out size is %d", mx_mtu, to_out);
9272 #else
9273 SCTP_PRINTFcxx . . $ `usrsctplib/netinet/sctp_os_userspace.h:536:9`!("Exceeding mtu of %d out size is %d\n",
9274 mx_mtu, to_out);
9275 #endif
9276 }
9277 chk->window_probecxx . . $ sctp_tmit_chunk#window_probe. = 0;
9278 data_list[bundle_at++] = chk;
9279 if (bundle_at >= SCTP_MAX_DATA_BUNDLINGcxx . . $ `usrsctplib/netinet/sctp_constants.h:880:9`!) {
9280 break;
9281 }
9282 if (chk->sentcxx . . $ sctp_tmit_chunk#sent. == SCTP_DATAGRAM_UNSENTcxx . . $ `usrsctplib/netinet/sctp_constants.h:353:9`!) {
9283 if ((chk->reccxx . . $ sctp_tmit_chunk#rec..datacxx . . $ sctp_tmit_chunk#$anonymous_type_3#data..rcv_flagscxx . . $ sctp_data_chunkrec#rcv_flags. & SCTP_DATA_UNORDEREDcxx . . $ `usrsctplib/netinet/sctp.h:510:9`!) == 0) {
9284 SCTP_STAT_INCR_COUNTER64cxx . . $ `./netinet/sctp_uio.h:1127:9`!(sctps_outorderchunks);
9285 } else {
9286 SCTP_STAT_INCR_COUNTER64cxx . . $ `./netinet/sctp_uio.h:1127:9`!(sctps_outunorderchunks);
9287 }
9288 if (((chk->reccxx . . $ sctp_tmit_chunk#rec..datacxx . . $ sctp_tmit_chunk#$anonymous_type_3#data..rcv_flagscxx . . $ sctp_data_chunkrec#rcv_flags. & SCTP_DATA_LAST_FRAGcxx . . $ `usrsctplib/netinet/sctp.h:507:9`!) == SCTP_DATA_LAST_FRAGcxx . . $ `usrsctplib/netinet/sctp.h:507:9`!) &&
9289 ((chk->reccxx . . $ sctp_tmit_chunk#rec..datacxx . . $ sctp_tmit_chunk#$anonymous_type_3#data..rcv_flagscxx . . $ sctp_data_chunkrec#rcv_flags. & SCTP_DATA_FIRST_FRAGcxx . . $ `usrsctplib/netinet/sctp.h:508:9`!) == 0))
9290 /* Count number of user msg's that were fragmented
9291 * we do this by counting when we see a LAST fragment
9292 * only.
9293 */
9294 SCTP_STAT_INCR_COUNTER64cxx . . $ `./netinet/sctp_uio.h:1127:9`!(sctps_fragusrmsgs);
9295 }
9296 if ((mtu == 0) || (r_mtu == 0) || (one_chunk)) {
9297 if ((one_chunk) && (stcb->asoccxx . . $ sctp_tcb#asoc..total_flightcxx . . $ sctp_association#total_flight. == 0)) {
9298 data_list[0]->window_probecxx . . $ sctp_tmit_chunk#window_probe. = 1;
9299 net->window_probecxx . . $ sctp_nets#window_probe. = 1;
9300 }
9301 break;
9302 }
9303 } else {
9304 /*
9305 * Must be sent in order of the
9306 * TSN's (on a network)
9307 */
9308 break;
9309 }
9310 } /* for (chunk gather loop for this net) */
9311 } /* if asoc.state OPEN */
9312 no_data_fill:
9313 /* Is there something to send for this destination? */
9314 if (outchain) {
9315 /* We may need to start a control timer or two */
9316 if (asconf) {
9317 sctp_timer_startcxx . . $ sctp_timer_start(73c9263bfa4b937d).(SCTP_TIMER_TYPE_ASCONFcxx . . $ `usrsctplib/netinet/sctp_constants.h:546:9`!, inp,
9318 stcb, net);
9319 /*
9320 * do NOT clear the asconf flag as it is used
9321 * to do appropriate source address selection.
9322 */
9323 }
9324 if (cookie) {
9325 sctp_timer_startcxx . . $ sctp_timer_start(73c9263bfa4b937d).(SCTP_TIMER_TYPE_COOKIEcxx . . $ `usrsctplib/netinet/sctp_constants.h:542:9`!, inp, stcb, net);
9326 cookie = 0;
9327 }
9328 /* must start a send timer if data is being sent */
9329 if (bundle_at && (!SCTP_OS_TIMER_PENDINGcxx . . $ `usrsctplib/netinet/sctp_callout.h:107:9`!(&net->rxt_timer.timer))) {
9330 /*
9331 * no timer running on this destination
9332 * restart it.
9333 */
9334 sctp_timer_startcxx . . $ sctp_timer_start(73c9263bfa4b937d).(SCTP_TIMER_TYPE_SENDcxx . . $ `usrsctplib/netinet/sctp_constants.h:537:9`!, inp, stcb, net);
9335 }
9336 if (bundle_at || hbflag) {
9337 /* For data/asconf and hb set time */
9338 if (*now_filled == 0) {
9339 (void)SCTP_GETTIME_TIMEVALcxx . . $ `usrsctplib/netinet/sctp_constants.h:995:9`!(now);
9340 *now_filled = 1;
9341 }
9342 net->last_sent_timecxx . . $ sctp_nets#last_sent_time. = *now;
9343 }
9344 /* Now send it, if there is anything to send :> */
9345 if ((error = sctp_lowlevel_chunk_outputcxx . . $ sctp_lowlevel_chunk_output(4859f95fdecd7401).(inp,
9346 stcb,
9347 net,
9348 (struct sockaddrcxx . . $ sockaddr# *)&net->rocxx . . $ sctp_nets#ro.._l_addrcxx . . $ sctp_net_route#_l_addr.,
9349 outchain,
9350 auth_offset,
9351 auth,
9352 auth_keyid,
9353 no_fragmentflg,
9354 bundle_at,
9355 asconf,
9356 inp->sctp_lportcxx . . $ `usrsctplib/netinet/sctp_pcb.h:430:9`!, stcb->rportcxx . . $ sctp_tcb#rport.,
9357 htonlcxx . . $ htonl(2141b656ce2cc063).(stcb->asoccxx . . $ sctp_tcb#asoc..peer_vtagcxx . . $ sctp_association#peer_vtag.),
9358 net->portcxx . . $ sctp_nets#port., NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!,
9359 #if defined(__FreeBSD__) && !defined(__Userspace__cxx . . $ `<built-in>:442:9`!)
9360 0, 0,
9361 #endif
9362 so_locked))) {
9363 /* error, we could not output */
9364 SCTPDBGcxx . . $ `usrsctplib/netinet/sctp_os_userspace.h:591:9`!(SCTP_DEBUG_OUTPUT3cxx . . $ `usrsctplib/netinet/sctp_constants.h:645:9`!, "Gak send error %d\n", error);
9365 if (from_where == 0) {
9366 SCTP_STAT_INCRcxx . . $ `./netinet/sctp_uio.h:1111:9`!(sctps_lowlevelerrusr);
9367 }
9368 if (error == ENOBUFScxx . . $ `<external>/17922322188510340118/errno.h:89:9`!) {
9369 asoc->ifp_had_enobufcxx . . $ sctp_association#ifp_had_enobuf. = 1;
9370 SCTP_STAT_INCRcxx . . $ `./netinet/sctp_uio.h:1111:9`!(sctps_lowlevelerr);
9371 }
9372 if (error == EHOSTUNREACHcxx . . $ `<external>/17922322188510340118/errno.h:97:9`!) {
9373 /*
9374 * Destination went unreachable
9375 * during this send
9376 */
9377 sctp_move_chunks_from_netcxx . . $ sctp_move_chunks_from_net(2ed2c3ddd2bbab6a).(stcb, net);
9378 }
9379 *reason_code = 6;
9380 /*-
9381 * I add this line to be paranoid. As far as
9382 * I can tell the continue, takes us back to
9383 * the top of the for, but just to make sure
9384 * I will reset these again here.
9385 */
9386 ctl_cnt = 0;
9387 continue; /* This takes us back to the for() for the nets. */
9388 } else {
9389 asoc->ifp_had_enobufcxx . . $ sctp_association#ifp_had_enobuf. = 0;
9390 }
9391 endoutchain = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!;
9392 auth = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!;
9393 auth_offset = 0;
9394 if (!no_out_cnt) {
9395 *num_out += (ctl_cnt + bundle_at);
9396 }
9397 if (bundle_at) {
9398 /* setup for a RTO measurement */
9399 tsns_sent = data_list[0]->reccxx . . $ sctp_tmit_chunk#rec..datacxx . . $ sctp_tmit_chunk#$anonymous_type_3#data..tsncxx . . $ sctp_data_chunkrec#tsn.;
9400 /* fill time if not already filled */
9401 if (*now_filled == 0) {
9402 (void)SCTP_GETTIME_TIMEVALcxx . . $ `usrsctplib/netinet/sctp_constants.h:995:9`!(&asoc->time_last_sent);
9403 *now_filled = 1;
9404 *now = asoc->time_last_sentcxx . . $ sctp_association#time_last_sent.;
9405 } else {
9406 asoc->time_last_sentcxx . . $ sctp_association#time_last_sent. = *now;
9407 }
9408 if (net->rto_neededcxx . . $ sctp_nets#rto_needed.) {
9409 data_list[0]->do_rttcxx . . $ sctp_tmit_chunk#do_rtt. = 1;
9410 net->rto_neededcxx . . $ sctp_nets#rto_needed. = 0;
9411 }
9412 SCTP_STAT_INCR_BYcxx . . $ `./netinet/sctp_uio.h:1122:9`!(sctps_senddata, bundle_at);
9413 sctp_clean_up_datalistcxx . . $ sctp_clean_up_datalist(19c631143ae78ffc).(stcb, asoc, data_list, bundle_at, net);
9414 }
9415 if (one_chunk) {
9416 break;
9417 }
9418 }
9419 if (SCTP_BASE_SYSCTLcxx . . $ `usrsctplib/netinet/sctp_os_userspace.h:579:9`!(sctp_logging_level) & SCTP_CWND_LOGGING_ENABLEcxx . . $ `usrsctplib/netinet/sctp.h:640:9`!) {
9420 sctp_log_cwndcxx . . $ sctp_log_cwnd(b2b0f138897254c).(stcb, net, tsns_sent, SCTP_CWND_LOG_FROM_SENDcxx . . $ `usrsctplib/netinet/sctp_constants.h:170:9`!);
9421 }
9422 }
9423 if (old_start_at == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!) {
9424 old_start_at = start_at;
9425 start_at = TAILQ_FIRSTcxx . . $ `<external>/2546723208511035544/queue.h:458:9`!(&asoc->nets);
9426 if (old_start_at)
9427 goto again_one_more_time;
9428 }
9429
9430 /*
9431 * At the end there should be no NON timed chunks hanging on this
9432 * queue.
9433 */
9434 if (SCTP_BASE_SYSCTLcxx . . $ `usrsctplib/netinet/sctp_os_userspace.h:579:9`!(sctp_logging_level) & SCTP_CWND_LOGGING_ENABLEcxx . . $ `usrsctplib/netinet/sctp.h:640:9`!) {
9435 sctp_log_cwndcxx . . $ sctp_log_cwnd(b2b0f138897254c).(stcb, net, *num_out, SCTP_CWND_LOG_FROM_SENDcxx . . $ `usrsctplib/netinet/sctp_constants.h:170:9`!);
9436 }
9437 if ((*num_out == 0) && (*reason_code == 0)) {
9438 *reason_code = 4;
9439 } else {
9440 *reason_code = 5;
9441 }
9442 sctp_clean_up_ctlcxx . . $ sctp_clean_up_ctl(1b508a31e65fdabe).(stcb, asoc, so_locked);
9443 return (0);
9444 }
9445
9446 void
9447 sctp_queue_op_errcxx . . $ sctp_queue_op_err(98b23b80e7c19753).(struct sctp_tcbcxx . . $ sctp_tcb# *stcb, struct mbufcxx . . $ mbuf# *op_err)
9448 {
9449 /*-
9450 * Prepend a OPERATIONAL_ERROR chunk header and put on the end of
9451 * the control chunk queue.
9452 */
9453 struct sctp_chunkhdrcxx . . $ sctp_chunkhdr# *hdr;
9454 struct sctp_tmit_chunkcxx . . $ sctp_tmit_chunk# *chk;
9455 struct mbufcxx . . $ mbuf# *mat, *last_mbuf;
9456 uint32_tcxx . . $ uint32_t# chunk_length;
9457 uint16_tcxx . . $ uint16_t# padding_length;
9458
9459 SCTP_TCB_LOCK_ASSERTcxx . . $ `usrsctplib/netinet/sctp_process_lock.h:478:9`!(stcb);
9460 SCTP_BUF_PREPENDcxx . . $ `usrsctplib/netinet/sctp_os_userspace.h:799:9`!(op_err, sizeof(struct sctp_chunkhdr), M_NOWAITcxx . . $ `usrsctplib/user_malloc.h:60:9`!);
9461 if (op_err == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!) {
9462 return;
9463 }
9464 last_mbuf = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!;
9465 chunk_length = 0;
9466 for (mat = op_err; mat != NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!; mat = SCTP_BUF_NEXTcxx . . $ `usrsctplib/netinet/sctp_os_userspace.h:791:9`!(mat)) {
9467 chunk_length += SCTP_BUF_LENcxx . . $ `usrsctplib/netinet/sctp_os_userspace.h:790:9`!(mat);
9468 if (SCTP_BUF_NEXTcxx . . $ `usrsctplib/netinet/sctp_os_userspace.h:791:9`!(mat) == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!) {
9469 last_mbuf = mat;
9470 }
9471 }
9472 if (chunk_length > SCTP_MAX_CHUNK_LENGTHcxx . . $ `usrsctplib/netinet/sctp_constants.h:77:9`!) {
9473 sctp_m_freemcxx . . $ `usrsctplib/netinet/sctputil.h:57:9`!(op_err);
9474 return;
9475 }
9476 padding_length = chunk_length % 4;
9477 if (padding_length != 0) {
9478 padding_length = 4 - padding_length;
9479 }
9480 if (padding_length != 0) {
9481 if (sctp_add_pad_tombufcxx . . $ sctp_add_pad_tombuf(78d6dcf03d579fb3).(last_mbuf, padding_length) == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!) {
9482 sctp_m_freemcxx . . $ `usrsctplib/netinet/sctputil.h:57:9`!(op_err);
9483 return;
9484 }
9485 }
9486 sctp_alloc_a_chunkcxx . . $ `usrsctplib/netinet/sctp_var.h:170:9`!(stcb, chk);
9487 if (chk == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!) {
9488 /* no memory */
9489 sctp_m_freemcxx . . $ `usrsctplib/netinet/sctputil.h:57:9`!(op_err);
9490 return;
9491 }
9492 chk->copy_by_refcxx . . $ sctp_tmit_chunk#copy_by_ref. = 0;
9493 chk->reccxx . . $ sctp_tmit_chunk#rec..chunk_idcxx . . $ sctp_tmit_chunk#$anonymous_type_3#chunk_id..idcxx . . $ chk_id#id. = SCTP_OPERATION_ERRORcxx . . $ `usrsctplib/netinet/sctp.h:458:9`!;
9494 chk->reccxx . . $ sctp_tmit_chunk#rec..chunk_idcxx . . $ sctp_tmit_chunk#$anonymous_type_3#chunk_id..can_take_datacxx . . $ chk_id#can_take_data. = 0;
9495 chk->flagscxx . . $ sctp_tmit_chunk#flags. = 0;
9496 chk->send_sizecxx . . $ sctp_tmit_chunk#send_size. = (uint16_tcxx . . $ uint16_t#)chunk_length;
9497 chk->sentcxx . . $ sctp_tmit_chunk#sent. = SCTP_DATAGRAM_UNSENTcxx . . $ `usrsctplib/netinet/sctp_constants.h:353:9`!;
9498 chk->snd_countcxx . . $ sctp_tmit_chunk#snd_count. = 0;
9499 chk->asoccxx . . $ sctp_tmit_chunk#asoc. = &stcb->asoccxx . . $ sctp_tcb#asoc.;
9500 chk->datacxx . . $ sctp_tmit_chunk#data. = op_err;
9501 chk->whoTocxx . . $ sctp_tmit_chunk#whoTo. = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!;
9502 hdr = mtodcxx . . $ `usrsctplib/user_mbuf.h:96:9`!(op_err, struct sctp_chunkhdr *);
9503 hdr->chunk_typecxx . . $ sctp_chunkhdr#chunk_type. = SCTP_OPERATION_ERRORcxx . . $ `usrsctplib/netinet/sctp.h:458:9`!;
9504 hdr->chunk_flagscxx . . $ sctp_chunkhdr#chunk_flags. = 0;
9505 hdr->chunk_lengthcxx . . $ sctp_chunkhdr#chunk_length. = htonscxx . . $ htons(a18c05e4017afb3d).(chk->send_sizecxx . . $ sctp_tmit_chunk#send_size.);
9506 TAILQ_INSERT_TAILcxx . . $ `<external>/2546723208511035544/queue.h:402:9`!(&chk->asoc->control_send_queue, chk, sctp_next);
9507 chk->asoccxx . . $ sctp_tmit_chunk#asoc.->ctrl_queue_cntcxx . . $ sctp_association#ctrl_queue_cnt.++;
9508 }
9509
9510 int
9511 sctp_send_cookie_echocxx . . $ sctp_send_cookie_echo(a51807ed968663a3).(struct mbufcxx . . $ mbuf# *m,
9512 int offset, int limit,
9513 struct sctp_tcbcxx . . $ sctp_tcb# *stcb,
9514 struct sctp_netscxx . . $ sctp_nets# *net)
9515 {
9516 /*-
9517 * pull out the cookie and put it at the front of the control chunk
9518 * queue.
9519 */
9520 int at;
9521 struct mbufcxx . . $ mbuf# *cookie;
9522 struct sctp_paramhdrcxx . . $ sctp_paramhdr# param, *phdr;
9523 struct sctp_chunkhdrcxx . . $ sctp_chunkhdr# *hdr;
9524 struct sctp_tmit_chunkcxx . . $ sctp_tmit_chunk# *chk;
9525 uint16_tcxx . . $ uint16_t# ptype, plen;
9526
9527 SCTP_TCB_LOCK_ASSERTcxx . . $ `usrsctplib/netinet/sctp_process_lock.h:478:9`!(stcb);
9528 /* First find the cookie in the param area */
9529 cookie = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!;
9530 at = offset + sizeof(struct sctp_init_chunkcxx . . $ sctp_init_chunk#);
9531 for (;;) {
9532 phdr = sctp_get_next_paramcxx . . $ sctp_get_next_param(db742a953aea46f4).(m, at, &param, sizeof(param));
9533 if (phdr == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!) {
9534 return (-3);
9535 }
9536 ptype = ntohscxx . . $ ntohs(a18c05e4017afb3d).(phdr->param_typecxx . . $ sctp_paramhdr#param_type.);
9537 plen = ntohscxx . . $ ntohs(a18c05e4017afb3d).(phdr->param_lengthcxx . . $ sctp_paramhdr#param_length.);
9538 if (plen < sizeof(struct sctp_paramhdrcxx . . $ sctp_paramhdr#)) {
9539 return (-6);
9540 }
9541 if (ptype == SCTP_STATE_COOKIEcxx . . $ `usrsctplib/netinet/sctp_constants.h:401:9`!) {
9542 int pad;
9543
9544 /* found the cookie */
9545 if (at + plen > limit) {
9546 return (-7);
9547 }
9548 cookie = SCTP_M_COPYMcxx . . $ `usrsctplib/netinet/sctp_os_userspace.h:759:9`!(m, at, plen, M_NOWAITcxx . . $ `usrsctplib/user_malloc.h:60:9`!);
9549 if (cookie == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!) {
9550 /* No memory */
9551 return (-2);
9552 }
9553 if ((pad = (plen % 4)) > 0) {
9554 pad = 4 - pad;
9555 }
9556 if (pad > 0) {
9557 if (sctp_pad_lastmbufcxx . . $ sctp_pad_lastmbuf(d56025566d40237d).(cookie, pad, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!) == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!) {
9558 return (-8);
9559 }
9560 }
9561 #ifdef SCTP_MBUF_LOGGING
9562 if (SCTP_BASE_SYSCTL(sctp_logging_level) & SCTP_MBUF_LOGGING_ENABLE) {
9563 sctp_log_mbc(cookie, SCTP_MBUF_ICOPY);
9564 }
9565 #endif
9566 break;
9567 }
9568 at += SCTP_SIZE32cxx . . $ `usrsctplib/netinet/sctp_constants.h:388:9`!(plen);
9569 }
9570 /* ok, we got the cookie lets change it into a cookie echo chunk */
9571 /* first the change from param to cookie */
9572 hdr = mtodcxx . . $ `usrsctplib/user_mbuf.h:96:9`!(cookie, struct sctp_chunkhdr *);
9573 hdr->chunk_typecxx . . $ sctp_chunkhdr#chunk_type. = SCTP_COOKIE_ECHOcxx . . $ `usrsctplib/netinet/sctp.h:459:9`!;
9574 hdr->chunk_flagscxx . . $ sctp_chunkhdr#chunk_flags. = 0;
9575 /* get the chunk stuff now and place it in the FRONT of the queue */
9576 sctp_alloc_a_chunkcxx . . $ `usrsctplib/netinet/sctp_var.h:170:9`!(stcb, chk);
9577 if (chk == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!) {
9578 /* no memory */
9579 sctp_m_freemcxx . . $ `usrsctplib/netinet/sctputil.h:57:9`!(cookie);
9580 return (-5);
9581 }
9582 chk->copy_by_refcxx . . $ sctp_tmit_chunk#copy_by_ref. = 0;
9583 chk->reccxx . . $ sctp_tmit_chunk#rec..chunk_idcxx . . $ sctp_tmit_chunk#$anonymous_type_3#chunk_id..idcxx . . $ chk_id#id. = SCTP_COOKIE_ECHOcxx . . $ `usrsctplib/netinet/sctp.h:459:9`!;
9584 chk->reccxx . . $ sctp_tmit_chunk#rec..chunk_idcxx . . $ sctp_tmit_chunk#$anonymous_type_3#chunk_id..can_take_datacxx . . $ chk_id#can_take_data. = 0;
9585 chk->flagscxx . . $ sctp_tmit_chunk#flags. = CHUNK_FLAGS_FRAGMENT_OKcxx . . $ `usrsctplib/netinet/sctp_structs.h:466:9`!;
9586 chk->send_sizecxx . . $ sctp_tmit_chunk#send_size. = SCTP_SIZE32cxx . . $ `usrsctplib/netinet/sctp_constants.h:388:9`!(plen);
9587 chk->sentcxx . . $ sctp_tmit_chunk#sent. = SCTP_DATAGRAM_UNSENTcxx . . $ `usrsctplib/netinet/sctp_constants.h:353:9`!;
9588 chk->snd_countcxx . . $ sctp_tmit_chunk#snd_count. = 0;
9589 chk->asoccxx . . $ sctp_tmit_chunk#asoc. = &stcb->asoccxx . . $ sctp_tcb#asoc.;
9590 chk->datacxx . . $ sctp_tmit_chunk#data. = cookie;
9591 chk->whoTocxx . . $ sctp_tmit_chunk#whoTo. = net;
9592 atomic_add_intcxx . . $ `usrsctplib/user_atomic.h:94:9`!(&chk->whoTo->ref_count, 1);
9593 TAILQ_INSERT_HEADcxx . . $ `<external>/2546723208511035544/queue.h:392:9`!(&chk->asoc->control_send_queue, chk, sctp_next);
9594 chk->asoccxx . . $ sctp_tmit_chunk#asoc.->ctrl_queue_cntcxx . . $ sctp_association#ctrl_queue_cnt.++;
9595 return (0);
9596 }
9597
9598 void
9599 sctp_send_heartbeat_ackcxx . . $ sctp_send_heartbeat_ack(3639f9c97442cc48).(struct sctp_tcbcxx . . $ sctp_tcb# *stcb,
9600 struct mbufcxx . . $ mbuf# *m,
9601 int offset,
9602 int chk_length,
9603 struct sctp_netscxx . . $ sctp_nets# *net)
9604 {
9605 /*
9606 * take a HB request and make it into a HB ack and send it.
9607 */
9608 struct mbufcxx . . $ mbuf# *outchain;
9609 struct sctp_chunkhdrcxx . . $ sctp_chunkhdr# *chdr;
9610 struct sctp_tmit_chunkcxx . . $ sctp_tmit_chunk# *chk;
9611
9612 if (net == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!)
9613 /* must have a net pointer */
9614 return;
9615
9616 outchain = SCTP_M_COPYMcxx . . $ `usrsctplib/netinet/sctp_os_userspace.h:759:9`!(m, offset, chk_length, M_NOWAITcxx . . $ `usrsctplib/user_malloc.h:60:9`!);
9617 if (outchain == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!) {
9618 /* gak out of memory */
9619 return;
9620 }
9621 #ifdef SCTP_MBUF_LOGGING
9622 if (SCTP_BASE_SYSCTL(sctp_logging_level) & SCTP_MBUF_LOGGING_ENABLE) {
9623 sctp_log_mbc(outchain, SCTP_MBUF_ICOPY);
9624 }
9625 #endif
9626 chdr = mtodcxx . . $ `usrsctplib/user_mbuf.h:96:9`!(outchain, struct sctp_chunkhdr *);
9627 chdr->chunk_typecxx . . $ sctp_chunkhdr#chunk_type. = SCTP_HEARTBEAT_ACKcxx . . $ `usrsctplib/netinet/sctp.h:454:9`!;
9628 chdr->chunk_flagscxx . . $ sctp_chunkhdr#chunk_flags. = 0;
9629 if (chk_length % 4 != 0) {
9630 sctp_pad_lastmbufcxx . . $ sctp_pad_lastmbuf(d56025566d40237d).(outchain, 4 - (chk_length % 4), NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!);
9631 }
9632 sctp_alloc_a_chunkcxx . . $ `usrsctplib/netinet/sctp_var.h:170:9`!(stcb, chk);
9633 if (chk == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!) {
9634 /* no memory */
9635 sctp_m_freemcxx . . $ `usrsctplib/netinet/sctputil.h:57:9`!(outchain);
9636 return;
9637 }
9638 chk->copy_by_refcxx . . $ sctp_tmit_chunk#copy_by_ref. = 0;
9639 chk->reccxx . . $ sctp_tmit_chunk#rec..chunk_idcxx . . $ sctp_tmit_chunk#$anonymous_type_3#chunk_id..idcxx . . $ chk_id#id. = SCTP_HEARTBEAT_ACKcxx . . $ `usrsctplib/netinet/sctp.h:454:9`!;
9640 chk->reccxx . . $ sctp_tmit_chunk#rec..chunk_idcxx . . $ sctp_tmit_chunk#$anonymous_type_3#chunk_id..can_take_datacxx . . $ chk_id#can_take_data. = 1;
9641 chk->flagscxx . . $ sctp_tmit_chunk#flags. = 0;
9642 chk->send_sizecxx . . $ sctp_tmit_chunk#send_size. = chk_length;
9643 chk->sentcxx . . $ sctp_tmit_chunk#sent. = SCTP_DATAGRAM_UNSENTcxx . . $ `usrsctplib/netinet/sctp_constants.h:353:9`!;
9644 chk->snd_countcxx . . $ sctp_tmit_chunk#snd_count. = 0;
9645 chk->asoccxx . . $ sctp_tmit_chunk#asoc. = &stcb->asoccxx . . $ sctp_tcb#asoc.;
9646 chk->datacxx . . $ sctp_tmit_chunk#data. = outchain;
9647 chk->whoTocxx . . $ sctp_tmit_chunk#whoTo. = net;
9648 atomic_add_intcxx . . $ `usrsctplib/user_atomic.h:94:9`!(&chk->whoTo->ref_count, 1);
9649 TAILQ_INSERT_TAILcxx . . $ `<external>/2546723208511035544/queue.h:402:9`!(&chk->asoc->control_send_queue, chk, sctp_next);
9650 chk->asoccxx . . $ sctp_tmit_chunk#asoc.->ctrl_queue_cntcxx . . $ sctp_association#ctrl_queue_cnt.++;
9651 }
9652
9653 void
9654 sctp_send_cookie_ackcxx . . $ sctp_send_cookie_ack(5e56bbb8005ef9b0).(struct sctp_tcbcxx . . $ sctp_tcb# *stcb)
9655 {
9656 /* formulate and queue a cookie-ack back to sender */
9657 struct mbufcxx . . $ mbuf# *cookie_ack;
9658 struct sctp_chunkhdrcxx . . $ sctp_chunkhdr# *hdr;
9659 struct sctp_tmit_chunkcxx . . $ sctp_tmit_chunk# *chk;
9660
9661 SCTP_TCB_LOCK_ASSERTcxx . . $ `usrsctplib/netinet/sctp_process_lock.h:478:9`!(stcb);
9662
9663 cookie_ack = sctp_get_mbuf_for_msgcxx . . $ sctp_get_mbuf_for_msg(c7c30fc329598377).(sizeof(struct sctp_chunkhdrcxx . . $ sctp_chunkhdr#), 0, M_NOWAITcxx . . $ `usrsctplib/user_malloc.h:60:9`!, 1, MT_HEADERcxx . . $ `usrsctplib/user_mbuf.h:290:9`!);
9664 if (cookie_ack == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!) {
9665 /* no mbuf's */
9666 return;
9667 }
9668 SCTP_BUF_RESV_UFcxx . . $ `usrsctplib/netinet/sctp_os_userspace.h:793:9`!(cookie_ack, SCTP_MIN_OVERHEADcxx . . $ `usrsctplib/netinet/sctp_header.h:561:9`!);
9669 sctp_alloc_a_chunkcxx . . $ `usrsctplib/netinet/sctp_var.h:170:9`!(stcb, chk);
9670 if (chk == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!) {
9671 /* no memory */
9672 sctp_m_freemcxx . . $ `usrsctplib/netinet/sctputil.h:57:9`!(cookie_ack);
9673 return;
9674 }
9675 chk->copy_by_refcxx . . $ sctp_tmit_chunk#copy_by_ref. = 0;
9676 chk->reccxx . . $ sctp_tmit_chunk#rec..chunk_idcxx . . $ sctp_tmit_chunk#$anonymous_type_3#chunk_id..idcxx . . $ chk_id#id. = SCTP_COOKIE_ACKcxx . . $ `usrsctplib/netinet/sctp.h:460:9`!;
9677 chk->reccxx . . $ sctp_tmit_chunk#rec..chunk_idcxx . . $ sctp_tmit_chunk#$anonymous_type_3#chunk_id..can_take_datacxx . . $ chk_id#can_take_data. = 1;
9678 chk->flagscxx . . $ sctp_tmit_chunk#flags. = 0;
9679 chk->send_sizecxx . . $ sctp_tmit_chunk#send_size. = sizeof(struct sctp_chunkhdrcxx . . $ sctp_chunkhdr#);
9680 chk->sentcxx . . $ sctp_tmit_chunk#sent. = SCTP_DATAGRAM_UNSENTcxx . . $ `usrsctplib/netinet/sctp_constants.h:353:9`!;
9681 chk->snd_countcxx . . $ sctp_tmit_chunk#snd_count. = 0;
9682 chk->asoccxx . . $ sctp_tmit_chunk#asoc. = &stcb->asoccxx . . $ sctp_tcb#asoc.;
9683 chk->datacxx . . $ sctp_tmit_chunk#data. = cookie_ack;
9684 if (chk->asoccxx . . $ sctp_tmit_chunk#asoc.->last_control_chunk_fromcxx . . $ sctp_association#last_control_chunk_from. != NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!) {
9685 chk->whoTocxx . . $ sctp_tmit_chunk#whoTo. = chk->asoccxx . . $ sctp_tmit_chunk#asoc.->last_control_chunk_fromcxx . . $ sctp_association#last_control_chunk_from.;
9686 atomic_add_intcxx . . $ `usrsctplib/user_atomic.h:94:9`!(&chk->whoTo->ref_count, 1);
9687 } else {
9688 chk->whoTocxx . . $ sctp_tmit_chunk#whoTo. = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!;
9689 }
9690 hdr = mtodcxx . . $ `usrsctplib/user_mbuf.h:96:9`!(cookie_ack, struct sctp_chunkhdr *);
9691 hdr->chunk_typecxx . . $ sctp_chunkhdr#chunk_type. = SCTP_COOKIE_ACKcxx . . $ `usrsctplib/netinet/sctp.h:460:9`!;
9692 hdr->chunk_flagscxx . . $ sctp_chunkhdr#chunk_flags. = 0;
9693 hdr->chunk_lengthcxx . . $ sctp_chunkhdr#chunk_length. = htonscxx . . $ htons(a18c05e4017afb3d).(chk->send_sizecxx . . $ sctp_tmit_chunk#send_size.);
9694 SCTP_BUF_LENcxx . . $ `usrsctplib/netinet/sctp_os_userspace.h:790:9`!(cookie_ack) = chk->send_sizecxx . . $ sctp_tmit_chunk#send_size.;
9695 TAILQ_INSERT_TAILcxx . . $ `<external>/2546723208511035544/queue.h:402:9`!(&chk->asoc->control_send_queue, chk, sctp_next);
9696 chk->asoccxx . . $ sctp_tmit_chunk#asoc.->ctrl_queue_cntcxx . . $ sctp_association#ctrl_queue_cnt.++;
9697 return;
9698 }
9699
9700 void
9701 sctp_send_shutdown_ackcxx . . $ sctp_send_shutdown_ack(2ed2c3ddd2bbab6a).(struct sctp_tcbcxx . . $ sctp_tcb# *stcb, struct sctp_netscxx . . $ sctp_nets# *net)
9702 {
9703 /* formulate and queue a SHUTDOWN-ACK back to the sender */
9704 struct mbufcxx . . $ mbuf# *m_shutdown_ack;
9705 struct sctp_shutdown_ack_chunkcxx . . $ sctp_shutdown_ack_chunk# *ack_cp;
9706 struct sctp_tmit_chunkcxx . . $ sctp_tmit_chunk# *chk;
9707
9708 m_shutdown_ack = sctp_get_mbuf_for_msgcxx . . $ sctp_get_mbuf_for_msg(c7c30fc329598377).(sizeof(struct sctp_shutdown_ack_chunkcxx . . $ sctp_shutdown_ack_chunk#), 0, M_NOWAITcxx . . $ `usrsctplib/user_malloc.h:60:9`!, 1, MT_HEADERcxx . . $ `usrsctplib/user_mbuf.h:290:9`!);
9709 if (m_shutdown_ack == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!) {
9710 /* no mbuf's */
9711 return;
9712 }
9713 SCTP_BUF_RESV_UFcxx . . $ `usrsctplib/netinet/sctp_os_userspace.h:793:9`!(m_shutdown_ack, SCTP_MIN_OVERHEADcxx . . $ `usrsctplib/netinet/sctp_header.h:561:9`!);
9714 sctp_alloc_a_chunkcxx . . $ `usrsctplib/netinet/sctp_var.h:170:9`!(stcb, chk);
9715 if (chk == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!) {
9716 /* no memory */
9717 sctp_m_freemcxx . . $ `usrsctplib/netinet/sctputil.h:57:9`!(m_shutdown_ack);
9718 return;
9719 }
9720 chk->copy_by_refcxx . . $ sctp_tmit_chunk#copy_by_ref. = 0;
9721 chk->reccxx . . $ sctp_tmit_chunk#rec..chunk_idcxx . . $ sctp_tmit_chunk#$anonymous_type_3#chunk_id..idcxx . . $ chk_id#id. = SCTP_SHUTDOWN_ACKcxx . . $ `usrsctplib/netinet/sctp.h:457:9`!;
9722 chk->reccxx . . $ sctp_tmit_chunk#rec..chunk_idcxx . . $ sctp_tmit_chunk#$anonymous_type_3#chunk_id..can_take_datacxx . . $ chk_id#can_take_data. = 1;
9723 chk->flagscxx . . $ sctp_tmit_chunk#flags. = 0;
9724 chk->send_sizecxx . . $ sctp_tmit_chunk#send_size. = sizeof(struct sctp_chunkhdrcxx . . $ sctp_chunkhdr#);
9725 chk->sentcxx . . $ sctp_tmit_chunk#sent. = SCTP_DATAGRAM_UNSENTcxx . . $ `usrsctplib/netinet/sctp_constants.h:353:9`!;
9726 chk->snd_countcxx . . $ sctp_tmit_chunk#snd_count. = 0;
9727 chk->asoccxx . . $ sctp_tmit_chunk#asoc. = &stcb->asoccxx . . $ sctp_tcb#asoc.;
9728 chk->datacxx . . $ sctp_tmit_chunk#data. = m_shutdown_ack;
9729 chk->whoTocxx . . $ sctp_tmit_chunk#whoTo. = net;
9730 if (chk->whoTocxx . . $ sctp_tmit_chunk#whoTo.) {
9731 atomic_add_intcxx . . $ `usrsctplib/user_atomic.h:94:9`!(&chk->whoTo->ref_count, 1);
9732 }
9733 ack_cp = mtodcxx . . $ `usrsctplib/user_mbuf.h:96:9`!(m_shutdown_ack, struct sctp_shutdown_ack_chunk *);
9734 ack_cp->chcxx . . $ sctp_shutdown_ack_chunk#ch..chunk_typecxx . . $ sctp_chunkhdr#chunk_type. = SCTP_SHUTDOWN_ACKcxx . . $ `usrsctplib/netinet/sctp.h:457:9`!;
9735 ack_cp->chcxx . . $ sctp_shutdown_ack_chunk#ch..chunk_flagscxx . . $ sctp_chunkhdr#chunk_flags. = 0;
9736 ack_cp->chcxx . . $ sctp_shutdown_ack_chunk#ch..chunk_lengthcxx . . $ sctp_chunkhdr#chunk_length. = htonscxx . . $ htons(a18c05e4017afb3d).(chk->send_sizecxx . . $ sctp_tmit_chunk#send_size.);
9737 SCTP_BUF_LENcxx . . $ `usrsctplib/netinet/sctp_os_userspace.h:790:9`!(m_shutdown_ack) = chk->send_sizecxx . . $ sctp_tmit_chunk#send_size.;
9738 TAILQ_INSERT_TAILcxx . . $ `<external>/2546723208511035544/queue.h:402:9`!(&chk->asoc->control_send_queue, chk, sctp_next);
9739 chk->asoccxx . . $ sctp_tmit_chunk#asoc.->ctrl_queue_cntcxx . . $ sctp_association#ctrl_queue_cnt.++;
9740 return;
9741 }
9742
9743 void
9744 sctp_send_shutdowncxx . . $ sctp_send_shutdown(2ed2c3ddd2bbab6a).(struct sctp_tcbcxx . . $ sctp_tcb# *stcb, struct sctp_netscxx . . $ sctp_nets# *net)
9745 {
9746 /* formulate and queue a SHUTDOWN to the sender */
9747 struct mbufcxx . . $ mbuf# *m_shutdown;
9748 struct sctp_shutdown_chunkcxx . . $ sctp_shutdown_chunk# *shutdown_cp;
9749 struct sctp_tmit_chunkcxx . . $ sctp_tmit_chunk# *chk;
9750
9751 TAILQ_FOREACHcxx . . $ `<external>/2546723208511035544/queue.h:435:9`!(chk, &stcb->asoc.control_send_queue, sctp_next) {
9752 if (chk->reccxx . . $ sctp_tmit_chunk#rec..chunk_idcxx . . $ sctp_tmit_chunk#$anonymous_type_3#chunk_id..idcxx . . $ chk_id#id. == SCTP_SHUTDOWNcxx . . $ `usrsctplib/netinet/sctp.h:456:9`!) {
9753 /* We already have a SHUTDOWN queued. Reuse it. */
9754 if (chk->whoTocxx . . $ sctp_tmit_chunk#whoTo.) {
9755 sctp_free_remote_addrcxx . . $ `usrsctplib/netinet/sctp_var.h:229:9`!(chk->whoTo);
9756 chk->whoTocxx . . $ sctp_tmit_chunk#whoTo. = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!;
9757 }
9758 break;
9759 }
9760 }
9761 if (chk == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!) {
9762 m_shutdown = sctp_get_mbuf_for_msgcxx . . $ sctp_get_mbuf_for_msg(c7c30fc329598377).(sizeof(struct sctp_shutdown_chunkcxx . . $ sctp_shutdown_chunk#), 0, M_NOWAITcxx . . $ `usrsctplib/user_malloc.h:60:9`!, 1, MT_HEADERcxx . . $ `usrsctplib/user_mbuf.h:290:9`!);
9763 if (m_shutdown == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!) {
9764 /* no mbuf's */
9765 return;
9766 }
9767 SCTP_BUF_RESV_UFcxx . . $ `usrsctplib/netinet/sctp_os_userspace.h:793:9`!(m_shutdown, SCTP_MIN_OVERHEADcxx . . $ `usrsctplib/netinet/sctp_header.h:561:9`!);
9768 sctp_alloc_a_chunkcxx . . $ `usrsctplib/netinet/sctp_var.h:170:9`!(stcb, chk);
9769 if (chk == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!) {
9770 /* no memory */
9771 sctp_m_freemcxx . . $ `usrsctplib/netinet/sctputil.h:57:9`!(m_shutdown);
9772 return;
9773 }
9774 chk->copy_by_refcxx . . $ sctp_tmit_chunk#copy_by_ref. = 0;
9775 chk->reccxx . . $ sctp_tmit_chunk#rec..chunk_idcxx . . $ sctp_tmit_chunk#$anonymous_type_3#chunk_id..idcxx . . $ chk_id#id. = SCTP_SHUTDOWNcxx . . $ `usrsctplib/netinet/sctp.h:456:9`!;
9776 chk->reccxx . . $ sctp_tmit_chunk#rec..chunk_idcxx . . $ sctp_tmit_chunk#$anonymous_type_3#chunk_id..can_take_datacxx . . $ chk_id#can_take_data. = 1;
9777 chk->flagscxx . . $ sctp_tmit_chunk#flags. = 0;
9778 chk->send_sizecxx . . $ sctp_tmit_chunk#send_size. = sizeof(struct sctp_shutdown_chunkcxx . . $ sctp_shutdown_chunk#);
9779 chk->sentcxx . . $ sctp_tmit_chunk#sent. = SCTP_DATAGRAM_UNSENTcxx . . $ `usrsctplib/netinet/sctp_constants.h:353:9`!;
9780 chk->snd_countcxx . . $ sctp_tmit_chunk#snd_count. = 0;
9781 chk->asoccxx . . $ sctp_tmit_chunk#asoc. = &stcb->asoccxx . . $ sctp_tcb#asoc.;
9782 chk->datacxx . . $ sctp_tmit_chunk#data. = m_shutdown;
9783 chk->whoTocxx . . $ sctp_tmit_chunk#whoTo. = net;
9784 if (chk->whoTocxx . . $ sctp_tmit_chunk#whoTo.) {
9785 atomic_add_intcxx . . $ `usrsctplib/user_atomic.h:94:9`!(&chk->whoTo->ref_count, 1);
9786 }
9787 shutdown_cp = mtodcxx . . $ `usrsctplib/user_mbuf.h:96:9`!(m_shutdown, struct sctp_shutdown_chunk *);
9788 shutdown_cp->chcxx . . $ sctp_shutdown_chunk#ch..chunk_typecxx . . $ sctp_chunkhdr#chunk_type. = SCTP_SHUTDOWNcxx . . $ `usrsctplib/netinet/sctp.h:456:9`!;
9789 shutdown_cp->chcxx . . $ sctp_shutdown_chunk#ch..chunk_flagscxx . . $ sctp_chunkhdr#chunk_flags. = 0;
9790 shutdown_cp->chcxx . . $ sctp_shutdown_chunk#ch..chunk_lengthcxx . . $ sctp_chunkhdr#chunk_length. = htonscxx . . $ htons(a18c05e4017afb3d).(chk->send_sizecxx . . $ sctp_tmit_chunk#send_size.);
9791 shutdown_cp->cumulative_tsn_ackcxx . . $ sctp_shutdown_chunk#cumulative_tsn_ack. = htonlcxx . . $ htonl(2141b656ce2cc063).(stcb->asoccxx . . $ sctp_tcb#asoc..cumulative_tsncxx . . $ sctp_association#cumulative_tsn.);
9792 SCTP_BUF_LENcxx . . $ `usrsctplib/netinet/sctp_os_userspace.h:790:9`!(m_shutdown) = chk->send_sizecxx . . $ sctp_tmit_chunk#send_size.;
9793 TAILQ_INSERT_TAILcxx . . $ `<external>/2546723208511035544/queue.h:402:9`!(&chk->asoc->control_send_queue, chk, sctp_next);
9794 chk->asoccxx . . $ sctp_tmit_chunk#asoc.->ctrl_queue_cntcxx . . $ sctp_association#ctrl_queue_cnt.++;
9795 } else {
9796 TAILQ_REMOVEcxx . . $ `<external>/2546723208511035544/queue.h:426:9`!(&stcb->asoc.control_send_queue, chk, sctp_next);
9797 chk->whoTocxx . . $ sctp_tmit_chunk#whoTo. = net;
9798 if (chk->whoTocxx . . $ sctp_tmit_chunk#whoTo.) {
9799 atomic_add_intcxx . . $ `usrsctplib/user_atomic.h:94:9`!(&chk->whoTo->ref_count, 1);
9800 }
9801 shutdown_cp = mtodcxx . . $ `usrsctplib/user_mbuf.h:96:9`!(chk->data, struct sctp_shutdown_chunk *);
9802 shutdown_cp->cumulative_tsn_ackcxx . . $ sctp_shutdown_chunk#cumulative_tsn_ack. = htonlcxx . . $ htonl(2141b656ce2cc063).(stcb->asoccxx . . $ sctp_tcb#asoc..cumulative_tsncxx . . $ sctp_association#cumulative_tsn.);
9803 TAILQ_INSERT_TAILcxx . . $ `<external>/2546723208511035544/queue.h:402:9`!(&stcb->asoc.control_send_queue, chk, sctp_next);
9804 }
9805 return;
9806 }
9807
9808 void
9809 sctp_send_asconfcxx . . $ sctp_send_asconf(406952e61e1e418d).(struct sctp_tcbcxx . . $ sctp_tcb# *stcb, struct sctp_netscxx . . $ sctp_nets# *net, int addr_locked)
9810 {
9811 /*
9812 * formulate and queue an ASCONF to the peer.
9813 * ASCONF parameters should be queued on the assoc queue.
9814 */
9815 struct sctp_tmit_chunkcxx . . $ sctp_tmit_chunk# *chk;
9816 struct mbufcxx . . $ mbuf# *m_asconf;
9817 int len;
9818
9819 SCTP_TCB_LOCK_ASSERTcxx . . $ `usrsctplib/netinet/sctp_process_lock.h:478:9`!(stcb);
9820
9821 if ((!TAILQ_EMPTYcxx . . $ `<external>/2546723208511035544/queue.h:457:9`!(&stcb->asoc.asconf_send_queue)) &&
9822 (!sctp_is_feature_oncxx . . $ `usrsctplib/netinet/sctp_var.h:53:9`!(stcb->sctp_ep, SCTP_PCB_FLAGS_MULTIPLE_ASCONFScxx . . $ `usrsctplib/netinet/sctp.h:586:9`!))) {
9823 /* can't send a new one if there is one in flight already */
9824 return;
9825 }
9826
9827 /* compose an ASCONF chunk, maximum length is PMTU */
9828 m_asconf = sctp_compose_asconfcxx . . $ sctp_compose_asconf(1b2def24e117f323).(stcb, &len, addr_locked);
9829 if (m_asconf == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!) {
9830 return;
9831 }
9832
9833 sctp_alloc_a_chunkcxx . . $ `usrsctplib/netinet/sctp_var.h:170:9`!(stcb, chk);
9834 if (chk == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!) {
9835 /* no memory */
9836 sctp_m_freemcxx . . $ `usrsctplib/netinet/sctputil.h:57:9`!(m_asconf);
9837 return;
9838 }
9839
9840 chk->copy_by_refcxx . . $ sctp_tmit_chunk#copy_by_ref. = 0;
9841 chk->reccxx . . $ sctp_tmit_chunk#rec..chunk_idcxx . . $ sctp_tmit_chunk#$anonymous_type_3#chunk_id..idcxx . . $ chk_id#id. = SCTP_ASCONFcxx . . $ `usrsctplib/netinet/sctp.h:484:9`!;
9842 chk->reccxx . . $ sctp_tmit_chunk#rec..chunk_idcxx . . $ sctp_tmit_chunk#$anonymous_type_3#chunk_id..can_take_datacxx . . $ chk_id#can_take_data. = 0;
9843 chk->flagscxx . . $ sctp_tmit_chunk#flags. = CHUNK_FLAGS_FRAGMENT_OKcxx . . $ `usrsctplib/netinet/sctp_structs.h:466:9`!;
9844 chk->datacxx . . $ sctp_tmit_chunk#data. = m_asconf;
9845 chk->send_sizecxx . . $ sctp_tmit_chunk#send_size. = len;
9846 chk->sentcxx . . $ sctp_tmit_chunk#sent. = SCTP_DATAGRAM_UNSENTcxx . . $ `usrsctplib/netinet/sctp_constants.h:353:9`!;
9847 chk->snd_countcxx . . $ sctp_tmit_chunk#snd_count. = 0;
9848 chk->asoccxx . . $ sctp_tmit_chunk#asoc. = &stcb->asoccxx . . $ sctp_tcb#asoc.;
9849 chk->whoTocxx . . $ sctp_tmit_chunk#whoTo. = net;
9850 if (chk->whoTocxx . . $ sctp_tmit_chunk#whoTo.) {
9851 atomic_add_intcxx . . $ `usrsctplib/user_atomic.h:94:9`!(&chk->whoTo->ref_count, 1);
9852 }
9853 TAILQ_INSERT_TAILcxx . . $ `<external>/2546723208511035544/queue.h:402:9`!(&chk->asoc->asconf_send_queue, chk, sctp_next);
9854 chk->asoccxx . . $ sctp_tmit_chunk#asoc.->ctrl_queue_cntcxx . . $ sctp_association#ctrl_queue_cnt.++;
9855 return;
9856 }
9857
9858 void
9859 sctp_send_asconf_ackcxx . . $ sctp_send_asconf_ack(5e56bbb8005ef9b0).(struct sctp_tcbcxx . . $ sctp_tcb# *stcb)
9860 {
9861 /*
9862 * formulate and queue a asconf-ack back to sender.
9863 * the asconf-ack must be stored in the tcb.
9864 */
9865 struct sctp_tmit_chunkcxx . . $ sctp_tmit_chunk# *chk;
9866 struct sctp_asconf_ackcxx . . $ sctp_asconf_ack# *ack, *latest_ack;
9867 struct mbufcxx . . $ mbuf# *m_ack;
9868 struct sctp_netscxx . . $ sctp_nets# *net = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!;
9869
9870 SCTP_TCB_LOCK_ASSERTcxx . . $ `usrsctplib/netinet/sctp_process_lock.h:478:9`!(stcb);
9871 /* Get the latest ASCONF-ACK */
9872 latest_ack = TAILQ_LASTcxx . . $ `<external>/2546723208511035544/queue.h:461:9`!(&stcb->asoc.asconf_ack_sent, sctp_asconf_ackhead);
9873 if (latest_ack == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!) {
9874 return;
9875 }
9876 if (latest_ack->last_sent_tocxx . . $ sctp_asconf_ack#last_sent_to. != NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`! &&
9877 latest_ack->last_sent_tocxx . . $ sctp_asconf_ack#last_sent_to. == stcb->asoccxx . . $ sctp_tcb#asoc..last_control_chunk_fromcxx . . $ sctp_association#last_control_chunk_from.) {
9878 /* we're doing a retransmission */
9879 net = sctp_find_alternate_netcxx . . $ sctp_find_alternate_net(654363bae23dcddb).(stcb, stcb->asoccxx . . $ sctp_tcb#asoc..last_control_chunk_fromcxx . . $ sctp_association#last_control_chunk_from., 0);
9880 if (net == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!) {
9881 /* no alternate */
9882 if (stcb->asoccxx . . $ sctp_tcb#asoc..last_control_chunk_fromcxx . . $ sctp_association#last_control_chunk_from. == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!) {
9883 if (stcb->asoccxx . . $ sctp_tcb#asoc..alternatecxx . . $ sctp_association#alternate.) {
9884 net = stcb->asoccxx . . $ sctp_tcb#asoc..alternatecxx . . $ sctp_association#alternate.;
9885 } else {
9886 net = stcb->asoccxx . . $ sctp_tcb#asoc..primary_destinationcxx . . $ sctp_association#primary_destination.;
9887 }
9888 } else {
9889 net = stcb->asoccxx . . $ sctp_tcb#asoc..last_control_chunk_fromcxx . . $ sctp_association#last_control_chunk_from.;
9890 }
9891 }
9892 } else {
9893 /* normal case */
9894 if (stcb->asoccxx . . $ sctp_tcb#asoc..last_control_chunk_fromcxx . . $ sctp_association#last_control_chunk_from. == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!) {
9895 if (stcb->asoccxx . . $ sctp_tcb#asoc..alternatecxx . . $ sctp_association#alternate.) {
9896 net = stcb->asoccxx . . $ sctp_tcb#asoc..alternatecxx . . $ sctp_association#alternate.;
9897 } else {
9898 net = stcb->asoccxx . . $ sctp_tcb#asoc..primary_destinationcxx . . $ sctp_association#primary_destination.;
9899 }
9900 } else {
9901 net = stcb->asoccxx . . $ sctp_tcb#asoc..last_control_chunk_fromcxx . . $ sctp_association#last_control_chunk_from.;
9902 }
9903 }
9904 latest_ack->last_sent_tocxx . . $ sctp_asconf_ack#last_sent_to. = net;
9905
9906 TAILQ_FOREACHcxx . . $ `<external>/2546723208511035544/queue.h:435:9`!(ack, &stcb->asoc.asconf_ack_sent, next) {
9907 if (ack->datacxx . . $ sctp_asconf_ack#data. == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!) {
9908 continue;
9909 }
9910
9911 /* copy the asconf_ack */
9912 m_ack = SCTP_M_COPYMcxx . . $ `usrsctplib/netinet/sctp_os_userspace.h:759:9`!(ack->datacxx . . $ sctp_asconf_ack#data., 0, M_COPYALLcxx . . $ `usrsctplib/user_mbuf.h:75:9`!, M_NOWAITcxx . . $ `usrsctplib/user_malloc.h:60:9`!);
9913 if (m_ack == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!) {
9914 /* couldn't copy it */
9915 return;
9916 }
9917 #ifdef SCTP_MBUF_LOGGING
9918 if (SCTP_BASE_SYSCTL(sctp_logging_level) & SCTP_MBUF_LOGGING_ENABLE) {
9919 sctp_log_mbc(m_ack, SCTP_MBUF_ICOPY);
9920 }
9921 #endif
9922
9923 sctp_alloc_a_chunkcxx . . $ `usrsctplib/netinet/sctp_var.h:170:9`!(stcb, chk);
9924 if (chk == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!) {
9925 /* no memory */
9926 if (m_ack)
9927 sctp_m_freemcxx . . $ `usrsctplib/netinet/sctputil.h:57:9`!(m_ack);
9928 return;
9929 }
9930 chk->copy_by_refcxx . . $ sctp_tmit_chunk#copy_by_ref. = 0;
9931 chk->reccxx . . $ sctp_tmit_chunk#rec..chunk_idcxx . . $ sctp_tmit_chunk#$anonymous_type_3#chunk_id..idcxx . . $ chk_id#id. = SCTP_ASCONF_ACKcxx . . $ `usrsctplib/netinet/sctp.h:472:9`!;
9932 chk->reccxx . . $ sctp_tmit_chunk#rec..chunk_idcxx . . $ sctp_tmit_chunk#$anonymous_type_3#chunk_id..can_take_datacxx . . $ chk_id#can_take_data. = 1;
9933 chk->flagscxx . . $ sctp_tmit_chunk#flags. = CHUNK_FLAGS_FRAGMENT_OKcxx . . $ `usrsctplib/netinet/sctp_structs.h:466:9`!;
9934 chk->whoTocxx . . $ sctp_tmit_chunk#whoTo. = net;
9935 if (chk->whoTocxx . . $ sctp_tmit_chunk#whoTo.) {
9936 atomic_add_intcxx . . $ `usrsctplib/user_atomic.h:94:9`!(&chk->whoTo->ref_count, 1);
9937 }
9938 chk->datacxx . . $ sctp_tmit_chunk#data. = m_ack;
9939 chk->send_sizecxx . . $ sctp_tmit_chunk#send_size. = ack->lencxx . . $ sctp_asconf_ack#len.;
9940 chk->sentcxx . . $ sctp_tmit_chunk#sent. = SCTP_DATAGRAM_UNSENTcxx . . $ `usrsctplib/netinet/sctp_constants.h:353:9`!;
9941 chk->snd_countcxx . . $ sctp_tmit_chunk#snd_count. = 0;
9942 chk->asoccxx . . $ sctp_tmit_chunk#asoc. = &stcb->asoccxx . . $ sctp_tcb#asoc.;
9943
9944 TAILQ_INSERT_TAILcxx . . $ `<external>/2546723208511035544/queue.h:402:9`!(&chk->asoc->control_send_queue, chk, sctp_next);
9945 chk->asoccxx . . $ sctp_tmit_chunk#asoc.->ctrl_queue_cntcxx . . $ sctp_association#ctrl_queue_cnt.++;
9946 }
9947 return;
9948 }
9949
9950 static int
9951 sctp_chunk_retransmissioncxx . . $ sctp_chunk_retransmission(53b6ddff50b5901d).(struct sctp_inpcbcxx . . $ sctp_inpcb# *inp,
9952 struct sctp_tcbcxx . . $ sctp_tcb# *stcb,
9953 struct sctp_associationcxx . . $ sctp_association# *asoc,
9954 int *cnt_out, struct timevalcxx . . $ timeval# *now, int *now_filled, int *fr_done, int so_locked)
9955 {
9956 /*-
9957 * send out one MTU of retransmission. If fast_retransmit is
9958 * happening we ignore the cwnd. Otherwise we obey the cwnd and
9959 * rwnd. For a Cookie or Asconf in the control chunk queue we
9960 * retransmit them by themselves.
9961 *
9962 * For data chunks we will pick out the lowest TSN's in the sent_queue
9963 * marked for resend and bundle them all together (up to a MTU of
9964 * destination). The address to send to should have been
9965 * selected/changed where the retransmission was marked (i.e. in FR
9966 * or t3-timeout routines).
9967 */
9968 struct sctp_tmit_chunkcxx . . $ sctp_tmit_chunk# *data_list[SCTP_MAX_DATA_BUNDLINGcxx . . $ `usrsctplib/netinet/sctp_constants.h:880:9`!];
9969 struct sctp_tmit_chunkcxx . . $ sctp_tmit_chunk# *chk, *fwd;
9970 struct mbufcxx . . $ mbuf# *m, *endofchain;
9971 struct sctp_netscxx . . $ sctp_nets# *net = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!;
9972 uint32_tcxx . . $ uint32_t# tsns_sent = 0;
•9973 int no_fragmentflg, bundle_at;
9974 unsigned int mtu;
9975 int error, i, one_chunk, fwd_tsn, ctl_cnt, tmr_started;
9976 struct sctp_auth_chunkcxx . . $ sctp_auth_chunk# *auth = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!;
9977 uint32_tcxx . . $ uint32_t# auth_offset = 0;
9978 uint16_tcxx . . $ uint16_t# auth_keyid;
9979 int override_ok = 1;
9980 int data_auth_reqd = 0;
9981 uint32_tcxx . . $ uint32_t# dmtu = 0;
9982
9983 #if defined(__APPLE__) && !defined(__Userspace__cxx . . $ `<built-in>:442:9`!)
9984 if (so_locked) {
9985 sctp_lock_assert(SCTP_INP_SO(inp));
9986 } else {
9987 sctp_unlock_assert(SCTP_INP_SO(inp));
9988 }
9989 #endif
9990 SCTP_TCB_LOCK_ASSERTcxx . . $ `usrsctplib/netinet/sctp_process_lock.h:478:9`!(stcb);
9991 tmr_started = ctl_cnt = 0;
9992 no_fragmentflg = 1;
9993 fwd_tsn = 0;
9994 *cnt_out = 0;
9995 fwd = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!;
9996 endofchain = m = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!;
9997 auth_keyid = stcb->asoccxx . . $ sctp_tcb#asoc..authinfocxx . . $ sctp_association#authinfo..active_keyidcxx . . $ sctp_authinformation#active_keyid.;
9998 #ifdef SCTP_AUDITING_ENABLED
9999 sctp_audit_log(0xC3, 1);
10000 #endif
10001 if ((TAILQ_EMPTYcxx . . $ `<external>/2546723208511035544/queue.h:457:9`!(&asoc->sent_queue)) &&
10002 (TAILQ_EMPTYcxx . . $ `<external>/2546723208511035544/queue.h:457:9`!(&asoc->control_send_queue))) {
10003 SCTPDBGcxx . . $ `usrsctplib/netinet/sctp_os_userspace.h:591:9`!(SCTP_DEBUG_OUTPUT1cxx . . $ `usrsctplib/netinet/sctp_constants.h:643:9`!,"SCTP hits empty queue with cnt set to %d?\n",
10004 asoc->sent_queue_retran_cnt);
10005 asoc->sent_queue_cntcxx . . $ sctp_association#sent_queue_cnt. = 0;
10006 asoc->sent_queue_cnt_removeablecxx . . $ sctp_association#sent_queue_cnt_removeable. = 0;
10007 /* send back 0/0 so we enter normal transmission */
10008 *cnt_out = 0;
10009 return (0);
10010 }
10011 TAILQ_FOREACHcxx . . $ `<external>/2546723208511035544/queue.h:435:9`!(chk, &asoc->control_send_queue, sctp_next) {
10012 if ((chk->reccxx . . $ sctp_tmit_chunk#rec..chunk_idcxx . . $ sctp_tmit_chunk#$anonymous_type_3#chunk_id..idcxx . . $ chk_id#id. == SCTP_COOKIE_ECHOcxx . . $ `usrsctplib/netinet/sctp.h:459:9`!) ||
10013 (chk->reccxx . . $ sctp_tmit_chunk#rec..chunk_idcxx . . $ sctp_tmit_chunk#$anonymous_type_3#chunk_id..idcxx . . $ chk_id#id. == SCTP_STREAM_RESETcxx . . $ `usrsctplib/netinet/sctp.h:476:9`!) ||
10014 (chk->reccxx . . $ sctp_tmit_chunk#rec..chunk_idcxx . . $ sctp_tmit_chunk#$anonymous_type_3#chunk_id..idcxx . . $ chk_id#id. == SCTP_FORWARD_CUM_TSNcxx . . $ `usrsctplib/netinet/sctp.h:482:9`!)) {
10015 if (chk->sentcxx . . $ sctp_tmit_chunk#sent. != SCTP_DATAGRAM_RESENDcxx . . $ `usrsctplib/netinet/sctp_constants.h:359:9`!) {
10016 continue;
10017 }
10018 if (chk->reccxx . . $ sctp_tmit_chunk#rec..chunk_idcxx . . $ sctp_tmit_chunk#$anonymous_type_3#chunk_id..idcxx . . $ chk_id#id. == SCTP_STREAM_RESETcxx . . $ `usrsctplib/netinet/sctp.h:476:9`!) {
10019 if (chk != asoc->str_resetcxx . . $ sctp_association#str_reset.) {
10020 /*
10021 * not eligible for retran if its
10022 * not ours
10023 */
10024 continue;
10025 }
10026 }
10027 ctl_cnt++;
10028 if (chk->reccxx . . $ sctp_tmit_chunk#rec..chunk_idcxx . . $ sctp_tmit_chunk#$anonymous_type_3#chunk_id..idcxx . . $ chk_id#id. == SCTP_FORWARD_CUM_TSNcxx . . $ `usrsctplib/netinet/sctp.h:482:9`!) {
10029 fwd_tsn = 1;
10030 }
10031 /*
10032 * Add an AUTH chunk, if chunk requires it save the
10033 * offset into the chain for AUTH
10034 */
10035 if ((auth == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!) &&
10036 (sctp_auth_is_required_chunkcxx . . $ `usrsctplib/netinet/sctp_auth.h:105:9`!(chk->rec.chunk_id.id,
10037 stcb->asoc.peer_auth_chunks))) {
10038 m = sctp_add_auth_chunkcxx . . $ sctp_add_auth_chunk(c0b2bf5d35b7e5c6).(m, &endofchain,
10039 &auth, &auth_offset,
10040 stcb,
10041 chk->reccxx . . $ sctp_tmit_chunk#rec..chunk_idcxx . . $ sctp_tmit_chunk#$anonymous_type_3#chunk_id..idcxx . . $ chk_id#id.);
10042 SCTP_STAT_INCR_COUNTER64cxx . . $ `./netinet/sctp_uio.h:1127:9`!(sctps_outcontrolchunks);
10043 }
10044 m = sctp_copy_mbufchaincxx . . $ sctp_copy_mbufchain(161b07f3a70427c7).(chk->datacxx . . $ sctp_tmit_chunk#data., m, &endofchain, 0, chk->send_sizecxx . . $ sctp_tmit_chunk#send_size., chk->copy_by_refcxx . . $ sctp_tmit_chunk#copy_by_ref.);
10045 break;
10046 }
10047 }
10048 one_chunk = 0;
10049 /* do we have control chunks to retransmit? */
10050 if (m != NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!) {
10051 /* Start a timer no matter if we succeed or fail */
10052 if (chk->reccxx . . $ sctp_tmit_chunk#rec..chunk_idcxx . . $ sctp_tmit_chunk#$anonymous_type_3#chunk_id..idcxx . . $ chk_id#id. == SCTP_COOKIE_ECHOcxx . . $ `usrsctplib/netinet/sctp.h:459:9`!) {
10053 sctp_timer_startcxx . . $ sctp_timer_start(73c9263bfa4b937d).(SCTP_TIMER_TYPE_COOKIEcxx . . $ `usrsctplib/netinet/sctp_constants.h:542:9`!, inp, stcb, chk->whoTocxx . . $ sctp_tmit_chunk#whoTo.);
10054 } else if (chk->reccxx . . $ sctp_tmit_chunk#rec..chunk_idcxx . . $ sctp_tmit_chunk#$anonymous_type_3#chunk_id..idcxx . . $ chk_id#id. == SCTP_ASCONFcxx . . $ `usrsctplib/netinet/sctp.h:484:9`!)
10055 sctp_timer_startcxx . . $ sctp_timer_start(73c9263bfa4b937d).(SCTP_TIMER_TYPE_ASCONFcxx . . $ `usrsctplib/netinet/sctp_constants.h:546:9`!, inp, stcb, chk->whoTocxx . . $ sctp_tmit_chunk#whoTo.);
10056 chk->snd_countcxx . . $ sctp_tmit_chunk#snd_count.++; /* update our count */
10057 if ((error = sctp_lowlevel_chunk_outputcxx . . $ sctp_lowlevel_chunk_output(4859f95fdecd7401).(inp, stcb, chk->whoTocxx . . $ sctp_tmit_chunk#whoTo.,
10058 (struct sockaddrcxx . . $ sockaddr# *)&chk->whoTocxx . . $ sctp_tmit_chunk#whoTo.->rocxx . . $ sctp_nets#ro.._l_addrcxx . . $ sctp_net_route#_l_addr., m,
10059 auth_offset, auth, stcb->asoccxx . . $ sctp_tcb#asoc..authinfocxx . . $ sctp_association#authinfo..active_keyidcxx . . $ sctp_authinformation#active_keyid.,
10060 no_fragmentflg, 0, 0,
10061 inp->sctp_lportcxx . . $ `usrsctplib/netinet/sctp_pcb.h:430:9`!, stcb->rportcxx . . $ sctp_tcb#rport., htonlcxx . . $ htonl(2141b656ce2cc063).(stcb->asoccxx . . $ sctp_tcb#asoc..peer_vtagcxx . . $ sctp_association#peer_vtag.),
10062 chk->whoTocxx . . $ sctp_tmit_chunk#whoTo.->portcxx . . $ sctp_nets#port., NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!,
10063 #if defined(__FreeBSD__) && !defined(__Userspace__cxx . . $ `<built-in>:442:9`!)
10064 0, 0,
10065 #endif
10066 so_locked))) {
10067 SCTPDBGcxx . . $ `usrsctplib/netinet/sctp_os_userspace.h:591:9`!(SCTP_DEBUG_OUTPUT3cxx . . $ `usrsctplib/netinet/sctp_constants.h:645:9`!, "Gak send error %d\n", error);
10068 if (error == ENOBUFScxx . . $ `<external>/17922322188510340118/errno.h:89:9`!) {
10069 asoc->ifp_had_enobufcxx . . $ sctp_association#ifp_had_enobuf. = 1;
10070 SCTP_STAT_INCRcxx . . $ `./netinet/sctp_uio.h:1111:9`!(sctps_lowlevelerr);
10071 }
10072 return (error);
10073 } else {
10074 asoc->ifp_had_enobufcxx . . $ sctp_association#ifp_had_enobuf. = 0;
10075 }
10076 endofchain = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!;
10077 auth = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!;
10078 auth_offset = 0;
10079 /*
10080 * We don't want to mark the net->sent time here since this
10081 * we use this for HB and retrans cannot measure RTT
10082 */
10083 /* (void)SCTP_GETTIME_TIMEVAL(&chk->whoTo->last_sent_time); */
10084 *cnt_out += 1;
10085 chk->sentcxx . . $ sctp_tmit_chunk#sent. = SCTP_DATAGRAM_SENTcxx . . $ `usrsctplib/netinet/sctp_constants.h:354:9`!;
10086 sctp_ucount_decrcxx . . $ `usrsctplib/netinet/sctp_var.h:271:9`!(stcb->asoc.sent_queue_retran_cnt);
10087 if (fwd_tsn == 0) {
10088 return (0);
10089 } else {
10090 /* Clean up the fwd-tsn list */
10091 sctp_clean_up_ctlcxx . . $ sctp_clean_up_ctl(1b508a31e65fdabe).(stcb, asoc, so_locked);
10092 return (0);
10093 }
10094 }
10095 /*
10096 * Ok, it is just data retransmission we need to do or that and a
10097 * fwd-tsn with it all.
10098 */
10099 if (TAILQ_EMPTYcxx . . $ `<external>/2546723208511035544/queue.h:457:9`!(&asoc->sent_queue)) {
10100 return (SCTP_RETRAN_DONEcxx . . $ `usrsctplib/netinet/sctp_constants.h:911:9`!);
10101 }
10102 if ((SCTP_GET_STATEcxx . . $ `usrsctplib/netinet/sctp_constants.h:476:9`!(stcb) == SCTP_STATE_COOKIE_ECHOEDcxx . . $ `usrsctplib/netinet/sctp_constants.h:463:9`!) ||
10103 (SCTP_GET_STATEcxx . . $ `usrsctplib/netinet/sctp_constants.h:476:9`!(stcb) == SCTP_STATE_COOKIE_WAITcxx . . $ `usrsctplib/netinet/sctp_constants.h:462:9`!)) {
10104 /* not yet open, resend the cookie and that is it */
10105 return (1);
10106 }
10107 #ifdef SCTP_AUDITING_ENABLED
10108 sctp_auditing(20, inp, stcb, NULL);
10109 #endif
10110 data_auth_reqd = sctp_auth_is_required_chunkcxx . . $ `usrsctplib/netinet/sctp_auth.h:105:9`!(SCTP_DATAcxx . . $ `usrsctplib/netinet/sctp.h:449:9`!, stcb->asoc.peer_auth_chunks);
10111 TAILQ_FOREACHcxx . . $ `<external>/2546723208511035544/queue.h:435:9`!(chk, &asoc->sent_queue, sctp_next) {
10112 if (chk->sentcxx . . $ sctp_tmit_chunk#sent. != SCTP_DATAGRAM_RESENDcxx . . $ `usrsctplib/netinet/sctp_constants.h:359:9`!) {
10113 /* No, not sent to this net or not ready for rtx */
10114 continue;
10115 }
10116 if (chk->datacxx . . $ sctp_tmit_chunk#data. == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!) {
10117 SCTP_PRINTFcxx . . $ `usrsctplib/netinet/sctp_os_userspace.h:536:9`!("TSN:%x chk->snd_count:%d chk->sent:%d can't retran - no data\n",
10118 chk->rec.data.tsn, chk->snd_count, chk->sent);
10119 continue;
10120 }
10121 if ((SCTP_BASE_SYSCTLcxx . . $ `usrsctplib/netinet/sctp_os_userspace.h:579:9`!(sctp_max_retran_chunk)) &&
10122 (chk->snd_countcxx . . $ sctp_tmit_chunk#snd_count. >= SCTP_BASE_SYSCTLcxx . . $ `usrsctplib/netinet/sctp_os_userspace.h:579:9`!(sctp_max_retran_chunk))) {
10123 struct mbufcxx . . $ mbuf# *op_err;
10124 char msg[SCTP_DIAG_INFO_LENcxx . . $ `usrsctplib/netinet/sctp_constants.h:748:9`!];
10125
10126 SCTP_SNPRINTFcxx . . $ `usrsctplib/netinet/sctp_os_userspace.h:808:9`!(msg, sizeof(msg), "TSN %8.8x retransmitted %d times, giving up",
10127 chk->rec.data.tsn, chk->snd_count);
10128 op_err = sctp_generate_causecxx . . $ sctp_generate_cause(b66a0ee9768f26bd).(SCTP_BASE_SYSCTLcxx . . $ `usrsctplib/netinet/sctp_os_userspace.h:579:9`!(sctp_diag_info_code),
10129 msg);
10130 atomic_add_intcxx . . $ `usrsctplib/user_atomic.h:94:9`!(&stcb->asoc.refcnt, 1);
10131 sctp_abort_an_associationcxx . . $ sctp_abort_an_association(2bef2660eefb26cd).(stcb->sctp_epcxx . . $ sctp_tcb#sctp_ep., stcb, op_err,
10132 so_locked);
10133 SCTP_TCB_LOCKcxx . . $ `usrsctplib/netinet/sctp_process_lock.h:473:9`!(stcb);
10134 atomic_subtract_intcxx . . $ `usrsctplib/user_atomic.h:97:9`!(&stcb->asoc.refcnt, 1);
10135 return (SCTP_RETRAN_EXITcxx . . $ `usrsctplib/netinet/sctp_constants.h:912:9`!);
10136 }
10137 /* pick up the net */
10138 net = chk->whoTocxx . . $ sctp_tmit_chunk#whoTo.;
10139 switch (net->rocxx . . $ sctp_nets#ro.._l_addrcxx . . $ sctp_net_route#_l_addr..sa.sa_familycxx . . $ sockaddr#sa_family.) {
10140 #ifdef INETcxx . . $ `<built-in>:431:9`!
10141 case AF_INETcxx . . $ `<external>/8962547315054503424/socket.h:97:9`!:
10142 mtu = net->mtucxx . . $ sctp_nets#mtu. - SCTP_MIN_V4_OVERHEADcxx . . $ `usrsctplib/netinet/sctp_header.h:585:9`!;
10143 break;
10144 #endif
10145 #ifdef INET6cxx . . $ `<built-in>:432:9`!
10146 case AF_INET6cxx . . $ `<external>/8962547315054503424/socket.h:105:9`!:
10147 mtu = net->mtucxx . . $ sctp_nets#mtu. - SCTP_MIN_OVERHEADcxx . . $ `usrsctplib/netinet/sctp_header.h:561:9`!;
10148 break;
10149 #endif
10150 #if defined(__Userspace__cxx . . $ `<built-in>:442:9`!)
10151 case AF_CONNcxx . . $ `usrsctplib/netinet/sctp_os_userspace.h:995:9`!:
10152 mtu = net->mtucxx . . $ sctp_nets#mtu. - sizeof(struct sctphdrcxx . . $ sctphdr#);
10153 break;
10154 #endif
10155 default:
10156 /* TSNH */
10157 mtu = net->mtucxx . . $ sctp_nets#mtu.;
10158 break;
10159 }
10160
10161 if ((asoc->peers_rwndcxx . . $ sctp_association#peers_rwnd. < mtu) && (asoc->total_flightcxx . . $ sctp_association#total_flight. > 0)) {
10162 /* No room in peers rwnd */
10163 uint32_tcxx . . $ uint32_t# tsn;
10164
10165 tsn = asoc->last_acked_seqcxx . . $ sctp_association#last_acked_seq. + 1;
10166 if (tsn == chk->reccxx . . $ sctp_tmit_chunk#rec..datacxx . . $ sctp_tmit_chunk#$anonymous_type_3#data..tsncxx . . $ sctp_data_chunkrec#tsn.) {
10167 /*
10168 * we make a special exception for this
10169 * case. The peer has no rwnd but is missing
10170 * the lowest chunk.. which is probably what
10171 * is holding up the rwnd.
10172 */
10173 goto one_chunk_around;
10174 }
10175 return (1);
10176 }
10177 one_chunk_around:
10178 if (asoc->peers_rwndcxx . . $ sctp_association#peers_rwnd. < mtu) {
10179 one_chunk = 1;
10180 if ((asoc->peers_rwndcxx . . $ sctp_association#peers_rwnd. == 0) &&
10181 (asoc->total_flightcxx . . $ sctp_association#total_flight. == 0)) {
10182 chk->window_probecxx . . $ sctp_tmit_chunk#window_probe. = 1;
10183 chk->whoTocxx . . $ sctp_tmit_chunk#whoTo.->window_probecxx . . $ sctp_nets#window_probe. = 1;
10184 }
10185 }
10186 #ifdef SCTP_AUDITING_ENABLED
10187 sctp_audit_log(0xC3, 2);
10188 #endif
10189 bundle_at = 0;
10190 m = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!;
10191 net->fast_retran_ipcxx . . $ sctp_nets#fast_retran_ip. = 0;
10192 if (chk->reccxx . . $ sctp_tmit_chunk#rec..datacxx . . $ sctp_tmit_chunk#$anonymous_type_3#data..doing_fast_retransmitcxx . . $ sctp_data_chunkrec#doing_fast_retransmit. == 0) {
10193 /*
10194 * if no FR in progress skip destination that have
10195 * flight_size > cwnd.
10196 */
10197 if (net->flight_sizecxx . . $ sctp_nets#flight_size. >= net->cwndcxx . . $ sctp_nets#cwnd.) {
10198 continue;
10199 }
10200 } else {
10201 /*
10202 * Mark the destination net to have FR recovery
10203 * limits put on it.
10204 */
10205 *fr_done = 1;
10206 net->fast_retran_ipcxx . . $ sctp_nets#fast_retran_ip. = 1;
10207 }
10208
10209 /*
10210 * if no AUTH is yet included and this chunk requires it,
10211 * make sure to account for it. We don't apply the size
10212 * until the AUTH chunk is actually added below in case
10213 * there is no room for this chunk.
10214 */
10215 if (data_auth_reqd && (auth == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!)) {
10216 dmtu = sctp_get_auth_chunk_lencxx . . $ sctp_get_auth_chunk_len(909d59720f161188).(stcb->asoccxx . . $ sctp_tcb#asoc..peer_hmac_idcxx . . $ sctp_association#peer_hmac_id.);
10217 } else
10218 dmtu = 0;
10219
10220 if ((chk->send_sizecxx . . $ sctp_tmit_chunk#send_size. <= (mtu - dmtu)) ||
10221 (chk->flagscxx . . $ sctp_tmit_chunk#flags. & CHUNK_FLAGS_FRAGMENT_OKcxx . . $ `usrsctplib/netinet/sctp_structs.h:466:9`!)) {
10222 /* ok we will add this one */
10223 if (data_auth_reqd) {
10224 if (auth == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!) {
10225 m = sctp_add_auth_chunkcxx . . $ sctp_add_auth_chunk(c0b2bf5d35b7e5c6).(m,
10226 &endofchain,
10227 &auth,
10228 &auth_offset,
10229 stcb,
10230 SCTP_DATAcxx . . $ `usrsctplib/netinet/sctp.h:449:9`!);
10231 auth_keyid = chk->auth_keyidcxx . . $ sctp_tmit_chunk#auth_keyid.;
10232 override_ok = 0;
10233 SCTP_STAT_INCR_COUNTER64cxx . . $ `./netinet/sctp_uio.h:1127:9`!(sctps_outcontrolchunks);
10234 } else if (override_ok) {
10235 auth_keyid = chk->auth_keyidcxx . . $ sctp_tmit_chunk#auth_keyid.;
10236 override_ok = 0;
10237 } else if (chk->auth_keyidcxx . . $ sctp_tmit_chunk#auth_keyid. != auth_keyid) {
10238 /* different keyid, so done bundling */
10239 break;
10240 }
10241 }
10242 m = sctp_copy_mbufchaincxx . . $ sctp_copy_mbufchain(161b07f3a70427c7).(chk->datacxx . . $ sctp_tmit_chunk#data., m, &endofchain, 0, chk->send_sizecxx . . $ sctp_tmit_chunk#send_size., chk->copy_by_refcxx . . $ sctp_tmit_chunk#copy_by_ref.);
10243 if (m == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!) {
10244 SCTP_LTRACE_ERR_RETcxx . . $ `usrsctplib/netinet/sctp_os_userspace.h:629:9`!(inp, stcb, NULL, SCTP_FROM_SCTP_OUTPUT, ENOMEM);
10245 return (ENOMEMcxx . . $ `<external>/8987895939074593727/errno-base.h:16:9`!);
10246 }
10247 /* Do clear IP_DF ? */
10248 if (chk->flagscxx . . $ sctp_tmit_chunk#flags. & CHUNK_FLAGS_FRAGMENT_OKcxx . . $ `usrsctplib/netinet/sctp_structs.h:466:9`!) {
10249 no_fragmentflg = 0;
10250 }
10251 /* upate our MTU size */
10252 if (mtu > (chk->send_sizecxx . . $ sctp_tmit_chunk#send_size. + dmtu))
10253 mtu -= (chk->send_sizecxx . . $ sctp_tmit_chunk#send_size. + dmtu);
10254 else
10255 mtu = 0;
10256 data_list[bundle_at++] = chk;
10257 if (one_chunk && (asoc->total_flightcxx . . $ sctp_association#total_flight. <= 0)) {
10258 SCTP_STAT_INCRcxx . . $ `./netinet/sctp_uio.h:1111:9`!(sctps_windowprobed);
10259 }
10260 }
10261 if (one_chunk == 0) {
10262 /*
10263 * now are there anymore forward from chk to pick
10264 * up?
10265 */
10266 for (fwd = TAILQ_NEXTcxx . . $ `<external>/2546723208511035544/queue.h:459:9`!(chk, sctp_next); fwd != NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!; fwd = TAILQ_NEXTcxx . . $ `<external>/2546723208511035544/queue.h:459:9`!(fwd, sctp_next)) {
10267 if (fwd->sentcxx . . $ sctp_tmit_chunk#sent. != SCTP_DATAGRAM_RESENDcxx . . $ `usrsctplib/netinet/sctp_constants.h:359:9`!) {
10268 /* Nope, not for retran */
10269 continue;
10270 }
10271 if (fwd->whoTocxx . . $ sctp_tmit_chunk#whoTo. != net) {
10272 /* Nope, not the net in question */
10273 continue;
10274 }
10275 if (data_auth_reqd && (auth == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!)) {
10276 dmtu = sctp_get_auth_chunk_lencxx . . $ sctp_get_auth_chunk_len(909d59720f161188).(stcb->asoccxx . . $ sctp_tcb#asoc..peer_hmac_idcxx . . $ sctp_association#peer_hmac_id.);
10277 } else
10278 dmtu = 0;
10279 if (fwd->send_sizecxx . . $ sctp_tmit_chunk#send_size. <= (mtu - dmtu)) {
10280 if (data_auth_reqd) {
10281 if (auth == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!) {
10282 m = sctp_add_auth_chunkcxx . . $ sctp_add_auth_chunk(c0b2bf5d35b7e5c6).(m,
10283 &endofchain,
10284 &auth,
10285 &auth_offset,
10286 stcb,
10287 SCTP_DATAcxx . . $ `usrsctplib/netinet/sctp.h:449:9`!);
10288 auth_keyid = fwd->auth_keyidcxx . . $ sctp_tmit_chunk#auth_keyid.;
10289 override_ok = 0;
10290 SCTP_STAT_INCR_COUNTER64cxx . . $ `./netinet/sctp_uio.h:1127:9`!(sctps_outcontrolchunks);
10291 } else if (override_ok) {
10292 auth_keyid = fwd->auth_keyidcxx . . $ sctp_tmit_chunk#auth_keyid.;
10293 override_ok = 0;
10294 } else if (fwd->auth_keyidcxx . . $ sctp_tmit_chunk#auth_keyid. != auth_keyid) {
10295 /* different keyid, so done bundling */
10296 break;
10297 }
10298 }
10299 m = sctp_copy_mbufchaincxx . . $ sctp_copy_mbufchain(161b07f3a70427c7).(fwd->datacxx . . $ sctp_tmit_chunk#data., m, &endofchain, 0, fwd->send_sizecxx . . $ sctp_tmit_chunk#send_size., fwd->copy_by_refcxx . . $ sctp_tmit_chunk#copy_by_ref.);
10300 if (m == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!) {
10301 SCTP_LTRACE_ERR_RETcxx . . $ `usrsctplib/netinet/sctp_os_userspace.h:629:9`!(inp, stcb, NULL, SCTP_FROM_SCTP_OUTPUT, ENOMEM);
10302 return (ENOMEMcxx . . $ `<external>/8987895939074593727/errno-base.h:16:9`!);
10303 }
10304 /* Do clear IP_DF ? */
10305 if (fwd->flagscxx . . $ sctp_tmit_chunk#flags. & CHUNK_FLAGS_FRAGMENT_OKcxx . . $ `usrsctplib/netinet/sctp_structs.h:466:9`!) {
10306 no_fragmentflg = 0;
10307 }
10308 /* upate our MTU size */
10309 if (mtu > (fwd->send_sizecxx . . $ sctp_tmit_chunk#send_size. + dmtu))
10310 mtu -= (fwd->send_sizecxx . . $ sctp_tmit_chunk#send_size. + dmtu);
10311 else
10312 mtu = 0;
10313 data_list[bundle_at++] = fwd;
10314 if (bundle_at >= SCTP_MAX_DATA_BUNDLINGcxx . . $ `usrsctplib/netinet/sctp_constants.h:880:9`!) {
10315 break;
10316 }
10317 } else {
10318 /* can't fit so we are done */
10319 break;
10320 }
10321 }
10322 }
10323 /* Is there something to send for this destination? */
10324 if (m) {
10325 /*
10326 * No matter if we fail/or succeed we should start a
10327 * timer. A failure is like a lost IP packet :-)
10328 */
10329 if (!SCTP_OS_TIMER_PENDINGcxx . . $ `usrsctplib/netinet/sctp_callout.h:107:9`!(&net->rxt_timer.timer)) {
10330 /*
10331 * no timer running on this destination
10332 * restart it.
10333 */
10334 sctp_timer_startcxx . . $ sctp_timer_start(73c9263bfa4b937d).(SCTP_TIMER_TYPE_SENDcxx . . $ `usrsctplib/netinet/sctp_constants.h:537:9`!, inp, stcb, net);
10335 tmr_started = 1;
10336 }
10337 /* Now lets send it, if there is anything to send :> */
10338 if ((error = sctp_lowlevel_chunk_outputcxx . . $ sctp_lowlevel_chunk_output(4859f95fdecd7401).(inp, stcb, net,
10339 (struct sockaddrcxx . . $ sockaddr# *)&net->rocxx . . $ sctp_nets#ro.._l_addrcxx . . $ sctp_net_route#_l_addr., m,
10340 auth_offset, auth, auth_keyid,
10341 no_fragmentflg, 0, 0,
10342 inp->sctp_lportcxx . . $ `usrsctplib/netinet/sctp_pcb.h:430:9`!, stcb->rportcxx . . $ sctp_tcb#rport., htonlcxx . . $ htonl(2141b656ce2cc063).(stcb->asoccxx . . $ sctp_tcb#asoc..peer_vtagcxx . . $ sctp_association#peer_vtag.),
10343 net->portcxx . . $ sctp_nets#port., NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!,
10344 #if defined(__FreeBSD__) && !defined(__Userspace__cxx . . $ `<built-in>:442:9`!)
10345 0, 0,
10346 #endif
10347 so_locked))) {
10348 /* error, we could not output */
10349 SCTPDBGcxx . . $ `usrsctplib/netinet/sctp_os_userspace.h:591:9`!(SCTP_DEBUG_OUTPUT3cxx . . $ `usrsctplib/netinet/sctp_constants.h:645:9`!, "Gak send error %d\n", error);
10350 if (error == ENOBUFScxx . . $ `<external>/17922322188510340118/errno.h:89:9`!) {
10351 asoc->ifp_had_enobufcxx . . $ sctp_association#ifp_had_enobuf. = 1;
10352 SCTP_STAT_INCRcxx . . $ `./netinet/sctp_uio.h:1111:9`!(sctps_lowlevelerr);
10353 }
10354 return (error);
10355 } else {
10356 asoc->ifp_had_enobufcxx . . $ sctp_association#ifp_had_enobuf. = 0;
10357 }
10358 endofchain = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!;
10359 auth = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!;
10360 auth_offset = 0;
10361 /* For HB's */
10362 /*
10363 * We don't want to mark the net->sent time here
10364 * since this we use this for HB and retrans cannot
10365 * measure RTT
10366 */
10367 /* (void)SCTP_GETTIME_TIMEVAL(&net->last_sent_time); */
10368
10369 /* For auto-close */
10370 if (*now_filled == 0) {
10371 (void)SCTP_GETTIME_TIMEVALcxx . . $ `usrsctplib/netinet/sctp_constants.h:995:9`!(&asoc->time_last_sent);
10372 *now = asoc->time_last_sentcxx . . $ sctp_association#time_last_sent.;
10373 *now_filled = 1;
10374 } else {
10375 asoc->time_last_sentcxx . . $ sctp_association#time_last_sent. = *now;
10376 }
10377 *cnt_out += bundle_at;
10378 #ifdef SCTP_AUDITING_ENABLED
10379 sctp_audit_log(0xC4, bundle_at);
10380 #endif
10381 if (bundle_at) {
10382 tsns_sent = data_list[0]->reccxx . . $ sctp_tmit_chunk#rec..datacxx . . $ sctp_tmit_chunk#$anonymous_type_3#data..tsncxx . . $ sctp_data_chunkrec#tsn.;
10383 }
10384 for (i = 0; i < bundle_at; i++) {
10385 SCTP_STAT_INCRcxx . . $ `./netinet/sctp_uio.h:1111:9`!(sctps_sendretransdata);
10386 data_list[i]->sentcxx . . $ sctp_tmit_chunk#sent. = SCTP_DATAGRAM_SENTcxx . . $ `usrsctplib/netinet/sctp_constants.h:354:9`!;
10387 /*
10388 * When we have a revoked data, and we
10389 * retransmit it, then we clear the revoked
10390 * flag since this flag dictates if we
10391 * subtracted from the fs
10392 */
10393 if (data_list[i]->reccxx . . $ sctp_tmit_chunk#rec..datacxx . . $ sctp_tmit_chunk#$anonymous_type_3#data..chunk_was_revokedcxx . . $ sctp_data_chunkrec#chunk_was_revoked.) {
10394 /* Deflate the cwnd */
10395 data_list[i]->whoTocxx . . $ sctp_tmit_chunk#whoTo.->cwndcxx . . $ sctp_nets#cwnd. -= data_list[i]->book_sizecxx . . $ sctp_tmit_chunk#book_size.;
10396 data_list[i]->reccxx . . $ sctp_tmit_chunk#rec..datacxx . . $ sctp_tmit_chunk#$anonymous_type_3#data..chunk_was_revokedcxx . . $ sctp_data_chunkrec#chunk_was_revoked. = 0;
10397 }
10398 data_list[i]->snd_countcxx . . $ sctp_tmit_chunk#snd_count.++;
10399 sctp_ucount_decrcxx . . $ `usrsctplib/netinet/sctp_var.h:271:9`!(asoc->sent_queue_retran_cnt);
10400 /* record the time */
10401 data_list[i]->sent_rcv_timecxx . . $ sctp_tmit_chunk#sent_rcv_time. = asoc->time_last_sentcxx . . $ sctp_association#time_last_sent.;
10402 if (data_list[i]->book_size_scalecxx . . $ sctp_tmit_chunk#book_size_scale.) {
10403 /*
10404 * need to double the book size on
10405 * this one
10406 */
10407 data_list[i]->book_size_scalecxx . . $ sctp_tmit_chunk#book_size_scale. = 0;
10408 /* Since we double the booksize, we must
10409 * also double the output queue size, since this
10410 * get shrunk when we free by this amount.
10411 */
10412 atomic_add_intcxx . . $ `usrsctplib/user_atomic.h:94:9`!(&((asoc)->total_output_queue_size),data_list[i]->book_size);
10413 data_list[i]->book_sizecxx . . $ sctp_tmit_chunk#book_size. *= 2;
10414 } else {
10415 if (SCTP_BASE_SYSCTLcxx . . $ `usrsctplib/netinet/sctp_os_userspace.h:579:9`!(sctp_logging_level) & SCTP_LOG_RWND_ENABLEcxx . . $ `usrsctplib/netinet/sctp.h:656:9`!) {
10416 sctp_log_rwndcxx . . $ sctp_log_rwnd(ff6ad2c433048b0).(SCTP_DECREASE_PEER_RWNDcxx . . $ `usrsctplib/netinet/sctp_constants.h:146:9`!,
10417 asoc->peers_rwndcxx . . $ sctp_association#peers_rwnd., data_list[i]->send_sizecxx . . $ sctp_tmit_chunk#send_size., SCTP_BASE_SYSCTLcxx . . $ `usrsctplib/netinet/sctp_os_userspace.h:579:9`!(sctp_peer_chunk_oh));
10418 }
10419 asoc->peers_rwndcxx . . $ sctp_association#peers_rwnd. = sctp_sbspace_subcxx . . $ `usrsctplib/netinet/sctp_var.h:94:9`!(asoc->peers_rwnd,
10420 (uint32_t) (data_list[i]->send_size +
10421 SCTP_BASE_SYSCTLcxx . . $ `usrsctplib/netinet/sctp_os_userspace.h:579:9`!(sctp_peer_chunk_oh)));
10422 }
10423 if (SCTP_BASE_SYSCTLcxx . . $ `usrsctplib/netinet/sctp_os_userspace.h:579:9`!(sctp_logging_level) & SCTP_FLIGHT_LOGGING_ENABLEcxx . . $ `usrsctplib/netinet/sctp.h:641:9`!) {
10424 sctp_misc_intscxx . . $ sctp_misc_ints(da1ccf5149f5690e).(SCTP_FLIGHT_LOG_UP_RSNDcxx . . $ `usrsctplib/netinet/sctp_constants.h:220:9`!,
10425 data_list[i]->whoTocxx . . $ sctp_tmit_chunk#whoTo.->flight_sizecxx . . $ sctp_nets#flight_size.,
10426 data_list[i]->book_sizecxx . . $ sctp_tmit_chunk#book_size.,
10427 (uint32_tcxx . . $ uint32_t#)(uintptr_tcxx . . $ uintptr_t#)data_list[i]->whoTocxx . . $ sctp_tmit_chunk#whoTo.,
10428 data_list[i]->reccxx . . $ sctp_tmit_chunk#rec..datacxx . . $ sctp_tmit_chunk#$anonymous_type_3#data..tsncxx . . $ sctp_data_chunkrec#tsn.);
10429 }
10430 sctp_flight_size_increasecxx . . $ `usrsctplib/netinet/sctp_var.h:297:9`!(data_list[i]);
10431 sctp_total_flight_increasecxx . . $ `usrsctplib/netinet/sctp_var.h:351:9`!(stcb, data_list[i]);
10432 if (asoc->peers_rwndcxx . . $ sctp_association#peers_rwnd. < stcb->sctp_epcxx . . $ sctp_tcb#sctp_ep.->sctp_epcxx . . $ sctp_inpcb#sctp_ep..sctp_sws_sendercxx . . $ sctp_pcb#sctp_sws_sender.) {
10433 /* SWS sender side engages */
10434 asoc->peers_rwndcxx . . $ sctp_association#peers_rwnd. = 0;
10435 }
10436 if ((i == 0) &&
10437 (data_list[i]->reccxx . . $ sctp_tmit_chunk#rec..datacxx . . $ sctp_tmit_chunk#$anonymous_type_3#data..doing_fast_retransmitcxx . . $ sctp_data_chunkrec#doing_fast_retransmit.)) {
10438 SCTP_STAT_INCRcxx . . $ `./netinet/sctp_uio.h:1111:9`!(sctps_sendfastretrans);
10439 if ((data_list[i] == TAILQ_FIRSTcxx . . $ `<external>/2546723208511035544/queue.h:458:9`!(&asoc->sent_queue)) &&
10440 (tmr_started == 0)) {
10441 /*-
10442 * ok we just fast-retrans'd
10443 * the lowest TSN, i.e the
10444 * first on the list. In
10445 * this case we want to give
10446 * some more time to get a
10447 * SACK back without a
10448 * t3-expiring.
10449 */
10450 sctp_timer_stopcxx . . $ sctp_timer_stop(dc50a43aa5f83109).(SCTP_TIMER_TYPE_SENDcxx . . $ `usrsctplib/netinet/sctp_constants.h:537:9`!, inp, stcb, net,
10451 SCTP_FROM_SCTP_OUTPUTcxx . . $ `usrsctplib/netinet/sctp_constants.h:767:9`! + SCTP_LOC_2cxx . . $ `usrsctplib/netinet/sctp_constants.h:774:9`!);
10452 sctp_timer_startcxx . . $ sctp_timer_start(73c9263bfa4b937d).(SCTP_TIMER_TYPE_SENDcxx . . $ `usrsctplib/netinet/sctp_constants.h:537:9`!, inp, stcb, net);
10453 }
10454 }
10455 }
10456 if (SCTP_BASE_SYSCTLcxx . . $ `usrsctplib/netinet/sctp_os_userspace.h:579:9`!(sctp_logging_level) & SCTP_CWND_LOGGING_ENABLEcxx . . $ `usrsctplib/netinet/sctp.h:640:9`!) {
10457 sctp_log_cwndcxx . . $ sctp_log_cwnd(b2b0f138897254c).(stcb, net, tsns_sent, SCTP_CWND_LOG_FROM_RESENDcxx . . $ `usrsctplib/netinet/sctp_constants.h:175:9`!);
10458 }
10459 #ifdef SCTP_AUDITING_ENABLED
10460 sctp_auditing(21, inp, stcb, NULL);
10461 #endif
10462 } else {
10463 /* None will fit */
10464 return (1);
10465 }
10466 if (asoc->sent_queue_retran_cntcxx . . $ sctp_association#sent_queue_retran_cnt. <= 0) {
10467 /* all done we have no more to retran */
10468 asoc->sent_queue_retran_cntcxx . . $ sctp_association#sent_queue_retran_cnt. = 0;
10469 break;
10470 }
10471 if (one_chunk) {
10472 /* No more room in rwnd */
10473 return (1);
10474 }
10475 /* stop the for loop here. we sent out a packet */
10476 break;
10477 }
10478 return (0);
10479 }
10480
10481 static void
10482 sctp_timer_validationcxx . . $ sctp_timer_validation(35e43fb99e8be7a3).(struct sctp_inpcbcxx . . $ sctp_inpcb# *inp,
10483 struct sctp_tcbcxx . . $ sctp_tcb# *stcb,
10484 struct sctp_associationcxx . . $ sctp_association# *asoc)
10485 {
10486 struct sctp_netscxx . . $ sctp_nets# *net;
10487
10488 /* Validate that a timer is running somewhere */
10489 TAILQ_FOREACHcxx . . $ `<external>/2546723208511035544/queue.h:435:9`!(net, &asoc->nets, sctp_next) {
10490 if (SCTP_OS_TIMER_PENDINGcxx . . $ `usrsctplib/netinet/sctp_callout.h:107:9`!(&net->rxt_timer.timer)) {
10491 /* Here is a timer */
10492 return;
10493 }
10494 }
10495 SCTP_TCB_LOCK_ASSERTcxx . . $ `usrsctplib/netinet/sctp_process_lock.h:478:9`!(stcb);
10496 /* Gak, we did not have a timer somewhere */
10497 SCTPDBGcxx . . $ `usrsctplib/netinet/sctp_os_userspace.h:591:9`!(SCTP_DEBUG_OUTPUT3cxx . . $ `usrsctplib/netinet/sctp_constants.h:645:9`!, "Deadlock avoided starting timer on a dest at retran\n");
10498 if (asoc->alternatecxx . . $ sctp_association#alternate.) {
10499 sctp_timer_startcxx . . $ sctp_timer_start(73c9263bfa4b937d).(SCTP_TIMER_TYPE_SENDcxx . . $ `usrsctplib/netinet/sctp_constants.h:537:9`!, inp, stcb, asoc->alternatecxx . . $ sctp_association#alternate.);
10500 } else {
10501 sctp_timer_startcxx . . $ sctp_timer_start(73c9263bfa4b937d).(SCTP_TIMER_TYPE_SENDcxx . . $ `usrsctplib/netinet/sctp_constants.h:537:9`!, inp, stcb, asoc->primary_destinationcxx . . $ sctp_association#primary_destination.);
10502 }
10503 return;
10504 }
10505
10506 void
10507 sctp_chunk_outputcxx . . $ sctp_chunk_output(777f7332f4f2f1ed).(struct sctp_inpcbcxx . . $ sctp_inpcb# *inp,
10508 struct sctp_tcbcxx . . $ sctp_tcb# *stcb,
10509 int from_where,
10510 int so_locked)
10511 {
10512 /*-
10513 * Ok this is the generic chunk service queue. we must do the
10514 * following:
10515 * - See if there are retransmits pending, if so we must
10516 * do these first.
10517 * - Service the stream queue that is next, moving any
10518 * message (note I must get a complete message i.e.
10519 * FIRST/MIDDLE and LAST to the out queue in one pass) and assigning
10520 * TSN's
10521 * - Check to see if the cwnd/rwnd allows any output, if so we
10522 * go ahead and fomulate and send the low level chunks. Making sure
10523 * to combine any control in the control chunk queue also.
10524 */
10525 struct sctp_associationcxx . . $ sctp_association# *asoc;
10526 struct sctp_netscxx . . $ sctp_nets# *net;
10527 int error = 0, num_out, tot_out = 0, ret = 0, reason_code;
10528 unsigned int burst_cnt = 0;
10529 struct timevalcxx . . $ timeval# now;
10530 int now_filled = 0;
10531 int nagle_on;
10532 int frag_point = sctp_get_frag_pointcxx . . $ sctp_get_frag_point(527fbf6e26d2907d).(stcb, &stcb->asoccxx . . $ sctp_tcb#asoc.);
10533 int un_sent = 0;
10534 int fr_done;
10535 unsigned int tot_frs = 0;
10536
10537 #if defined(__APPLE__) && !defined(__Userspace__cxx . . $ `<built-in>:442:9`!)
10538 if (so_locked) {
10539 sctp_lock_assert(SCTP_INP_SO(inp));
10540 } else {
10541 sctp_unlock_assert(SCTP_INP_SO(inp));
10542 }
10543 #endif
10544 asoc = &stcb->asoccxx . . $ sctp_tcb#asoc.;
10545 do_it_again:
10546 /* The Nagle algorithm is only applied when handling a send call. */
10547 if (from_where == SCTP_OUTPUT_FROM_USR_SENDcxx . . $ `usrsctplib/netinet/sctp_constants.h:366:9`!) {
10548 if (sctp_is_feature_oncxx . . $ `usrsctplib/netinet/sctp_var.h:53:9`!(inp, SCTP_PCB_FLAGS_NODELAYcxx . . $ `usrsctplib/netinet/sctp.h:571:9`!)) {
10549 nagle_on = 0;
10550 } else {
10551 nagle_on = 1;
10552 }
10553 } else {
10554 nagle_on = 0;
10555 }
10556 SCTP_TCB_LOCK_ASSERTcxx . . $ `usrsctplib/netinet/sctp_process_lock.h:478:9`!(stcb);
10557
10558 un_sent = (stcb->asoccxx . . $ sctp_tcb#asoc..total_output_queue_sizecxx . . $ sctp_association#total_output_queue_size. - stcb->asoccxx . . $ sctp_tcb#asoc..total_flightcxx . . $ sctp_association#total_flight.);
10559
10560 if ((un_sent <= 0) &&
10561 (TAILQ_EMPTYcxx . . $ `<external>/2546723208511035544/queue.h:457:9`!(&asoc->control_send_queue)) &&
10562 (TAILQ_EMPTYcxx . . $ `<external>/2546723208511035544/queue.h:457:9`!(&asoc->asconf_send_queue)) &&
10563 (asoc->sent_queue_retran_cntcxx . . $ sctp_association#sent_queue_retran_cnt. == 0) &&
10564 (asoc->trigger_resetcxx . . $ sctp_association#trigger_reset. == 0)) {
10565 /* Nothing to do unless there is something to be sent left */
10566 return;
10567 }
10568 /* Do we have something to send, data or control AND
10569 * a sack timer running, if so piggy-back the sack.
10570 */
10571 if (SCTP_OS_TIMER_PENDINGcxx . . $ `usrsctplib/netinet/sctp_callout.h:107:9`!(&stcb->asoc.dack_timer.timer)) {
10572 sctp_send_sackcxx . . $ sctp_send_sack(309e9a20a883d7fc).(stcb, so_locked);
10573 sctp_timer_stopcxx . . $ sctp_timer_stop(dc50a43aa5f83109).(SCTP_TIMER_TYPE_RECVcxx . . $ `usrsctplib/netinet/sctp_constants.h:539:9`!, stcb->sctp_epcxx . . $ sctp_tcb#sctp_ep., stcb, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!,
10574 SCTP_FROM_SCTP_OUTPUTcxx . . $ `usrsctplib/netinet/sctp_constants.h:767:9`! + SCTP_LOC_3cxx . . $ `usrsctplib/netinet/sctp_constants.h:775:9`!);
10575 }
10576 while (asoc->sent_queue_retran_cntcxx . . $ sctp_association#sent_queue_retran_cnt.) {
10577 /*-
10578 * Ok, it is retransmission time only, we send out only ONE
10579 * packet with a single call off to the retran code.
10580 */
10581 if (from_where == SCTP_OUTPUT_FROM_COOKIE_ACKcxx . . $ `usrsctplib/netinet/sctp_constants.h:380:9`!) {
10582 /*-
10583 * Special hook for handling cookiess discarded
10584 * by peer that carried data. Send cookie-ack only
10585 * and then the next call with get the retran's.
10586 */
10587 (void)sctp_med_chunk_outputcxx . . $ sctp_med_chunk_output(ae2c5cc94a0e278d).(inp, stcb, asoc, &num_out, &reason_code, 1,
10588 from_where,
10589 &now, &now_filled, frag_point, so_locked);
10590 return;
10591 } else if (from_where != SCTP_OUTPUT_FROM_HB_TMRcxx . . $ `usrsctplib/netinet/sctp_constants.h:372:9`!) {
10592 /* if its not from a HB then do it */
10593 fr_done = 0;
10594 ret = sctp_chunk_retransmissioncxx . . $ sctp_chunk_retransmission(53b6ddff50b5901d).(inp, stcb, asoc, &num_out, &now, &now_filled, &fr_done, so_locked);
10595 if (fr_done) {
10596 tot_frs++;
10597 }
10598 } else {
10599 /*
10600 * its from any other place, we don't allow retran
10601 * output (only control)
10602 */
10603 ret = 1;
10604 }
10605 if (ret > 0) {
10606 /* Can't send anymore */
10607 /*-
10608 * now lets push out control by calling med-level
10609 * output once. this assures that we WILL send HB's
10610 * if queued too.
10611 */
10612 (void)sctp_med_chunk_outputcxx . . $ sctp_med_chunk_output(ae2c5cc94a0e278d).(inp, stcb, asoc, &num_out, &reason_code, 1,
10613 from_where,
10614 &now, &now_filled, frag_point, so_locked);
10615 #ifdef SCTP_AUDITING_ENABLED
10616 sctp_auditing(8, inp, stcb, NULL);
10617 #endif
10618 sctp_timer_validationcxx . . $ sctp_timer_validation(35e43fb99e8be7a3).(inp, stcb, asoc);
10619 return;
10620 }
10621 if (ret < 0) {
10622 /*-
10623 * The count was off.. retran is not happening so do
10624 * the normal retransmission.
10625 */
10626 #ifdef SCTP_AUDITING_ENABLED
10627 sctp_auditing(9, inp, stcb, NULL);
10628 #endif
10629 if (ret == SCTP_RETRAN_EXITcxx . . $ `usrsctplib/netinet/sctp_constants.h:912:9`!) {
10630 return;
10631 }
10632 break;
10633 }
10634 if (from_where == SCTP_OUTPUT_FROM_T3cxx . . $ `usrsctplib/netinet/sctp_constants.h:367:9`!) {
10635 /* Only one transmission allowed out of a timeout */
10636 #ifdef SCTP_AUDITING_ENABLED
10637 sctp_auditing(10, inp, stcb, NULL);
10638 #endif
10639 /* Push out any control */
10640 (void)sctp_med_chunk_outputcxx . . $ sctp_med_chunk_output(ae2c5cc94a0e278d).(inp, stcb, asoc, &num_out, &reason_code, 1, from_where,
10641 &now, &now_filled, frag_point, so_locked);
10642 return;
10643 }
10644 if ((asoc->fr_max_burstcxx . . $ sctp_association#fr_max_burst. > 0) && (tot_frs >= asoc->fr_max_burstcxx . . $ sctp_association#fr_max_burst.)) {
10645 /* Hit FR burst limit */
10646 return;
10647 }
10648 if ((num_out == 0) && (ret == 0)) {
10649 /* No more retrans to send */
10650 break;
10651 }
10652 }
10653 #ifdef SCTP_AUDITING_ENABLED
10654 sctp_auditing(12, inp, stcb, NULL);
10655 #endif
10656 /* Check for bad destinations, if they exist move chunks around. */
10657 TAILQ_FOREACHcxx . . $ `<external>/2546723208511035544/queue.h:435:9`!(net, &asoc->nets, sctp_next) {
10658 if (!(net->dest_statecxx . . $ sctp_nets#dest_state. & SCTP_ADDR_REACHABLEcxx . . $ `usrsctplib/netinet/sctp_constants.h:486:9`!)) {
10659 /*-
10660 * if possible move things off of this address we
10661 * still may send below due to the dormant state but
10662 * we try to find an alternate address to send to
10663 * and if we have one we move all queued data on the
10664 * out wheel to this alternate address.
10665 */
10666 if (net->ref_countcxx . . $ sctp_nets#ref_count. > 1)
10667 sctp_move_chunks_from_netcxx . . $ sctp_move_chunks_from_net(2ed2c3ddd2bbab6a).(stcb, net);
10668 } else {
10669 /*-
10670 * if ((asoc->sat_network) || (net->addr_is_local))
10671 * { burst_limit = asoc->max_burst *
10672 * SCTP_SAT_NETWORK_BURST_INCR; }
10673 */
10674 if (asoc->max_burstcxx . . $ sctp_association#max_burst. > 0) {
10675 if (SCTP_BASE_SYSCTLcxx . . $ `usrsctplib/netinet/sctp_os_userspace.h:579:9`!(sctp_use_cwnd_based_maxburst)) {
10676 if ((net->flight_sizecxx . . $ sctp_nets#flight_size. + (asoc->max_burstcxx . . $ sctp_association#max_burst. * net->mtucxx . . $ sctp_nets#mtu.)) < net->cwndcxx . . $ sctp_nets#cwnd.) {
10677 /* JRS - Use the congestion control given in the congestion control module */
10678 asoc->cc_functionscxx . . $ sctp_association#cc_functions..sctp_cwnd_update_after_outputcxx . . $ sctp_cc_functions#sctp_cwnd_update_after_output.(stcb, net, asoc->max_burstcxx . . $ sctp_association#max_burst.);
10679 if (SCTP_BASE_SYSCTLcxx . . $ `usrsctplib/netinet/sctp_os_userspace.h:579:9`!(sctp_logging_level) & SCTP_LOG_MAXBURST_ENABLEcxx . . $ `usrsctplib/netinet/sctp.h:655:9`!) {
10680 sctp_log_maxburstcxx . . $ sctp_log_maxburst(5b7081a25c9d4994).(stcb, net, 0, asoc->max_burstcxx . . $ sctp_association#max_burst., SCTP_MAX_BURST_APPLIEDcxx . . $ `usrsctplib/netinet/sctp_constants.h:142:9`!);
10681 }
10682 SCTP_STAT_INCRcxx . . $ `./netinet/sctp_uio.h:1111:9`!(sctps_maxburstqueued);
10683 }
10684 net->fast_retran_ipcxx . . $ sctp_nets#fast_retran_ip. = 0;
10685 } else {
10686 if (net->flight_sizecxx . . $ sctp_nets#flight_size. == 0) {
10687 /* Should be decaying the cwnd here */
10688 ;
10689 }
10690 }
10691 }
10692 }
10693 }
10694 burst_cnt = 0;
10695 do {
10696 error = sctp_med_chunk_outputcxx . . $ sctp_med_chunk_output(ae2c5cc94a0e278d).(inp, stcb, asoc, &num_out,
10697 &reason_code, 0, from_where,
10698 &now, &now_filled, frag_point, so_locked);
10699 if (error) {
10700 SCTPDBGcxx . . $ `usrsctplib/netinet/sctp_os_userspace.h:591:9`!(SCTP_DEBUG_OUTPUT1cxx . . $ `usrsctplib/netinet/sctp_constants.h:643:9`!, "Error %d was returned from med-c-op\n", error);
10701 if (SCTP_BASE_SYSCTLcxx . . $ `usrsctplib/netinet/sctp_os_userspace.h:579:9`!(sctp_logging_level) & SCTP_LOG_MAXBURST_ENABLEcxx . . $ `usrsctplib/netinet/sctp.h:655:9`!) {
10702 sctp_log_maxburstcxx . . $ sctp_log_maxburst(5b7081a25c9d4994).(stcb, asoc->primary_destinationcxx . . $ sctp_association#primary_destination., error, burst_cnt, SCTP_MAX_BURST_ERROR_STOPcxx . . $ `usrsctplib/netinet/sctp_constants.h:144:9`!);
10703 }
10704 if (SCTP_BASE_SYSCTLcxx . . $ `usrsctplib/netinet/sctp_os_userspace.h:579:9`!(sctp_logging_level) & SCTP_CWND_LOGGING_ENABLEcxx . . $ `usrsctplib/netinet/sctp.h:640:9`!) {
10705 sctp_log_cwndcxx . . $ sctp_log_cwnd(b2b0f138897254c).(stcb, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!, error, SCTP_SEND_NOW_COMPLETEScxx . . $ `usrsctplib/netinet/sctp_constants.h:177:9`!);
10706 sctp_log_cwndcxx . . $ sctp_log_cwnd(b2b0f138897254c).(stcb, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!, 0xdeadbeef, SCTP_SEND_NOW_COMPLETEScxx . . $ `usrsctplib/netinet/sctp_constants.h:177:9`!);
10707 }
10708 break;
10709 }
10710 SCTPDBGcxx . . $ `usrsctplib/netinet/sctp_os_userspace.h:591:9`!(SCTP_DEBUG_OUTPUT3cxx . . $ `usrsctplib/netinet/sctp_constants.h:645:9`!, "m-c-o put out %d\n", num_out);
10711
10712 tot_out += num_out;
10713 burst_cnt++;
10714 if (SCTP_BASE_SYSCTLcxx . . $ `usrsctplib/netinet/sctp_os_userspace.h:579:9`!(sctp_logging_level) & SCTP_CWND_LOGGING_ENABLEcxx . . $ `usrsctplib/netinet/sctp.h:640:9`!) {
10715 sctp_log_cwndcxx . . $ sctp_log_cwnd(b2b0f138897254c).(stcb, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!, num_out, SCTP_SEND_NOW_COMPLETEScxx . . $ `usrsctplib/netinet/sctp_constants.h:177:9`!);
10716 if (num_out == 0) {
10717 sctp_log_cwndcxx . . $ sctp_log_cwnd(b2b0f138897254c).(stcb, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!, reason_code, SCTP_SEND_NOW_COMPLETEScxx . . $ `usrsctplib/netinet/sctp_constants.h:177:9`!);
10718 }
10719 }
10720 if (nagle_on) {
10721 /*
10722 * When the Nagle algorithm is used, look at how much
10723 * is unsent, then if its smaller than an MTU and we
10724 * have data in flight we stop, except if we are
10725 * handling a fragmented user message.
10726 */
10727 un_sent = stcb->asoccxx . . $ sctp_tcb#asoc..total_output_queue_sizecxx . . $ sctp_association#total_output_queue_size. - stcb->asoccxx . . $ sctp_tcb#asoc..total_flightcxx . . $ sctp_association#total_flight.;
10728 if ((un_sent < (int)(stcb->asoccxx . . $ sctp_tcb#asoc..smallest_mtucxx . . $ sctp_association#smallest_mtu. - SCTP_MIN_OVERHEADcxx . . $ `usrsctplib/netinet/sctp_header.h:561:9`!)) &&
10729 (stcb->asoccxx . . $ sctp_tcb#asoc..total_flightcxx . . $ sctp_association#total_flight. > 0)) {
10730 /* && sctp_is_feature_on(inp, SCTP_PCB_FLAGS_EXPLICIT_EOR))) {*/
10731 break;
10732 }
10733 }
10734 if (TAILQ_EMPTYcxx . . $ `<external>/2546723208511035544/queue.h:457:9`!(&asoc->control_send_queue) &&
10735 TAILQ_EMPTYcxx . . $ `<external>/2546723208511035544/queue.h:457:9`!(&asoc->send_queue) &&
10736 sctp_is_there_unsent_datacxx . . $ sctp_is_there_unsent_data(ac3aa47b47eaac09).(stcb, so_locked) == 0) {
10737 /* Nothing left to send */
10738 break;
10739 }
10740 if ((stcb->asoccxx . . $ sctp_tcb#asoc..total_output_queue_sizecxx . . $ sctp_association#total_output_queue_size. - stcb->asoccxx . . $ sctp_tcb#asoc..total_flightcxx . . $ sctp_association#total_flight.) <= 0) {
10741 /* Nothing left to send */
10742 break;
10743 }
10744 } while (num_out &&
10745 ((asoc->max_burstcxx . . $ sctp_association#max_burst. == 0) ||
10746 SCTP_BASE_SYSCTLcxx . . $ `usrsctplib/netinet/sctp_os_userspace.h:579:9`!(sctp_use_cwnd_based_maxburst) ||
10747 (burst_cnt < asoc->max_burstcxx . . $ sctp_association#max_burst.)));
10748
10749 if (SCTP_BASE_SYSCTLcxx . . $ `usrsctplib/netinet/sctp_os_userspace.h:579:9`!(sctp_use_cwnd_based_maxburst) == 0) {
10750 if ((asoc->max_burstcxx . . $ sctp_association#max_burst. > 0) && (burst_cnt >= asoc->max_burstcxx . . $ sctp_association#max_burst.)) {
10751 SCTP_STAT_INCRcxx . . $ `./netinet/sctp_uio.h:1111:9`!(sctps_maxburstqueued);
10752 asoc->burst_limit_appliedcxx . . $ sctp_association#burst_limit_applied. = 1;
10753 if (SCTP_BASE_SYSCTLcxx . . $ `usrsctplib/netinet/sctp_os_userspace.h:579:9`!(sctp_logging_level) & SCTP_LOG_MAXBURST_ENABLEcxx . . $ `usrsctplib/netinet/sctp.h:655:9`!) {
10754 sctp_log_maxburstcxx . . $ sctp_log_maxburst(5b7081a25c9d4994).(stcb, asoc->primary_destinationcxx . . $ sctp_association#primary_destination., 0, burst_cnt, SCTP_MAX_BURST_APPLIEDcxx . . $ `usrsctplib/netinet/sctp_constants.h:142:9`!);
10755 }
10756 } else {
10757 asoc->burst_limit_appliedcxx . . $ sctp_association#burst_limit_applied. = 0;
10758 }
10759 }
10760 if (SCTP_BASE_SYSCTLcxx . . $ `usrsctplib/netinet/sctp_os_userspace.h:579:9`!(sctp_logging_level) & SCTP_CWND_LOGGING_ENABLEcxx . . $ `usrsctplib/netinet/sctp.h:640:9`!) {
10761 sctp_log_cwndcxx . . $ sctp_log_cwnd(b2b0f138897254c).(stcb, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!, tot_out, SCTP_SEND_NOW_COMPLETEScxx . . $ `usrsctplib/netinet/sctp_constants.h:177:9`!);
10762 }
10763 SCTPDBGcxx . . $ `usrsctplib/netinet/sctp_os_userspace.h:591:9`!(SCTP_DEBUG_OUTPUT1cxx . . $ `usrsctplib/netinet/sctp_constants.h:643:9`!, "Ok, we have put out %d chunks\n",
10764 tot_out);
10765
10766 /*-
10767 * Now we need to clean up the control chunk chain if a ECNE is on
10768 * it. It must be marked as UNSENT again so next call will continue
10769 * to send it until such time that we get a CWR, to remove it.
10770 */
10771 if (stcb->asoccxx . . $ sctp_tcb#asoc..ecn_echo_cnt_onqcxx . . $ sctp_association#ecn_echo_cnt_onq.)
10772 sctp_fix_ecn_echocxx . . $ sctp_fix_ecn_echo(63e1d2357fd698a9).(asoc);
10773
10774 if (stcb->asoccxx . . $ sctp_tcb#asoc..trigger_resetcxx . . $ sctp_association#trigger_reset.) {
10775 if (sctp_send_stream_reset_out_if_possiblecxx . . $ sctp_send_stream_reset_out_if_possible(ac3aa47b47eaac09).(stcb, so_locked) == 0) {
10776 goto do_it_again;
10777 }
10778 }
10779 return;
10780 }
10781
10782 int
10783 sctp_outputcxx . . $ sctp_output(26d6412d8b0f6338).(
10784 struct sctp_inpcbcxx . . $ sctp_inpcb# *inp,
10785 struct mbufcxx . . $ mbuf# *m,
10786 struct sockaddrcxx . . $ sockaddr# *addr,
10787 struct mbufcxx . . $ mbuf# *control,
10788 #if defined(__FreeBSD__) && !defined(__Userspace__cxx . . $ `<built-in>:442:9`!)
10789 struct thread *p,
10790 #elif defined(_WIN32) && !defined(__Userspace__cxx . . $ `<built-in>:442:9`!)
10791 PKTHREAD p,
10792 #else
10793 #if defined(__APPLE__) && !defined(__Userspace__cxx . . $ `<built-in>:442:9`!)
10794 struct proc *p SCTP_UNUSED,
10795 #else
10796 struct proccxx . . $ proc# *p,
10797 #endif
10798 #endif
10799 int flags)
10800 {
10801 if (inp == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!) {
10802 SCTP_LTRACE_ERR_RET_PKTcxx . . $ `usrsctplib/netinet/sctp_os_userspace.h:628:9`!(m, inp, NULL, NULL, SCTP_FROM_SCTP_OUTPUT, EINVAL);
10803 return (EINVALcxx . . $ `<external>/8987895939074593727/errno-base.h:26:9`!);
10804 }
10805
10806 if (inp->sctp_socketcxx . . $ sctp_inpcb#sctp_socket. == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!) {
10807 SCTP_LTRACE_ERR_RET_PKTcxx . . $ `usrsctplib/netinet/sctp_os_userspace.h:628:9`!(m, inp, NULL, NULL, SCTP_FROM_SCTP_OUTPUT, EINVAL);
10808 return (EINVALcxx . . $ `<external>/8987895939074593727/errno-base.h:26:9`!);
10809 }
10810 return (sctp_sosendcxx . . $ sctp_sosend(108d9d48198ffd7).(inp->sctp_socketcxx . . $ sctp_inpcb#sctp_socket.,
10811 addr,
10812 (struct uiocxx . . $ uio# *)NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!,
10813 m,
10814 control,
10815 #if defined(__APPLE__) && !defined(__Userspace__cxx . . $ `<built-in>:442:9`!)
10816 flags
10817 #else
10818 flags, p
10819 #endif
10820 ));
10821 }
10822
10823 void
10824 send_forward_tsncxx . . $ send_forward_tsn(3638db9184331deb).(struct sctp_tcbcxx . . $ sctp_tcb# *stcb,
10825 struct sctp_associationcxx . . $ sctp_association# *asoc)
10826 {
10827 struct sctp_tmit_chunkcxx . . $ sctp_tmit_chunk# *chk, *at, *tp1, *last;
10828 struct sctp_forward_tsn_chunkcxx . . $ sctp_forward_tsn_chunk# *fwdtsn;
10829 struct sctp_strseqcxx . . $ sctp_strseq# *strseq;
10830 struct sctp_strseq_midcxx . . $ sctp_strseq_mid# *strseq_m;
10831 uint32_tcxx . . $ uint32_t# advance_peer_ack_point;
10832 unsigned int cnt_of_space, i, ovh;
10833 unsigned int space_needed;
10834 unsigned int cnt_of_skipped = 0;
10835
10836 SCTP_TCB_LOCK_ASSERTcxx . . $ `usrsctplib/netinet/sctp_process_lock.h:478:9`!(stcb);
10837 TAILQ_FOREACHcxx . . $ `<external>/2546723208511035544/queue.h:435:9`!(chk, &asoc->control_send_queue, sctp_next) {
10838 if (chk->reccxx . . $ sctp_tmit_chunk#rec..chunk_idcxx . . $ sctp_tmit_chunk#$anonymous_type_3#chunk_id..idcxx . . $ chk_id#id. == SCTP_FORWARD_CUM_TSNcxx . . $ `usrsctplib/netinet/sctp.h:482:9`!) {
10839 /* mark it to unsent */
10840 chk->sentcxx . . $ sctp_tmit_chunk#sent. = SCTP_DATAGRAM_UNSENTcxx . . $ `usrsctplib/netinet/sctp_constants.h:353:9`!;
10841 chk->snd_countcxx . . $ sctp_tmit_chunk#snd_count. = 0;
10842 /* Do we correct its output location? */
10843 if (chk->whoTocxx . . $ sctp_tmit_chunk#whoTo.) {
10844 sctp_free_remote_addrcxx . . $ `usrsctplib/netinet/sctp_var.h:229:9`!(chk->whoTo);
10845 chk->whoTocxx . . $ sctp_tmit_chunk#whoTo. = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!;
10846 }
10847 goto sctp_fill_in_rest;
10848 }
10849 }
10850 /* Ok if we reach here we must build one */
10851 sctp_alloc_a_chunkcxx . . $ `usrsctplib/netinet/sctp_var.h:170:9`!(stcb, chk);
10852 if (chk == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!) {
10853 return;
10854 }
10855 asoc->fwd_tsn_cntcxx . . $ sctp_association#fwd_tsn_cnt.++;
10856 chk->copy_by_refcxx . . $ sctp_tmit_chunk#copy_by_ref. = 0;
10857 /*
10858 * We don't do the old thing here since
10859 * this is used not for on-wire but to
10860 * tell if we are sending a fwd-tsn by
10861 * the stack during output. And if its
10862 * a IFORWARD or a FORWARD it is a fwd-tsn.
10863 */
10864 chk->reccxx . . $ sctp_tmit_chunk#rec..chunk_idcxx . . $ sctp_tmit_chunk#$anonymous_type_3#chunk_id..idcxx . . $ chk_id#id. = SCTP_FORWARD_CUM_TSNcxx . . $ `usrsctplib/netinet/sctp.h:482:9`!;
10865 chk->reccxx . . $ sctp_tmit_chunk#rec..chunk_idcxx . . $ sctp_tmit_chunk#$anonymous_type_3#chunk_id..can_take_datacxx . . $ chk_id#can_take_data. = 0;
10866 chk->flagscxx . . $ sctp_tmit_chunk#flags. = 0;
10867 chk->asoccxx . . $ sctp_tmit_chunk#asoc. = asoc;
10868 chk->whoTocxx . . $ sctp_tmit_chunk#whoTo. = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!;
10869 chk->datacxx . . $ sctp_tmit_chunk#data. = sctp_get_mbuf_for_msgcxx . . $ sctp_get_mbuf_for_msg(c7c30fc329598377).(MCLBYTEScxx . . $ `usrsctplib/user_mbuf.h:51:9`!, 0, M_NOWAITcxx . . $ `usrsctplib/user_malloc.h:60:9`!, 1, MT_DATAcxx . . $ `usrsctplib/user_mbuf.h:289:9`!);
10870 if (chk->datacxx . . $ sctp_tmit_chunk#data. == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!) {
10871 sctp_free_a_chunkcxx . . $ `usrsctplib/netinet/sctp_var.h:144:9`!(stcb, chk, SCTP_SO_NOT_LOCKEDcxx . . $ `usrsctplib/netinet/sctp_constants.h:964:9`!);
10872 return;
10873 }
10874 SCTP_BUF_RESV_UFcxx . . $ `usrsctplib/netinet/sctp_os_userspace.h:793:9`!(chk->data, SCTP_MIN_OVERHEADcxx . . $ `usrsctplib/netinet/sctp_header.h:561:9`!);
10875 chk->sentcxx . . $ sctp_tmit_chunk#sent. = SCTP_DATAGRAM_UNSENTcxx . . $ `usrsctplib/netinet/sctp_constants.h:353:9`!;
10876 chk->snd_countcxx . . $ sctp_tmit_chunk#snd_count. = 0;
10877 TAILQ_INSERT_TAILcxx . . $ `<external>/2546723208511035544/queue.h:402:9`!(&asoc->control_send_queue, chk, sctp_next);
10878 asoc->ctrl_queue_cntcxx . . $ sctp_association#ctrl_queue_cnt.++;
10879 sctp_fill_in_rest:
10880 /*-
10881 * Here we go through and fill out the part that deals with
10882 * stream/seq of the ones we skip.
10883 */
10884 SCTP_BUF_LENcxx . . $ `usrsctplib/netinet/sctp_os_userspace.h:790:9`!(chk->data) = 0;
10885 TAILQ_FOREACHcxx . . $ `<external>/2546723208511035544/queue.h:435:9`!(at, &asoc->sent_queue, sctp_next) {
10886 if ((at->sentcxx . . $ sctp_tmit_chunk#sent. != SCTP_FORWARD_TSN_SKIPcxx . . $ `usrsctplib/netinet/sctp_constants.h:362:9`!) &&
10887 (at->sentcxx . . $ sctp_tmit_chunk#sent. != SCTP_DATAGRAM_NR_ACKEDcxx . . $ `usrsctplib/netinet/sctp_constants.h:363:9`!)) {
10888 /* no more to look at */
10889 break;
10890 }
10891 if (!asoc->idata_supportedcxx . . $ sctp_association#idata_supported. && (at->reccxx . . $ sctp_tmit_chunk#rec..datacxx . . $ sctp_tmit_chunk#$anonymous_type_3#data..rcv_flagscxx . . $ sctp_data_chunkrec#rcv_flags. & SCTP_DATA_UNORDEREDcxx . . $ `usrsctplib/netinet/sctp.h:510:9`!)) {
10892 /* We don't report these */
10893 continue;
10894 }
10895 cnt_of_skipped++;
10896 }
10897 if (asoc->idata_supportedcxx . . $ sctp_association#idata_supported.) {
10898 space_needed = (sizeof(struct sctp_forward_tsn_chunkcxx . . $ sctp_forward_tsn_chunk#) +
10899 (cnt_of_skipped * sizeof(struct sctp_strseq_midcxx . . $ sctp_strseq_mid#)));
10900 } else {
10901 space_needed = (sizeof(struct sctp_forward_tsn_chunkcxx . . $ sctp_forward_tsn_chunk#) +
10902 (cnt_of_skipped * sizeof(struct sctp_strseqcxx . . $ sctp_strseq#)));
10903 }
10904 cnt_of_space = (unsigned int)M_TRAILINGSPACEcxx . . $ `usrsctplib/user_mbuf.h:355:9`!(chk->data);
10905
10906 if (stcb->sctp_epcxx . . $ sctp_tcb#sctp_ep.->sctp_flagscxx . . $ sctp_inpcb#sctp_flags. & SCTP_PCB_FLAGS_BOUND_V6cxx . . $ `usrsctplib/netinet/sctp.h:539:9`!) {
10907 ovh = SCTP_MIN_OVERHEADcxx . . $ `usrsctplib/netinet/sctp_header.h:561:9`!;
10908 } else {
10909 ovh = SCTP_MIN_V4_OVERHEADcxx . . $ `usrsctplib/netinet/sctp_header.h:585:9`!;
10910 }
10911 if (cnt_of_space > (asoc->smallest_mtucxx . . $ sctp_association#smallest_mtu. - ovh)) {
10912 /* trim to a mtu size */
10913 cnt_of_space = asoc->smallest_mtucxx . . $ sctp_association#smallest_mtu. - ovh;
10914 }
10915 if (SCTP_BASE_SYSCTLcxx . . $ `usrsctplib/netinet/sctp_os_userspace.h:579:9`!(sctp_logging_level) & SCTP_LOG_TRY_ADVANCEcxx . . $ `usrsctplib/netinet/sctp.h:664:9`!) {
10916 sctp_misc_intscxx . . $ sctp_misc_ints(da1ccf5149f5690e).(SCTP_FWD_TSN_CHECKcxx . . $ `usrsctplib/netinet/sctp_constants.h:232:9`!,
10917 0xff, 0, cnt_of_skipped,
10918 asoc->advanced_peer_ack_pointcxx . . $ sctp_association#advanced_peer_ack_point.);
10919 }
10920 advance_peer_ack_point = asoc->advanced_peer_ack_pointcxx . . $ sctp_association#advanced_peer_ack_point.;
10921 if (cnt_of_space < space_needed) {
10922 /*-
10923 * ok we must trim down the chunk by lowering the
10924 * advance peer ack point.
10925 */
10926 if (SCTP_BASE_SYSCTLcxx . . $ `usrsctplib/netinet/sctp_os_userspace.h:579:9`!(sctp_logging_level) & SCTP_LOG_TRY_ADVANCEcxx . . $ `usrsctplib/netinet/sctp.h:664:9`!) {
10927 sctp_misc_intscxx . . $ sctp_misc_ints(da1ccf5149f5690e).(SCTP_FWD_TSN_CHECKcxx . . $ `usrsctplib/netinet/sctp_constants.h:232:9`!,
10928 0xff, 0xff, cnt_of_space,
10929 space_needed);
10930 }
10931 cnt_of_skipped = cnt_of_space - sizeof(struct sctp_forward_tsn_chunkcxx . . $ sctp_forward_tsn_chunk#);
10932 if (asoc->idata_supportedcxx . . $ sctp_association#idata_supported.) {
10933 cnt_of_skipped /= sizeof(struct sctp_strseq_midcxx . . $ sctp_strseq_mid#);
10934 } else {
10935 cnt_of_skipped /= sizeof(struct sctp_strseqcxx . . $ sctp_strseq#);
10936 }
10937 /*-
10938 * Go through and find the TSN that will be the one
10939 * we report.
10940 */
10941 at = TAILQ_FIRSTcxx . . $ `<external>/2546723208511035544/queue.h:458:9`!(&asoc->sent_queue);
10942 if (at != NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!) {
10943 for (i = 0; i < cnt_of_skipped; i++) {
10944 tp1 = TAILQ_NEXTcxx . . $ `<external>/2546723208511035544/queue.h:459:9`!(at, sctp_next);
10945 if (tp1 == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!) {
10946 break;
10947 }
10948 at = tp1;
10949 }
10950 }
10951 if (at && SCTP_BASE_SYSCTLcxx . . $ `usrsctplib/netinet/sctp_os_userspace.h:579:9`!(sctp_logging_level) & SCTP_LOG_TRY_ADVANCEcxx . . $ `usrsctplib/netinet/sctp.h:664:9`!) {
10952 sctp_misc_intscxx . . $ sctp_misc_ints(da1ccf5149f5690e).(SCTP_FWD_TSN_CHECKcxx . . $ `usrsctplib/netinet/sctp_constants.h:232:9`!,
10953 0xff, cnt_of_skipped, at->reccxx . . $ sctp_tmit_chunk#rec..datacxx . . $ sctp_tmit_chunk#$anonymous_type_3#data..tsncxx . . $ sctp_data_chunkrec#tsn.,
10954 asoc->advanced_peer_ack_pointcxx . . $ sctp_association#advanced_peer_ack_point.);
10955 }
10956 last = at;
10957 /*-
10958 * last now points to last one I can report, update
10959 * peer ack point
10960 */
10961 if (last) {
10962 advance_peer_ack_point = last->reccxx . . $ sctp_tmit_chunk#rec..datacxx . . $ sctp_tmit_chunk#$anonymous_type_3#data..tsncxx . . $ sctp_data_chunkrec#tsn.;
10963 }
10964 if (asoc->idata_supportedcxx . . $ sctp_association#idata_supported.) {
10965 space_needed = sizeof(struct sctp_forward_tsn_chunkcxx . . $ sctp_forward_tsn_chunk#) +
10966 cnt_of_skipped * sizeof(struct sctp_strseq_midcxx . . $ sctp_strseq_mid#);
10967 } else {
10968 space_needed = sizeof(struct sctp_forward_tsn_chunkcxx . . $ sctp_forward_tsn_chunk#) +
10969 cnt_of_skipped * sizeof(struct sctp_strseqcxx . . $ sctp_strseq#);
10970 }
10971 }
10972 chk->send_sizecxx . . $ sctp_tmit_chunk#send_size. = space_needed;
10973 /* Setup the chunk */
10974 fwdtsn = mtodcxx . . $ `usrsctplib/user_mbuf.h:96:9`!(chk->data, struct sctp_forward_tsn_chunk *);
10975 fwdtsn->chcxx . . $ sctp_forward_tsn_chunk#ch..chunk_lengthcxx . . $ sctp_chunkhdr#chunk_length. = htonscxx . . $ htons(a18c05e4017afb3d).(chk->send_sizecxx . . $ sctp_tmit_chunk#send_size.);
10976 fwdtsn->chcxx . . $ sctp_forward_tsn_chunk#ch..chunk_flagscxx . . $ sctp_chunkhdr#chunk_flags. = 0;
10977 if (asoc->idata_supportedcxx . . $ sctp_association#idata_supported.) {
10978 fwdtsn->chcxx . . $ sctp_forward_tsn_chunk#ch..chunk_typecxx . . $ sctp_chunkhdr#chunk_type. = SCTP_IFORWARD_CUM_TSNcxx . . $ `usrsctplib/netinet/sctp.h:485:9`!;
10979 } else {
10980 fwdtsn->chcxx . . $ sctp_forward_tsn_chunk#ch..chunk_typecxx . . $ sctp_chunkhdr#chunk_type. = SCTP_FORWARD_CUM_TSNcxx . . $ `usrsctplib/netinet/sctp.h:482:9`!;
10981 }
10982 fwdtsn->new_cumulative_tsncxx . . $ sctp_forward_tsn_chunk#new_cumulative_tsn. = htonlcxx . . $ htonl(2141b656ce2cc063).(advance_peer_ack_point);
10983 SCTP_BUF_LENcxx . . $ `usrsctplib/netinet/sctp_os_userspace.h:790:9`!(chk->data) = chk->send_sizecxx . . $ sctp_tmit_chunk#send_size.;
10984 fwdtsn++;
10985 /*-
10986 * Move pointer to after the fwdtsn and transfer to the
10987 * strseq pointer.
10988 */
10989 if (asoc->idata_supportedcxx . . $ sctp_association#idata_supported.) {
10990 strseq_m = (struct sctp_strseq_midcxx . . $ sctp_strseq_mid# *)fwdtsn;
10991 strseq = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!;
10992 } else {
10993 strseq = (struct sctp_strseqcxx . . $ sctp_strseq# *)fwdtsn;
10994 strseq_m = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!;
10995 }
10996 /*-
10997 * Now populate the strseq list. This is done blindly
10998 * without pulling out duplicate stream info. This is
10999 * inefficent but won't harm the process since the peer will
11000 * look at these in sequence and will thus release anything.
11001 * It could mean we exceed the PMTU and chop off some that
11002 * we could have included.. but this is unlikely (aka 1432/4
11003 * would mean 300+ stream seq's would have to be reported in
11004 * one FWD-TSN. With a bit of work we can later FIX this to
11005 * optimize and pull out duplicates.. but it does add more
11006 * overhead. So for now... not!
11007 */
11008 i = 0;
11009 TAILQ_FOREACHcxx . . $ `<external>/2546723208511035544/queue.h:435:9`!(at, &asoc->sent_queue, sctp_next) {
11010 if (i >= cnt_of_skipped) {
11011 break;
11012 }
11013 if (!asoc->idata_supportedcxx . . $ sctp_association#idata_supported. && (at->reccxx . . $ sctp_tmit_chunk#rec..datacxx . . $ sctp_tmit_chunk#$anonymous_type_3#data..rcv_flagscxx . . $ sctp_data_chunkrec#rcv_flags. & SCTP_DATA_UNORDEREDcxx . . $ `usrsctplib/netinet/sctp.h:510:9`!)) {
11014 /* We don't report these */
11015 continue;
11016 }
11017 if (at->reccxx . . $ sctp_tmit_chunk#rec..datacxx . . $ sctp_tmit_chunk#$anonymous_type_3#data..tsncxx . . $ sctp_data_chunkrec#tsn. == advance_peer_ack_point) {
11018 at->reccxx . . $ sctp_tmit_chunk#rec..datacxx . . $ sctp_tmit_chunk#$anonymous_type_3#data..fwd_tsn_cntcxx . . $ sctp_data_chunkrec#fwd_tsn_cnt. = 0;
11019 }
11020 if (asoc->idata_supportedcxx . . $ sctp_association#idata_supported.) {
11021 strseq_m->sidcxx . . $ sctp_strseq_mid#sid. = htonscxx . . $ htons(a18c05e4017afb3d).(at->reccxx . . $ sctp_tmit_chunk#rec..datacxx . . $ sctp_tmit_chunk#$anonymous_type_3#data..sidcxx . . $ sctp_data_chunkrec#sid.);
11022 if (at->reccxx . . $ sctp_tmit_chunk#rec..datacxx . . $ sctp_tmit_chunk#$anonymous_type_3#data..rcv_flagscxx . . $ sctp_data_chunkrec#rcv_flags. & SCTP_DATA_UNORDEREDcxx . . $ `usrsctplib/netinet/sctp.h:510:9`!) {
11023 strseq_m->flagscxx . . $ sctp_strseq_mid#flags. = htonscxx . . $ htons(a18c05e4017afb3d).(PR_SCTP_UNORDERED_FLAGcxx . . $ `usrsctplib/netinet/sctp_constants.h:348:9`!);
11024 } else {
11025 strseq_m->flagscxx . . $ sctp_strseq_mid#flags. = 0;
11026 }
11027 strseq_m->midcxx . . $ sctp_strseq_mid#mid. = htonlcxx . . $ htonl(2141b656ce2cc063).(at->reccxx . . $ sctp_tmit_chunk#rec..datacxx . . $ sctp_tmit_chunk#$anonymous_type_3#data..midcxx . . $ sctp_data_chunkrec#mid.);
11028 strseq_m++;
11029 } else {
11030 strseq->sidcxx . . $ sctp_strseq#sid. = htonscxx . . $ htons(a18c05e4017afb3d).(at->reccxx . . $ sctp_tmit_chunk#rec..datacxx . . $ sctp_tmit_chunk#$anonymous_type_3#data..sidcxx . . $ sctp_data_chunkrec#sid.);
11031 strseq->ssncxx . . $ sctp_strseq#ssn. = htonscxx . . $ htons(a18c05e4017afb3d).((uint16_tcxx . . $ uint16_t#)at->reccxx . . $ sctp_tmit_chunk#rec..datacxx . . $ sctp_tmit_chunk#$anonymous_type_3#data..midcxx . . $ sctp_data_chunkrec#mid.);
11032 strseq++;
11033 }
11034 i++;
11035 }
11036 return;
11037 }
11038
11039 void
11040 sctp_send_sackcxx . . $ sctp_send_sack(309e9a20a883d7fc).(struct sctp_tcbcxx . . $ sctp_tcb# *stcb, int so_locked)
11041 {
11042 /*-
11043 * Queue up a SACK or NR-SACK in the control queue.
11044 * We must first check to see if a SACK or NR-SACK is
11045 * somehow on the control queue.
11046 * If so, we will take and and remove the old one.
11047 */
11048 struct sctp_associationcxx . . $ sctp_association# *asoc;
11049 struct sctp_tmit_chunkcxx . . $ sctp_tmit_chunk# *chk, *a_chk;
11050 struct sctp_sack_chunkcxx . . $ sctp_sack_chunk# *sack;
11051 struct sctp_nr_sack_chunkcxx . . $ sctp_nr_sack_chunk# *nr_sack;
11052 struct sctp_gap_ack_blockcxx . . $ sctp_gap_ack_block# *gap_descriptor;
11053 const struct sack_trackcxx . . $ sack_track# *selector;
11054 int mergeable = 0;
11055 int offset;
11056 caddr_tcxx . . $ caddr_t# limit;
11057 uint32_tcxx . . $ uint32_t# *dup;
11058 int limit_reached = 0;
11059 unsigned int i, siz, j;
11060 unsigned int num_gap_blocks = 0, num_nr_gap_blocks = 0, space;
11061 int num_dups = 0;
11062 int space_req;
11063 uint32_tcxx . . $ uint32_t# highest_tsn;
11064 uint8_tcxx . . $ uint8_t# flags;
11065 uint8_tcxx . . $ uint8_t# type;
11066 uint8_tcxx . . $ uint8_t# tsn_map;
11067
11068 if (stcb->asoccxx . . $ sctp_tcb#asoc..nrsack_supportedcxx . . $ sctp_association#nrsack_supported. == 1) {
11069 type = SCTP_NR_SELECTIVE_ACKcxx . . $ `usrsctplib/netinet/sctp.h:467:9`!;
11070 } else {
11071 type = SCTP_SELECTIVE_ACKcxx . . $ `usrsctplib/netinet/sctp.h:452:9`!;
11072 }
11073 a_chk = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!;
11074 asoc = &stcb->asoccxx . . $ sctp_tcb#asoc.;
11075 SCTP_TCB_LOCK_ASSERTcxx . . $ `usrsctplib/netinet/sctp_process_lock.h:478:9`!(stcb);
11076 if (asoc->last_data_chunk_fromcxx . . $ sctp_association#last_data_chunk_from. == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!) {
11077 /* Hmm we never received anything */
11078 return;
11079 }
11080 sctp_slide_mapping_arrayscxx . . $ sctp_slide_mapping_arrays(5e56bbb8005ef9b0).(stcb);
11081 sctp_set_rwndcxx . . $ sctp_set_rwnd(3638db9184331deb).(stcb, asoc);
11082 TAILQ_FOREACHcxx . . $ `<external>/2546723208511035544/queue.h:435:9`!(chk, &asoc->control_send_queue, sctp_next) {
11083 if (chk->reccxx . . $ sctp_tmit_chunk#rec..chunk_idcxx . . $ sctp_tmit_chunk#$anonymous_type_3#chunk_id..idcxx . . $ chk_id#id. == type) {
11084 /* Hmm, found a sack already on queue, remove it */
11085 TAILQ_REMOVEcxx . . $ `<external>/2546723208511035544/queue.h:426:9`!(&asoc->control_send_queue, chk, sctp_next);
11086 asoc->ctrl_queue_cntcxx . . $ sctp_association#ctrl_queue_cnt.--;
11087 a_chk = chk;
11088 if (a_chk->datacxx . . $ sctp_tmit_chunk#data.) {
11089 sctp_m_freemcxx . . $ `usrsctplib/netinet/sctputil.h:57:9`!(a_chk->datacxx . . $ sctp_tmit_chunk#data.);
11090 a_chk->datacxx . . $ sctp_tmit_chunk#data. = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!;
11091 }
11092 if (a_chk->whoTocxx . . $ sctp_tmit_chunk#whoTo.) {
11093 sctp_free_remote_addrcxx . . $ `usrsctplib/netinet/sctp_var.h:229:9`!(a_chk->whoTo);
11094 a_chk->whoTocxx . . $ sctp_tmit_chunk#whoTo. = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!;
11095 }
11096 break;
11097 }
11098 }
11099 if (a_chk == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!) {
11100 sctp_alloc_a_chunkcxx . . $ `usrsctplib/netinet/sctp_var.h:170:9`!(stcb, a_chk);
11101 if (a_chk == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!) {
11102 /* No memory so we drop the idea, and set a timer */
11103 if (stcb->asoccxx . . $ sctp_tcb#asoc..delayed_ackcxx . . $ sctp_association#delayed_ack.) {
11104 sctp_timer_stopcxx . . $ sctp_timer_stop(dc50a43aa5f83109).(SCTP_TIMER_TYPE_RECVcxx . . $ `usrsctplib/netinet/sctp_constants.h:539:9`!,
11105 stcb->sctp_epcxx . . $ sctp_tcb#sctp_ep., stcb, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!,
11106 SCTP_FROM_SCTP_OUTPUTcxx . . $ `usrsctplib/netinet/sctp_constants.h:767:9`! + SCTP_LOC_4cxx . . $ `usrsctplib/netinet/sctp_constants.h:776:9`!);
11107 sctp_timer_startcxx . . $ sctp_timer_start(73c9263bfa4b937d).(SCTP_TIMER_TYPE_RECVcxx . . $ `usrsctplib/netinet/sctp_constants.h:539:9`!,
11108 stcb->sctp_epcxx . . $ sctp_tcb#sctp_ep., stcb, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!);
11109 } else {
11110 stcb->asoccxx . . $ sctp_tcb#asoc..send_sackcxx . . $ sctp_association#send_sack. = 1;
11111 }
11112 return;
11113 }
11114 a_chk->copy_by_refcxx . . $ sctp_tmit_chunk#copy_by_ref. = 0;
11115 a_chk->reccxx . . $ sctp_tmit_chunk#rec..chunk_idcxx . . $ sctp_tmit_chunk#$anonymous_type_3#chunk_id..idcxx . . $ chk_id#id. = type;
11116 a_chk->reccxx . . $ sctp_tmit_chunk#rec..chunk_idcxx . . $ sctp_tmit_chunk#$anonymous_type_3#chunk_id..can_take_datacxx . . $ chk_id#can_take_data. = 1;
11117 }
11118 /* Clear our pkt counts */
11119 asoc->data_pkts_seencxx . . $ sctp_association#data_pkts_seen. = 0;
11120
11121 a_chk->flagscxx . . $ sctp_tmit_chunk#flags. = 0;
11122 a_chk->asoccxx . . $ sctp_tmit_chunk#asoc. = asoc;
11123 a_chk->snd_countcxx . . $ sctp_tmit_chunk#snd_count. = 0;
11124 a_chk->send_sizecxx . . $ sctp_tmit_chunk#send_size. = 0; /* fill in later */
11125 a_chk->sentcxx . . $ sctp_tmit_chunk#sent. = SCTP_DATAGRAM_UNSENTcxx . . $ `usrsctplib/netinet/sctp_constants.h:353:9`!;
11126 a_chk->whoTocxx . . $ sctp_tmit_chunk#whoTo. = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!;
11127
11128 if (!(asoc->last_data_chunk_fromcxx . . $ sctp_association#last_data_chunk_from.->dest_statecxx . . $ sctp_nets#dest_state. & SCTP_ADDR_REACHABLEcxx . . $ `usrsctplib/netinet/sctp_constants.h:486:9`!)) {
11129 /*-
11130 * Ok, the destination for the SACK is unreachable, lets see if
11131 * we can select an alternate to asoc->last_data_chunk_from
11132 */
11133 a_chk->whoTocxx . . $ sctp_tmit_chunk#whoTo. = sctp_find_alternate_netcxx . . $ sctp_find_alternate_net(654363bae23dcddb).(stcb, asoc->last_data_chunk_fromcxx . . $ sctp_association#last_data_chunk_from., 0);
11134 if (a_chk->whoTocxx . . $ sctp_tmit_chunk#whoTo. == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!) {
11135 /* Nope, no alternate */
11136 a_chk->whoTocxx . . $ sctp_tmit_chunk#whoTo. = asoc->last_data_chunk_fromcxx . . $ sctp_association#last_data_chunk_from.;
11137 }
11138 } else {
11139 a_chk->whoTocxx . . $ sctp_tmit_chunk#whoTo. = asoc->last_data_chunk_fromcxx . . $ sctp_association#last_data_chunk_from.;
11140 }
11141 if (a_chk->whoTocxx . . $ sctp_tmit_chunk#whoTo.) {
11142 atomic_add_intcxx . . $ `usrsctplib/user_atomic.h:94:9`!(&a_chk->whoTo->ref_count, 1);
11143 }
11144 if (SCTP_TSN_GTcxx . . $ `usrsctplib/netinet/sctp_constants.h:893:9`!(asoc->highest_tsn_inside_map, asoc->highest_tsn_inside_nr_map)) {
11145 highest_tsn = asoc->highest_tsn_inside_mapcxx . . $ sctp_association#highest_tsn_inside_map.;
11146 } else {
11147 highest_tsn = asoc->highest_tsn_inside_nr_mapcxx . . $ sctp_association#highest_tsn_inside_nr_map.;
11148 }
11149 if (highest_tsn == asoc->cumulative_tsncxx . . $ sctp_association#cumulative_tsn.) {
11150 /* no gaps */
11151 if (type == SCTP_SELECTIVE_ACKcxx . . $ `usrsctplib/netinet/sctp.h:452:9`!) {
11152 space_req = sizeof(struct sctp_sack_chunkcxx . . $ sctp_sack_chunk#);
11153 } else {
11154 space_req = sizeof(struct sctp_nr_sack_chunkcxx . . $ sctp_nr_sack_chunk#);
11155 }
11156 } else {
11157 /* gaps get a cluster */
11158 space_req = MCLBYTEScxx . . $ `usrsctplib/user_mbuf.h:51:9`!;
11159 }
11160 /* Ok now lets formulate a MBUF with our sack */
11161 a_chk->datacxx . . $ sctp_tmit_chunk#data. = sctp_get_mbuf_for_msgcxx . . $ sctp_get_mbuf_for_msg(c7c30fc329598377).(space_req, 0, M_NOWAITcxx . . $ `usrsctplib/user_malloc.h:60:9`!, 1, MT_DATAcxx . . $ `usrsctplib/user_mbuf.h:289:9`!);
11162 if ((a_chk->datacxx . . $ sctp_tmit_chunk#data. == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!) ||
11163 (a_chk->whoTocxx . . $ sctp_tmit_chunk#whoTo. == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!)) {
11164 /* rats, no mbuf memory */
11165 if (a_chk->datacxx . . $ sctp_tmit_chunk#data.) {
11166 /* was a problem with the destination */
11167 sctp_m_freemcxx . . $ `usrsctplib/netinet/sctputil.h:57:9`!(a_chk->datacxx . . $ sctp_tmit_chunk#data.);
11168 a_chk->datacxx . . $ sctp_tmit_chunk#data. = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!;
11169 }
11170 sctp_free_a_chunkcxx . . $ `usrsctplib/netinet/sctp_var.h:144:9`!(stcb, a_chk, so_locked);
11171 /* sa_ignore NO_NULL_CHK */
11172 if (stcb->asoccxx . . $ sctp_tcb#asoc..delayed_ackcxx . . $ sctp_association#delayed_ack.) {
11173 sctp_timer_stopcxx . . $ sctp_timer_stop(dc50a43aa5f83109).(SCTP_TIMER_TYPE_RECVcxx . . $ `usrsctplib/netinet/sctp_constants.h:539:9`!,
11174 stcb->sctp_epcxx . . $ sctp_tcb#sctp_ep., stcb, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!,
11175 SCTP_FROM_SCTP_OUTPUTcxx . . $ `usrsctplib/netinet/sctp_constants.h:767:9`! + SCTP_LOC_5cxx . . $ `usrsctplib/netinet/sctp_constants.h:777:9`!);
11176 sctp_timer_startcxx . . $ sctp_timer_start(73c9263bfa4b937d).(SCTP_TIMER_TYPE_RECVcxx . . $ `usrsctplib/netinet/sctp_constants.h:539:9`!,
11177 stcb->sctp_epcxx . . $ sctp_tcb#sctp_ep., stcb, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!);
11178 } else {
11179 stcb->asoccxx . . $ sctp_tcb#asoc..send_sackcxx . . $ sctp_association#send_sack. = 1;
11180 }
11181 return;
11182 }
11183 /* ok, lets go through and fill it in */
11184 SCTP_BUF_RESV_UFcxx . . $ `usrsctplib/netinet/sctp_os_userspace.h:793:9`!(a_chk->data, SCTP_MIN_OVERHEADcxx . . $ `usrsctplib/netinet/sctp_header.h:561:9`!);
11185 space = (unsigned int)M_TRAILINGSPACEcxx . . $ `usrsctplib/user_mbuf.h:355:9`!(a_chk->data);
11186 if (space > (a_chk->whoTocxx . . $ sctp_tmit_chunk#whoTo.->mtucxx . . $ sctp_nets#mtu. - SCTP_MIN_OVERHEADcxx . . $ `usrsctplib/netinet/sctp_header.h:561:9`!)) {
11187 space = (a_chk->whoTocxx . . $ sctp_tmit_chunk#whoTo.->mtucxx . . $ sctp_nets#mtu. - SCTP_MIN_OVERHEADcxx . . $ `usrsctplib/netinet/sctp_header.h:561:9`!);
11188 }
11189 limit = mtodcxx . . $ `usrsctplib/user_mbuf.h:96:9`!(a_chk->data, caddr_t);
11190 limit += space;
11191
11192 flags = 0;
11193
11194 if ((asoc->sctp_cmt_on_offcxx . . $ sctp_association#sctp_cmt_on_off. > 0) &&
11195 SCTP_BASE_SYSCTLcxx . . $ `usrsctplib/netinet/sctp_os_userspace.h:579:9`!(sctp_cmt_use_dac)) {
11196 /*-
11197 * CMT DAC algorithm: If 2 (i.e., 0x10) packets have been
11198 * received, then set high bit to 1, else 0. Reset
11199 * pkts_rcvd.
11200 */
11201 flags |= (asoc->cmt_dac_pkts_rcvdcxx . . $ sctp_association#cmt_dac_pkts_rcvd. << 6);
11202 asoc->cmt_dac_pkts_rcvdcxx . . $ sctp_association#cmt_dac_pkts_rcvd. = 0;
11203 }
11204 #ifdef SCTP_ASOCLOG_OF_TSNS
11205 stcb->asoc.cumack_logsnt[stcb->asoc.cumack_log_atsnt] = asoc->cumulative_tsn;
11206 stcb->asoc.cumack_log_atsnt++;
11207 if (stcb->asoc.cumack_log_atsnt >= SCTP_TSN_LOG_SIZE) {
11208 stcb->asoc.cumack_log_atsnt = 0;
11209 }
11210 #endif
11211 /* reset the readers interpretation */
11212 stcb->freed_by_sorcv_sincelastcxx . . $ sctp_tcb#freed_by_sorcv_sincelast. = 0;
11213
11214 if (type == SCTP_SELECTIVE_ACKcxx . . $ `usrsctplib/netinet/sctp.h:452:9`!) {
11215 sack = mtodcxx . . $ `usrsctplib/user_mbuf.h:96:9`!(a_chk->data, struct sctp_sack_chunk *);
11216 nr_sack = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!;
11217 gap_descriptor = (struct sctp_gap_ack_blockcxx . . $ sctp_gap_ack_block# *)((caddr_tcxx . . $ caddr_t#)sack + sizeof(struct sctp_sack_chunkcxx . . $ sctp_sack_chunk#));
11218 if (highest_tsn > asoc->mapping_array_base_tsncxx . . $ sctp_association#mapping_array_base_tsn.) {
11219 siz = (((highest_tsn - asoc->mapping_array_base_tsncxx . . $ sctp_association#mapping_array_base_tsn.) + 1) + 7) / 8;
11220 } else {
11221 siz = (((MAX_TSNcxx . . $ `usrsctplib/netinet/sctp_constants.h:315:9`! - asoc->mapping_array_base_tsncxx . . $ sctp_association#mapping_array_base_tsn.) + 1) + highest_tsn + 7) / 8;
11222 }
11223 } else {
11224 sack = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!;
11225 nr_sack = mtodcxx . . $ `usrsctplib/user_mbuf.h:96:9`!(a_chk->data, struct sctp_nr_sack_chunk *);
11226 gap_descriptor = (struct sctp_gap_ack_blockcxx . . $ sctp_gap_ack_block# *)((caddr_tcxx . . $ caddr_t#)nr_sack + sizeof(struct sctp_nr_sack_chunkcxx . . $ sctp_nr_sack_chunk#));
11227 if (asoc->highest_tsn_inside_mapcxx . . $ sctp_association#highest_tsn_inside_map. > asoc->mapping_array_base_tsncxx . . $ sctp_association#mapping_array_base_tsn.) {
11228 siz = (((asoc->highest_tsn_inside_mapcxx . . $ sctp_association#highest_tsn_inside_map. - asoc->mapping_array_base_tsncxx . . $ sctp_association#mapping_array_base_tsn.) + 1) + 7) / 8;
11229 } else {
11230 siz = (((MAX_TSNcxx . . $ `usrsctplib/netinet/sctp_constants.h:315:9`! - asoc->mapping_array_base_tsncxx . . $ sctp_association#mapping_array_base_tsn.) + 1) + asoc->highest_tsn_inside_mapcxx . . $ sctp_association#highest_tsn_inside_map. + 7) / 8;
11231 }
11232 }
11233
11234 if (SCTP_TSN_GTcxx . . $ `usrsctplib/netinet/sctp_constants.h:893:9`!(asoc->mapping_array_base_tsn, asoc->cumulative_tsn)) {
11235 offset = 1;
11236 } else {
11237 offset = asoc->mapping_array_base_tsncxx . . $ sctp_association#mapping_array_base_tsn. - asoc->cumulative_tsncxx . . $ sctp_association#cumulative_tsn.;
11238 }
11239 if (((type == SCTP_SELECTIVE_ACKcxx . . $ `usrsctplib/netinet/sctp.h:452:9`!) &&
11240 SCTP_TSN_GTcxx . . $ `usrsctplib/netinet/sctp_constants.h:893:9`!(highest_tsn, asoc->cumulative_tsn)) ||
11241 ((type == SCTP_NR_SELECTIVE_ACKcxx . . $ `usrsctplib/netinet/sctp.h:467:9`!) &&
11242 SCTP_TSN_GTcxx . . $ `usrsctplib/netinet/sctp_constants.h:893:9`!(asoc->highest_tsn_inside_map, asoc->cumulative_tsn))) {
11243 /* we have a gap .. maybe */
11244 for (i = 0; i < siz; i++) {
11245 tsn_map = asoc->mapping_arraycxx . . $ sctp_association#mapping_array.[i];
11246 if (type == SCTP_SELECTIVE_ACKcxx . . $ `usrsctplib/netinet/sctp.h:452:9`!) {
11247 tsn_map |= asoc->nr_mapping_arraycxx . . $ sctp_association#nr_mapping_array.[i];
11248 }
11249 if (i == 0) {
11250 /*
11251 * Clear all bits corresponding to TSNs
11252 * smaller or equal to the cumulative TSN.
11253 */
11254 tsn_map &= (~0U << (1 - offset));
11255 }
11256 selector = &sack_arraycxx . . $ sack_array.[tsn_map];
11257 if (mergeable && selector->right_edgecxx . . $ sack_track#right_edge.) {
11258 /*
11259 * Backup, left and right edges were ok to
11260 * merge.
11261 */
11262 num_gap_blocks--;
11263 gap_descriptor--;
11264 }
11265 if (selector->num_entriescxx . . $ sack_track#num_entries. == 0)
11266 mergeable = 0;
11267 else {
11268 for (j = 0; j < selector->num_entriescxx . . $ sack_track#num_entries.; j++) {
11269 if (mergeable && selector->right_edgecxx . . $ sack_track#right_edge.) {
11270 /*
11271 * do a merge by NOT setting
11272 * the left side
11273 */
11274 mergeable = 0;
11275 } else {
11276 /*
11277 * no merge, set the left
11278 * side
11279 */
11280 mergeable = 0;
11281 gap_descriptor->startcxx . . $ sctp_gap_ack_block#start. = htonscxx . . $ htons(a18c05e4017afb3d).((selector->gapscxx . . $ sack_track#gaps.[j].startcxx . . $ sctp_gap_ack_block#start. + offset));
11282 }
11283 gap_descriptor->endcxx . . $ sctp_gap_ack_block#end. = htonscxx . . $ htons(a18c05e4017afb3d).((selector->gapscxx . . $ sack_track#gaps.[j].endcxx . . $ sctp_gap_ack_block#end. + offset));
11284 num_gap_blocks++;
11285 gap_descriptor++;
11286 if (((caddr_tcxx . . $ caddr_t#)gap_descriptor + sizeof(struct sctp_gap_ack_blockcxx . . $ sctp_gap_ack_block#)) > limit) {
11287 /* no more room */
11288 limit_reached = 1;
11289 break;
11290 }
11291 }
11292 if (selector->left_edgecxx . . $ sack_track#left_edge.) {
11293 mergeable = 1;
11294 }
11295 }
11296 if (limit_reached) {
11297 /* Reached the limit stop */
11298 break;
11299 }
11300 offset += 8;
11301 }
11302 }
11303 if ((type == SCTP_NR_SELECTIVE_ACKcxx . . $ `usrsctplib/netinet/sctp.h:467:9`!) &&
11304 (limit_reached == 0)) {
11305 mergeable = 0;
11306
11307 if (asoc->highest_tsn_inside_nr_mapcxx . . $ sctp_association#highest_tsn_inside_nr_map. > asoc->mapping_array_base_tsncxx . . $ sctp_association#mapping_array_base_tsn.) {
11308 siz = (((asoc->highest_tsn_inside_nr_mapcxx . . $ sctp_association#highest_tsn_inside_nr_map. - asoc->mapping_array_base_tsncxx . . $ sctp_association#mapping_array_base_tsn.) + 1) + 7) / 8;
11309 } else {
11310 siz = (((MAX_TSNcxx . . $ `usrsctplib/netinet/sctp_constants.h:315:9`! - asoc->mapping_array_base_tsncxx . . $ sctp_association#mapping_array_base_tsn.) + 1) + asoc->highest_tsn_inside_nr_mapcxx . . $ sctp_association#highest_tsn_inside_nr_map. + 7) / 8;
11311 }
11312
11313 if (SCTP_TSN_GTcxx . . $ `usrsctplib/netinet/sctp_constants.h:893:9`!(asoc->mapping_array_base_tsn, asoc->cumulative_tsn)) {
11314 offset = 1;
11315 } else {
11316 offset = asoc->mapping_array_base_tsncxx . . $ sctp_association#mapping_array_base_tsn. - asoc->cumulative_tsncxx . . $ sctp_association#cumulative_tsn.;
11317 }
11318 if (SCTP_TSN_GTcxx . . $ `usrsctplib/netinet/sctp_constants.h:893:9`!(asoc->highest_tsn_inside_nr_map, asoc->cumulative_tsn)) {
11319 /* we have a gap .. maybe */
11320 for (i = 0; i < siz; i++) {
11321 tsn_map = asoc->nr_mapping_arraycxx . . $ sctp_association#nr_mapping_array.[i];
11322 if (i == 0) {
11323 /*
11324 * Clear all bits corresponding to TSNs
11325 * smaller or equal to the cumulative TSN.
11326 */
11327 tsn_map &= (~0U << (1 - offset));
11328 }
11329 selector = &sack_arraycxx . . $ sack_array.[tsn_map];
11330 if (mergeable && selector->right_edgecxx . . $ sack_track#right_edge.) {
11331 /*
11332 * Backup, left and right edges were ok to
11333 * merge.
11334 */
11335 num_nr_gap_blocks--;
11336 gap_descriptor--;
11337 }
11338 if (selector->num_entriescxx . . $ sack_track#num_entries. == 0)
11339 mergeable = 0;
11340 else {
11341 for (j = 0; j < selector->num_entriescxx . . $ sack_track#num_entries.; j++) {
11342 if (mergeable && selector->right_edgecxx . . $ sack_track#right_edge.) {
11343 /*
11344 * do a merge by NOT setting
11345 * the left side
11346 */
11347 mergeable = 0;
11348 } else {
11349 /*
11350 * no merge, set the left
11351 * side
11352 */
11353 mergeable = 0;
11354 gap_descriptor->startcxx . . $ sctp_gap_ack_block#start. = htonscxx . . $ htons(a18c05e4017afb3d).((selector->gapscxx . . $ sack_track#gaps.[j].startcxx . . $ sctp_gap_ack_block#start. + offset));
11355 }
11356 gap_descriptor->endcxx . . $ sctp_gap_ack_block#end. = htonscxx . . $ htons(a18c05e4017afb3d).((selector->gapscxx . . $ sack_track#gaps.[j].endcxx . . $ sctp_gap_ack_block#end. + offset));
11357 num_nr_gap_blocks++;
11358 gap_descriptor++;
11359 if (((caddr_tcxx . . $ caddr_t#)gap_descriptor + sizeof(struct sctp_gap_ack_blockcxx . . $ sctp_gap_ack_block#)) > limit) {
11360 /* no more room */
11361 limit_reached = 1;
11362 break;
11363 }
11364 }
11365 if (selector->left_edgecxx . . $ sack_track#left_edge.) {
11366 mergeable = 1;
11367 }
11368 }
11369 if (limit_reached) {
11370 /* Reached the limit stop */
11371 break;
11372 }
11373 offset += 8;
11374 }
11375 }
11376 }
11377 /* now we must add any dups we are going to report. */
11378 if ((limit_reached == 0) && (asoc->numduptsnscxx . . $ sctp_association#numduptsns.)) {
11379 dup = (uint32_tcxx . . $ uint32_t# *) gap_descriptor;
11380 for (i = 0; i < asoc->numduptsnscxx . . $ sctp_association#numduptsns.; i++) {
11381 *dup = htonlcxx . . $ htonl(2141b656ce2cc063).(asoc->dup_tsnscxx . . $ sctp_association#dup_tsns.[i]);
11382 dup++;
11383 num_dups++;
11384 if (((caddr_tcxx . . $ caddr_t#)dup + sizeof(uint32_tcxx . . $ uint32_t#)) > limit) {
11385 /* no more room */
11386 break;
11387 }
11388 }
11389 asoc->numduptsnscxx . . $ sctp_association#numduptsns. = 0;
11390 }
11391 /*
11392 * now that the chunk is prepared queue it to the control chunk
11393 * queue.
11394 */
11395 if (type == SCTP_SELECTIVE_ACKcxx . . $ `usrsctplib/netinet/sctp.h:452:9`!) {
11396 a_chk->send_sizecxx . . $ sctp_tmit_chunk#send_size. = (uint16_tcxx . . $ uint16_t#)(sizeof(struct sctp_sack_chunkcxx . . $ sctp_sack_chunk#) +
11397 (num_gap_blocks + num_nr_gap_blocks) * sizeof(struct sctp_gap_ack_blockcxx . . $ sctp_gap_ack_block#) +
11398 num_dups * sizeof(int32_tcxx . . $ int32_t#));
11399 SCTP_BUF_LENcxx . . $ `usrsctplib/netinet/sctp_os_userspace.h:790:9`!(a_chk->data) = a_chk->send_sizecxx . . $ sctp_tmit_chunk#send_size.;
11400 sack->sackcxx . . $ sctp_sack_chunk#sack..cum_tsn_ackcxx . . $ sctp_sack#cum_tsn_ack. = htonlcxx . . $ htonl(2141b656ce2cc063).(asoc->cumulative_tsncxx . . $ sctp_association#cumulative_tsn.);
11401 sack->sackcxx . . $ sctp_sack_chunk#sack..a_rwndcxx . . $ sctp_sack#a_rwnd. = htonlcxx . . $ htonl(2141b656ce2cc063).(asoc->my_rwndcxx . . $ sctp_association#my_rwnd.);
11402 sack->sackcxx . . $ sctp_sack_chunk#sack..num_gap_ack_blkscxx . . $ sctp_sack#num_gap_ack_blks. = htonscxx . . $ htons(a18c05e4017afb3d).(num_gap_blocks);
11403 sack->sackcxx . . $ sctp_sack_chunk#sack..num_dup_tsnscxx . . $ sctp_sack#num_dup_tsns. = htonscxx . . $ htons(a18c05e4017afb3d).(num_dups);
11404 sack->chcxx . . $ sctp_sack_chunk#ch..chunk_typecxx . . $ sctp_chunkhdr#chunk_type. = type;
11405 sack->chcxx . . $ sctp_sack_chunk#ch..chunk_flagscxx . . $ sctp_chunkhdr#chunk_flags. = flags;
11406 sack->chcxx . . $ sctp_sack_chunk#ch..chunk_lengthcxx . . $ sctp_chunkhdr#chunk_length. = htonscxx . . $ htons(a18c05e4017afb3d).(a_chk->send_sizecxx . . $ sctp_tmit_chunk#send_size.);
11407 } else {
11408 a_chk->send_sizecxx . . $ sctp_tmit_chunk#send_size. = (uint16_tcxx . . $ uint16_t#)(sizeof(struct sctp_nr_sack_chunkcxx . . $ sctp_nr_sack_chunk#) +
11409 (num_gap_blocks + num_nr_gap_blocks) * sizeof(struct sctp_gap_ack_blockcxx . . $ sctp_gap_ack_block#) +
11410 num_dups * sizeof(int32_tcxx . . $ int32_t#));
11411 SCTP_BUF_LENcxx . . $ `usrsctplib/netinet/sctp_os_userspace.h:790:9`!(a_chk->data) = a_chk->send_sizecxx . . $ sctp_tmit_chunk#send_size.;
11412 nr_sack->nr_sackcxx . . $ sctp_nr_sack_chunk#nr_sack..cum_tsn_ackcxx . . $ sctp_nr_sack#cum_tsn_ack. = htonlcxx . . $ htonl(2141b656ce2cc063).(asoc->cumulative_tsncxx . . $ sctp_association#cumulative_tsn.);
11413 nr_sack->nr_sackcxx . . $ sctp_nr_sack_chunk#nr_sack..a_rwndcxx . . $ sctp_nr_sack#a_rwnd. = htonlcxx . . $ htonl(2141b656ce2cc063).(asoc->my_rwndcxx . . $ sctp_association#my_rwnd.);
11414 nr_sack->nr_sackcxx . . $ sctp_nr_sack_chunk#nr_sack..num_gap_ack_blkscxx . . $ sctp_nr_sack#num_gap_ack_blks. = htonscxx . . $ htons(a18c05e4017afb3d).(num_gap_blocks);
11415 nr_sack->nr_sackcxx . . $ sctp_nr_sack_chunk#nr_sack..num_nr_gap_ack_blkscxx . . $ sctp_nr_sack#num_nr_gap_ack_blks. = htonscxx . . $ htons(a18c05e4017afb3d).(num_nr_gap_blocks);
11416 nr_sack->nr_sackcxx . . $ sctp_nr_sack_chunk#nr_sack..num_dup_tsnscxx . . $ sctp_nr_sack#num_dup_tsns. = htonscxx . . $ htons(a18c05e4017afb3d).(num_dups);
11417 nr_sack->nr_sackcxx . . $ sctp_nr_sack_chunk#nr_sack..reservedcxx . . $ sctp_nr_sack#reserved. = 0;
11418 nr_sack->chcxx . . $ sctp_nr_sack_chunk#ch..chunk_typecxx . . $ sctp_chunkhdr#chunk_type. = type;
11419 nr_sack->chcxx . . $ sctp_nr_sack_chunk#ch..chunk_flagscxx . . $ sctp_chunkhdr#chunk_flags. = flags;
11420 nr_sack->chcxx . . $ sctp_nr_sack_chunk#ch..chunk_lengthcxx . . $ sctp_chunkhdr#chunk_length. = htonscxx . . $ htons(a18c05e4017afb3d).(a_chk->send_sizecxx . . $ sctp_tmit_chunk#send_size.);
11421 }
11422 TAILQ_INSERT_TAILcxx . . $ `<external>/2546723208511035544/queue.h:402:9`!(&asoc->control_send_queue, a_chk, sctp_next);
11423 asoc->my_last_reported_rwndcxx . . $ sctp_association#my_last_reported_rwnd. = asoc->my_rwndcxx . . $ sctp_association#my_rwnd.;
11424 asoc->ctrl_queue_cntcxx . . $ sctp_association#ctrl_queue_cnt.++;
11425 asoc->send_sackcxx . . $ sctp_association#send_sack. = 0;
11426 SCTP_STAT_INCRcxx . . $ `./netinet/sctp_uio.h:1111:9`!(sctps_sendsacks);
11427 return;
11428 }
11429
11430 void
11431 sctp_send_abort_tcbcxx . . $ sctp_send_abort_tcb(4a13742612aee8e7).(struct sctp_tcbcxx . . $ sctp_tcb# *stcb, struct mbufcxx . . $ mbuf# *operr, int so_locked)
11432 {
11433 struct mbufcxx . . $ mbuf# *m_abort, *m, *m_last;
11434 struct mbufcxx . . $ mbuf# *m_out, *m_end = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!;
11435 struct sctp_abort_chunkcxx . . $ sctp_abort_chunk# *abort;
11436 struct sctp_auth_chunkcxx . . $ sctp_auth_chunk# *auth = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!;
11437 struct sctp_netscxx . . $ sctp_nets# *net;
11438 uint32_tcxx . . $ uint32_t# vtag;
11439 uint32_tcxx . . $ uint32_t# auth_offset = 0;
11440 int error;
11441 uint16_tcxx . . $ uint16_t# cause_len, chunk_len, padding_len;
11442
11443 #if defined(__APPLE__) && !defined(__Userspace__cxx . . $ `<built-in>:442:9`!)
11444 if (so_locked) {
11445 sctp_lock_assert(SCTP_INP_SO(stcb->sctp_ep));
11446 } else {
11447 sctp_unlock_assert(SCTP_INP_SO(stcb->sctp_ep));
11448 }
11449 #endif
11450 SCTP_TCB_LOCK_ASSERTcxx . . $ `usrsctplib/netinet/sctp_process_lock.h:478:9`!(stcb);
11451 /*-
11452 * Add an AUTH chunk, if chunk requires it and save the offset into
11453 * the chain for AUTH
11454 */
11455 if (sctp_auth_is_required_chunkcxx . . $ `usrsctplib/netinet/sctp_auth.h:105:9`!(SCTP_ABORT_ASSOCIATIONcxx . . $ `usrsctplib/netinet/sctp.h:455:9`!,
11456 stcb->asoc.peer_auth_chunks)) {
11457 m_out = sctp_add_auth_chunkcxx . . $ sctp_add_auth_chunk(c0b2bf5d35b7e5c6).(NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!, &m_end, &auth, &auth_offset,
11458 stcb, SCTP_ABORT_ASSOCIATIONcxx . . $ `usrsctplib/netinet/sctp.h:455:9`!);
11459 SCTP_STAT_INCR_COUNTER64cxx . . $ `./netinet/sctp_uio.h:1127:9`!(sctps_outcontrolchunks);
11460 } else {
11461 m_out = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!;
11462 }
11463 m_abort = sctp_get_mbuf_for_msgcxx . . $ sctp_get_mbuf_for_msg(c7c30fc329598377).(sizeof(struct sctp_abort_chunkcxx . . $ sctp_abort_chunk#), 0, M_NOWAITcxx . . $ `usrsctplib/user_malloc.h:60:9`!, 1, MT_HEADERcxx . . $ `usrsctplib/user_mbuf.h:290:9`!);
11464 if (m_abort == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!) {
11465 if (m_out) {
11466 sctp_m_freemcxx . . $ `usrsctplib/netinet/sctputil.h:57:9`!(m_out);
11467 }
11468 if (operr) {
11469 sctp_m_freemcxx . . $ `usrsctplib/netinet/sctputil.h:57:9`!(operr);
11470 }
11471 return;
11472 }
11473 /* link in any error */
11474 SCTP_BUF_NEXTcxx . . $ `usrsctplib/netinet/sctp_os_userspace.h:791:9`!(m_abort) = operr;
11475 cause_len = 0;
11476 m_last = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!;
11477 for (m = operr; m; m = SCTP_BUF_NEXTcxx . . $ `usrsctplib/netinet/sctp_os_userspace.h:791:9`!(m)) {
11478 cause_len += (uint16_tcxx . . $ uint16_t#)SCTP_BUF_LENcxx . . $ `usrsctplib/netinet/sctp_os_userspace.h:790:9`!(m);
11479 if (SCTP_BUF_NEXTcxx . . $ `usrsctplib/netinet/sctp_os_userspace.h:791:9`!(m) == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!) {
11480 m_last = m;
11481 }
11482 }
11483 SCTP_BUF_LENcxx . . $ `usrsctplib/netinet/sctp_os_userspace.h:790:9`!(m_abort) = sizeof(struct sctp_abort_chunkcxx . . $ sctp_abort_chunk#);
11484 chunk_len = (uint16_tcxx . . $ uint16_t#)sizeof(struct sctp_abort_chunkcxx . . $ sctp_abort_chunk#) + cause_len;
11485 padding_len = SCTP_SIZE32cxx . . $ `usrsctplib/netinet/sctp_constants.h:388:9`!(chunk_len) - chunk_len;
11486 if (m_out == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!) {
11487 /* NO Auth chunk prepended, so reserve space in front */
11488 SCTP_BUF_RESV_UFcxx . . $ `usrsctplib/netinet/sctp_os_userspace.h:793:9`!(m_abort, SCTP_MIN_OVERHEADcxx . . $ `usrsctplib/netinet/sctp_header.h:561:9`!);
11489 m_out = m_abort;
11490 } else {
11491 /* Put AUTH chunk at the front of the chain */
11492 SCTP_BUF_NEXTcxx . . $ `usrsctplib/netinet/sctp_os_userspace.h:791:9`!(m_end) = m_abort;
11493 }
11494 if (stcb->asoccxx . . $ sctp_tcb#asoc..alternatecxx . . $ sctp_association#alternate.) {
11495 net = stcb->asoccxx . . $ sctp_tcb#asoc..alternatecxx . . $ sctp_association#alternate.;
11496 } else {
11497 net = stcb->asoccxx . . $ sctp_tcb#asoc..primary_destinationcxx . . $ sctp_association#primary_destination.;
11498 }
11499 /* Fill in the ABORT chunk header. */
11500 abort = mtodcxx . . $ `usrsctplib/user_mbuf.h:96:9`!(m_abort, struct sctp_abort_chunk *);
11501 abort->chcxx . . $ sctp_abort_chunk#ch..chunk_typecxx . . $ sctp_chunkhdr#chunk_type. = SCTP_ABORT_ASSOCIATIONcxx . . $ `usrsctplib/netinet/sctp.h:455:9`!;
11502 if (stcb->asoccxx . . $ sctp_tcb#asoc..peer_vtagcxx . . $ sctp_association#peer_vtag. == 0) {
11503 /* This happens iff the assoc is in COOKIE-WAIT state. */
11504 vtag = stcb->asoccxx . . $ sctp_tcb#asoc..my_vtagcxx . . $ sctp_association#my_vtag.;
11505 abort->chcxx . . $ sctp_abort_chunk#ch..chunk_flagscxx . . $ sctp_chunkhdr#chunk_flags. = SCTP_HAD_NO_TCBcxx . . $ `usrsctplib/netinet/sctp.h:488:9`!;
11506 } else {
11507 vtag = stcb->asoccxx . . $ sctp_tcb#asoc..peer_vtagcxx . . $ sctp_association#peer_vtag.;
11508 abort->chcxx . . $ sctp_abort_chunk#ch..chunk_flagscxx . . $ sctp_chunkhdr#chunk_flags. = 0;
11509 }
11510 abort->chcxx . . $ sctp_abort_chunk#ch..chunk_lengthcxx . . $ sctp_chunkhdr#chunk_length. = htonscxx . . $ htons(a18c05e4017afb3d).(chunk_len);
11511 /* Add padding, if necessary. */
11512 if (padding_len > 0) {
11513 if ((m_last == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!) ||
11514 (sctp_add_pad_tombufcxx . . $ sctp_add_pad_tombuf(78d6dcf03d579fb3).(m_last, padding_len) == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!)) {
11515 sctp_m_freemcxx . . $ `usrsctplib/netinet/sctputil.h:57:9`!(m_out);
11516 return;
11517 }
11518 }
11519 if ((error = sctp_lowlevel_chunk_outputcxx . . $ sctp_lowlevel_chunk_output(4859f95fdecd7401).(stcb->sctp_epcxx . . $ sctp_tcb#sctp_ep., stcb, net,
11520 (struct sockaddrcxx . . $ sockaddr# *)&net->rocxx . . $ sctp_nets#ro.._l_addrcxx . . $ sctp_net_route#_l_addr.,
11521 m_out, auth_offset, auth, stcb->asoccxx . . $ sctp_tcb#asoc..authinfocxx . . $ sctp_association#authinfo..active_keyidcxx . . $ sctp_authinformation#active_keyid., 1, 0, 0,
11522 stcb->sctp_epcxx . . $ sctp_tcb#sctp_ep.->sctp_lportcxx . . $ `usrsctplib/netinet/sctp_pcb.h:430:9`!, stcb->rportcxx . . $ sctp_tcb#rport., htonlcxx . . $ htonl(2141b656ce2cc063).(vtag),
11523 stcb->asoccxx . . $ sctp_tcb#asoc..primary_destinationcxx . . $ sctp_association#primary_destination.->portcxx . . $ sctp_nets#port., NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!,
11524 #if defined(__FreeBSD__) && !defined(__Userspace__cxx . . $ `<built-in>:442:9`!)
11525 0, 0,
11526 #endif
11527 so_locked))) {
11528 SCTPDBGcxx . . $ `usrsctplib/netinet/sctp_os_userspace.h:591:9`!(SCTP_DEBUG_OUTPUT3cxx . . $ `usrsctplib/netinet/sctp_constants.h:645:9`!, "Gak send error %d\n", error);
11529 if (error == ENOBUFScxx . . $ `<external>/17922322188510340118/errno.h:89:9`!) {
11530 stcb->asoccxx . . $ sctp_tcb#asoc..ifp_had_enobufcxx . . $ sctp_association#ifp_had_enobuf. = 1;
11531 SCTP_STAT_INCRcxx . . $ `./netinet/sctp_uio.h:1111:9`!(sctps_lowlevelerr);
11532 }
11533 } else {
11534 stcb->asoccxx . . $ sctp_tcb#asoc..ifp_had_enobufcxx . . $ sctp_association#ifp_had_enobuf. = 0;
11535 }
11536 SCTP_STAT_INCR_COUNTER64cxx . . $ `./netinet/sctp_uio.h:1127:9`!(sctps_outcontrolchunks);
11537 }
11538
11539 void
11540 sctp_send_shutdown_completecxx . . $ sctp_send_shutdown_complete(406952e61e1e418d).(struct sctp_tcbcxx . . $ sctp_tcb# *stcb,
11541 struct sctp_netscxx . . $ sctp_nets# *net,
11542 int reflect_vtag)
11543 {
11544 /* formulate and SEND a SHUTDOWN-COMPLETE */
11545 struct mbufcxx . . $ mbuf# *m_shutdown_comp;
11546 struct sctp_shutdown_complete_chunkcxx . . $ sctp_shutdown_complete_chunk# *shutdown_complete;
11547 uint32_tcxx . . $ uint32_t# vtag;
11548 int error;
11549 uint8_tcxx . . $ uint8_t# flags;
11550
11551 m_shutdown_comp = sctp_get_mbuf_for_msgcxx . . $ sctp_get_mbuf_for_msg(c7c30fc329598377).(sizeof(struct sctp_chunkhdrcxx . . $ sctp_chunkhdr#), 0, M_NOWAITcxx . . $ `usrsctplib/user_malloc.h:60:9`!, 1, MT_HEADERcxx . . $ `usrsctplib/user_mbuf.h:290:9`!);
11552 if (m_shutdown_comp == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!) {
11553 /* no mbuf's */
11554 return;
11555 }
11556 if (reflect_vtag) {
11557 flags = SCTP_HAD_NO_TCBcxx . . $ `usrsctplib/netinet/sctp.h:488:9`!;
11558 vtag = stcb->asoccxx . . $ sctp_tcb#asoc..my_vtagcxx . . $ sctp_association#my_vtag.;
11559 } else {
11560 flags = 0;
11561 vtag = stcb->asoccxx . . $ sctp_tcb#asoc..peer_vtagcxx . . $ sctp_association#peer_vtag.;
11562 }
11563 shutdown_complete = mtodcxx . . $ `usrsctplib/user_mbuf.h:96:9`!(m_shutdown_comp, struct sctp_shutdown_complete_chunk *);
11564 shutdown_complete->chcxx . . $ sctp_shutdown_complete_chunk#ch..chunk_typecxx . . $ sctp_chunkhdr#chunk_type. = SCTP_SHUTDOWN_COMPLETEcxx . . $ `usrsctplib/netinet/sctp.h:463:9`!;
11565 shutdown_complete->chcxx . . $ sctp_shutdown_complete_chunk#ch..chunk_flagscxx . . $ sctp_chunkhdr#chunk_flags. = flags;
11566 shutdown_complete->chcxx . . $ sctp_shutdown_complete_chunk#ch..chunk_lengthcxx . . $ sctp_chunkhdr#chunk_length. = htonscxx . . $ htons(a18c05e4017afb3d).(sizeof(struct sctp_shutdown_complete_chunkcxx . . $ sctp_shutdown_complete_chunk#));
11567 SCTP_BUF_LENcxx . . $ `usrsctplib/netinet/sctp_os_userspace.h:790:9`!(m_shutdown_comp) = sizeof(struct sctp_shutdown_complete_chunkcxx . . $ sctp_shutdown_complete_chunk#);
11568 if ((error = sctp_lowlevel_chunk_outputcxx . . $ sctp_lowlevel_chunk_output(4859f95fdecd7401).(stcb->sctp_epcxx . . $ sctp_tcb#sctp_ep., stcb, net,
11569 (struct sockaddrcxx . . $ sockaddr# *)&net->rocxx . . $ sctp_nets#ro.._l_addrcxx . . $ sctp_net_route#_l_addr.,
11570 m_shutdown_comp, 0, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!, 0, 1, 0, 0,
11571 stcb->sctp_epcxx . . $ sctp_tcb#sctp_ep.->sctp_lportcxx . . $ `usrsctplib/netinet/sctp_pcb.h:430:9`!, stcb->rportcxx . . $ sctp_tcb#rport.,
11572 htonlcxx . . $ htonl(2141b656ce2cc063).(vtag),
11573 net->portcxx . . $ sctp_nets#port., NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!,
11574 #if defined(__FreeBSD__) && !defined(__Userspace__cxx . . $ `<built-in>:442:9`!)
11575 0, 0,
11576 #endif
11577 SCTP_SO_NOT_LOCKEDcxx . . $ `usrsctplib/netinet/sctp_constants.h:964:9`!))) {
11578 SCTPDBGcxx . . $ `usrsctplib/netinet/sctp_os_userspace.h:591:9`!(SCTP_DEBUG_OUTPUT3cxx . . $ `usrsctplib/netinet/sctp_constants.h:645:9`!, "Gak send error %d\n", error);
11579 if (error == ENOBUFScxx . . $ `<external>/17922322188510340118/errno.h:89:9`!) {
11580 stcb->asoccxx . . $ sctp_tcb#asoc..ifp_had_enobufcxx . . $ sctp_association#ifp_had_enobuf. = 1;
11581 SCTP_STAT_INCRcxx . . $ `./netinet/sctp_uio.h:1111:9`!(sctps_lowlevelerr);
11582 }
11583 } else {
11584 stcb->asoccxx . . $ sctp_tcb#asoc..ifp_had_enobufcxx . . $ sctp_association#ifp_had_enobuf. = 0;
11585 }
11586 SCTP_STAT_INCR_COUNTER64cxx . . $ `./netinet/sctp_uio.h:1127:9`!(sctps_outcontrolchunks);
11587 return;
11588 }
11589
11590 #if defined(__FreeBSD__) && !defined(__Userspace__cxx . . $ `<built-in>:442:9`!)
11591 static void
11592 sctp_send_resp_msg(struct sockaddr *src, struct sockaddr *dst,
11593 struct sctphdr *sh, uint32_t vtag,
11594 uint8_t type, struct mbuf *cause,
11595 uint8_t mflowtype, uint32_t mflowid, uint16_t fibnum,
11596 uint32_t vrf_id, uint16_t port)
11597 #else
11598 static void
11599 sctp_send_resp_msgcxx . . $ sctp_send_resp_msg(fa185149314b05ca).(struct sockaddrcxx . . $ sockaddr# *src, struct sockaddrcxx . . $ sockaddr# *dst,
11600 struct sctphdrcxx . . $ sctphdr# *sh, uint32_tcxx . . $ uint32_t# vtag,
11601 uint8_tcxx . . $ uint8_t# type, struct mbufcxx . . $ mbuf# *cause,
11602 uint32_tcxx . . $ uint32_t# vrf_id SCTP_UNUSEDcxx . . $ `usrsctplib/netinet/sctp_os_userspace.h:780:9`!, uint16_tcxx . . $ uint16_t# port)
11603 #endif
11604 {
11605 struct mbufcxx . . $ mbuf# *o_pak;
11606 struct mbufcxx . . $ mbuf# *mout;
11607 struct sctphdrcxx . . $ sctphdr# *shout;
11608 struct sctp_chunkhdrcxx . . $ sctp_chunkhdr# *ch;
11609 #if defined(INETcxx . . $ `<built-in>:431:9`!) || defined(INET6cxx . . $ `<built-in>:432:9`!)
11610 struct udphdrcxx . . $ udphdr# *udp;
11611 #endif
11612 int ret, len, cause_len, padding_len;
11613 #ifdef INETcxx . . $ `<built-in>:431:9`!
11614 #if defined(__APPLE__) && !defined(__Userspace__cxx . . $ `<built-in>:442:9`!)
11615 sctp_route_t ro;
11616 #endif
11617 struct sockaddr_incxx . . $ sockaddr_in# *src_sin, *dst_sin;
11618 struct ipcxx . . $ ip# *ip;
11619 #endif
11620 #ifdef INET6cxx . . $ `<built-in>:432:9`!
11621 struct sockaddr_in6cxx . . $ sockaddr_in6# *src_sin6, *dst_sin6;
11622 struct ip6_hdrcxx . . $ ip6_hdr# *ip6;
11623 #endif
11624
11625 /* Compute the length of the cause and add final padding. */
11626 cause_len = 0;
11627 if (cause != NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!) {
11628 struct mbufcxx . . $ mbuf# *m_at, *m_last = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!;
11629
11630 for (m_at = cause; m_at; m_at = SCTP_BUF_NEXTcxx . . $ `usrsctplib/netinet/sctp_os_userspace.h:791:9`!(m_at)) {
11631 if (SCTP_BUF_NEXTcxx . . $ `usrsctplib/netinet/sctp_os_userspace.h:791:9`!(m_at) == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!)
11632 m_last = m_at;
11633 cause_len += SCTP_BUF_LENcxx . . $ `usrsctplib/netinet/sctp_os_userspace.h:790:9`!(m_at);
11634 }
11635 padding_len = cause_len % 4;
11636 if (padding_len != 0) {
11637 padding_len = 4 - padding_len;
11638 }
11639 if (padding_len != 0) {
11640 if (sctp_add_pad_tombufcxx . . $ sctp_add_pad_tombuf(78d6dcf03d579fb3).(m_last, padding_len) == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!) {
11641 sctp_m_freemcxx . . $ `usrsctplib/netinet/sctputil.h:57:9`!(cause);
11642 return;
11643 }
11644 }
11645 } else {
11646 padding_len = 0;
11647 }
11648 /* Get an mbuf for the header. */
11649 len = sizeof(struct sctphdrcxx . . $ sctphdr#) + sizeof(struct sctp_chunkhdrcxx . . $ sctp_chunkhdr#);
11650 switch (dst->sa_familycxx . . $ sockaddr#sa_family.) {
11651 #ifdef INETcxx . . $ `<built-in>:431:9`!
11652 case AF_INETcxx . . $ `<external>/8962547315054503424/socket.h:97:9`!:
11653 len += sizeof(struct ipcxx . . $ ip#);
11654 break;
11655 #endif
11656 #ifdef INET6cxx . . $ `<built-in>:432:9`!
11657 case AF_INET6cxx . . $ `<external>/8962547315054503424/socket.h:105:9`!:
11658 len += sizeof(struct ip6_hdrcxx . . $ ip6_hdr#);
11659 break;
11660 #endif
11661 default:
11662 break;
11663 }
11664 #if defined(INETcxx . . $ `<built-in>:431:9`!) || defined(INET6cxx . . $ `<built-in>:432:9`!)
11665 if (port) {
11666 len += sizeof(struct udphdrcxx . . $ udphdr#);
11667 }
11668 #endif
11669 #if defined(__APPLE__) && !defined(__Userspace__cxx . . $ `<built-in>:442:9`!)
11670 #if defined(APPLE_LEOPARD) || defined(APPLE_SNOWLEOPARD)
11671 mout = sctp_get_mbuf_for_msg(len + max_linkhdr, 1, M_NOWAIT, 1, MT_DATA);
11672 #else
11673 mout = sctp_get_mbuf_for_msg(len + SCTP_MAX_LINKHDR, 1, M_NOWAIT, 1, MT_DATA);
11674 #endif
11675 #else
11676 mout = sctp_get_mbuf_for_msgcxx . . $ sctp_get_mbuf_for_msg(c7c30fc329598377).(len + max_linkhdrcxx . . $ max_linkhdr., 1, M_NOWAITcxx . . $ `usrsctplib/user_malloc.h:60:9`!, 1, MT_DATAcxx . . $ `usrsctplib/user_mbuf.h:289:9`!);
11677 #endif
11678 if (mout == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!) {
11679 if (cause) {
11680 sctp_m_freemcxx . . $ `usrsctplib/netinet/sctputil.h:57:9`!(cause);
11681 }
11682 return;
11683 }
11684 #if defined(__APPLE__) && !defined(__Userspace__cxx . . $ `<built-in>:442:9`!)
11685 #if defined(APPLE_LEOPARD) || defined(APPLE_SNOWLEOPARD)
11686 SCTP_BUF_RESV_UF(mout, max_linkhdr);
11687 #else
11688 SCTP_BUF_RESV_UF(mout, SCTP_MAX_LINKHDR);
11689 #endif
11690 #else
11691 SCTP_BUF_RESV_UFcxx . . $ `usrsctplib/netinet/sctp_os_userspace.h:793:9`!(mout, max_linkhdr);
11692 #endif
11693 SCTP_BUF_LENcxx . . $ `usrsctplib/netinet/sctp_os_userspace.h:790:9`!(mout) = len;
11694 SCTP_BUF_NEXTcxx . . $ `usrsctplib/netinet/sctp_os_userspace.h:791:9`!(mout) = cause;
11695 #if defined(__FreeBSD__) && !defined(__Userspace__cxx . . $ `<built-in>:442:9`!)
11696 M_SETFIB(mout, fibnum);
11697 mout->m_pkthdr.flowid = mflowid;
11698 M_HASHTYPE_SET(mout, mflowtype);
11699 #endif
11700 #ifdef INETcxx . . $ `<built-in>:431:9`!
11701 ip = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!;
11702 #endif
11703 #ifdef INET6cxx . . $ `<built-in>:432:9`!
11704 ip6 = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!;
11705 #endif
11706 switch (dst->sa_familycxx . . $ sockaddr#sa_family.) {
11707 #ifdef INETcxx . . $ `<built-in>:431:9`!
11708 case AF_INETcxx . . $ `<external>/8962547315054503424/socket.h:97:9`!:
11709 src_sin = (struct sockaddr_incxx . . $ sockaddr_in# *)src;
11710 dst_sin = (struct sockaddr_incxx . . $ sockaddr_in# *)dst;
11711 ip = mtodcxx . . $ `usrsctplib/user_mbuf.h:96:9`!(mout, struct ip *);
11712 ip->ip_vcxx . . $ ip#ip_v. = IPVERSIONcxx . . $ `<external>/4481066469753325646/ip.h:151:9`!;
11713 ip->ip_hlcxx . . $ ip#ip_hl. = (sizeof(struct ipcxx . . $ ip#) >> 2);
11714 ip->ip_toscxx . . $ ip#ip_tos. = 0;
11715 #if defined(__FreeBSD__) && !defined(__Userspace__cxx . . $ `<built-in>:442:9`!)
11716 ip->ip_off = htons(IP_DF);
11717 #elif defined(WITH_CONVERT_IP_OFF) || defined(__APPLE__)
11718 ip->ip_off = IP_DF;
11719 #else
11720 ip->ip_offcxx . . $ ip#ip_off. = htonscxx . . $ htons(a18c05e4017afb3d).(IP_DFcxx . . $ `<external>/4481066469753325646/ip.h:122:9`!);
11721 #endif
11722 #if defined(__Userspace__cxx . . $ `<built-in>:442:9`!)
11723 ip->ip_idcxx . . $ ip#ip_id. = htonscxx . . $ htons(a18c05e4017afb3d).(ip_idcxx . . $ ip_id.++);
11724 #elif defined(__FreeBSD__)
11725 ip_fillid(ip);
11726 #elif defined(__APPLE__)
11727 #if RANDOM_IP_ID
11728 ip->ip_id = ip_randomid();
11729 #else
11730 ip->ip_id = htons(ip_id++);
11731 #endif
11732 #else
11733 ip->ip_id = ip_id++;
11734 #endif
11735 ip->ip_ttlcxx . . $ ip#ip_ttl. = MODULE_GLOBALcxx . . $ `usrsctplib/netinet/sctp_os.h:70:9`!(ip_defttl);
11736 if (port) {
11737 ip->ip_pcxx . . $ ip#ip_p. = IPPROTO_UDPcxx . . $ `<external>/9581057695539925927/in.h:57:9`!;
11738 } else {
11739 ip->ip_pcxx . . $ ip#ip_p. = IPPROTO_SCTPcxx . . $ `<external>/9581057695539925927/in.h:87:9`!;
11740 }
11741 ip->ip_srccxx . . $ ip#ip_src..s_addrcxx . . $ in_addr#s_addr. = dst_sin->sin_addrcxx . . $ sockaddr_in#sin_addr..s_addrcxx . . $ in_addr#s_addr.;
11742 ip->ip_dstcxx . . $ ip#ip_dst..s_addrcxx . . $ in_addr#s_addr. = src_sin->sin_addrcxx . . $ sockaddr_in#sin_addr..s_addrcxx . . $ in_addr#s_addr.;
11743 ip->ip_sumcxx . . $ ip#ip_sum. = 0;
11744 len = sizeof(struct ipcxx . . $ ip#);
11745 shout = (struct sctphdrcxx . . $ sctphdr# *)((caddr_tcxx . . $ caddr_t#)ip + len);
11746 break;
11747 #endif
11748 #ifdef INET6cxx . . $ `<built-in>:432:9`!
11749 case AF_INET6cxx . . $ `<external>/8962547315054503424/socket.h:105:9`!:
11750 src_sin6 = (struct sockaddr_in6cxx . . $ sockaddr_in6# *)src;
11751 dst_sin6 = (struct sockaddr_in6cxx . . $ sockaddr_in6# *)dst;
11752 ip6 = mtodcxx . . $ `usrsctplib/user_mbuf.h:96:9`!(mout, struct ip6_hdr *);
11753 ip6->ip6_flowcxx . . $ `<external>/1166123355531259342/ip6.h:43:9`! = htonlcxx . . $ htonl(2141b656ce2cc063).(0x60000000);
11754 #if defined(__FreeBSD__) && !defined(__Userspace__cxx . . $ `<built-in>:442:9`!)
11755 if (V_ip6_auto_flowlabel) {
11756 ip6->ip6_flow |= (htonl(ip6_randomflowlabel()) & IPV6_FLOWLABEL_MASK);
11757 }
11758 #endif
11759 #if defined(__Userspace__cxx . . $ `<built-in>:442:9`!)
11760 ip6->ip6_hlimcxx . . $ `<external>/1166123355531259342/ip6.h:46:9`! = IPv6_HOP_LIMITcxx . . $ `usrsctplib/netinet/sctp_os_userspace.h:942:9`!;
11761 #else
11762 ip6->ip6_hlim = MODULE_GLOBAL(ip6_defhlim);
11763 #endif
11764 if (port) {
11765 ip6->ip6_nxtcxx . . $ `<external>/1166123355531259342/ip6.h:45:9`! = IPPROTO_UDPcxx . . $ `<external>/9581057695539925927/in.h:57:9`!;
11766 } else {
11767 ip6->ip6_nxtcxx . . $ `<external>/1166123355531259342/ip6.h:45:9`! = IPPROTO_SCTPcxx . . $ `<external>/9581057695539925927/in.h:87:9`!;
11768 }
11769 ip6->ip6_srccxx . . $ ip6_hdr#ip6_src. = dst_sin6->sin6_addrcxx . . $ sockaddr_in6#sin6_addr.;
11770 ip6->ip6_dstcxx . . $ ip6_hdr#ip6_dst. = src_sin6->sin6_addrcxx . . $ sockaddr_in6#sin6_addr.;
11771 len = sizeof(struct ip6_hdrcxx . . $ ip6_hdr#);
11772 shout = (struct sctphdrcxx . . $ sctphdr# *)((caddr_tcxx . . $ caddr_t#)ip6 + len);
11773 break;
11774 #endif
11775 default:
11776 len = 0;
11777 shout = mtodcxx . . $ `usrsctplib/user_mbuf.h:96:9`!(mout, struct sctphdr *);
11778 break;
11779 }
11780 #if defined(INETcxx . . $ `<built-in>:431:9`!) || defined(INET6cxx . . $ `<built-in>:432:9`!)
11781 if (port) {
11782 if (htonscxx . . $ htons(a18c05e4017afb3d).(SCTP_BASE_SYSCTLcxx . . $ `usrsctplib/netinet/sctp_os_userspace.h:579:9`!(sctp_udp_tunneling_port)) == 0) {
11783 sctp_m_freemcxx . . $ `usrsctplib/netinet/sctputil.h:57:9`!(mout);
11784 return;
11785 }
11786 udp = (struct udphdrcxx . . $ udphdr# *)shout;
11787 udp->uh_sportcxx . . $ udphdr#$anonymous_type_0#$anonymous_type_1#uh_sport. = htonscxx . . $ htons(a18c05e4017afb3d).(SCTP_BASE_SYSCTLcxx . . $ `usrsctplib/netinet/sctp_os_userspace.h:579:9`!(sctp_udp_tunneling_port));
11788 udp->uh_dportcxx . . $ udphdr#$anonymous_type_0#$anonymous_type_1#uh_dport. = port;
11789 udp->uh_sumcxx . . $ udphdr#$anonymous_type_0#$anonymous_type_1#uh_sum. = 0;
11790 udp->uh_ulencxx . . $ udphdr#$anonymous_type_0#$anonymous_type_1#uh_ulen. = htonscxx . . $ htons(a18c05e4017afb3d).((uint16_tcxx . . $ uint16_t#)(sizeof(struct udphdrcxx . . $ udphdr#) +
11791 sizeof(struct sctphdrcxx . . $ sctphdr#) +
11792 sizeof(struct sctp_chunkhdrcxx . . $ sctp_chunkhdr#) +
11793 cause_len + padding_len));
11794 len += sizeof(struct udphdrcxx . . $ udphdr#);
11795 shout = (struct sctphdrcxx . . $ sctphdr# *)((caddr_tcxx . . $ caddr_t#)shout + sizeof(struct udphdrcxx . . $ udphdr#));
11796 } else {
11797 udp = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!;
11798 }
11799 #endif
11800 shout->src_portcxx . . $ sctphdr#src_port. = sh->dest_portcxx . . $ sctphdr#dest_port.;
11801 shout->dest_portcxx . . $ sctphdr#dest_port. = sh->src_portcxx . . $ sctphdr#src_port.;
11802 shout->checksumcxx . . $ sctphdr#checksum. = 0;
11803 if (vtag) {
11804 shout->v_tagcxx . . $ sctphdr#v_tag. = htonlcxx . . $ htonl(2141b656ce2cc063).(vtag);
11805 } else {
11806 shout->v_tagcxx . . $ sctphdr#v_tag. = sh->v_tagcxx . . $ sctphdr#v_tag.;
11807 }
11808 len += sizeof(struct sctphdrcxx . . $ sctphdr#);
11809 ch = (struct sctp_chunkhdrcxx . . $ sctp_chunkhdr# *)((caddr_tcxx . . $ caddr_t#)shout + sizeof(struct sctphdrcxx . . $ sctphdr#));
11810 ch->chunk_typecxx . . $ sctp_chunkhdr#chunk_type. = type;
11811 if (vtag) {
11812 ch->chunk_flagscxx . . $ sctp_chunkhdr#chunk_flags. = 0;
11813 } else {
11814 ch->chunk_flagscxx . . $ sctp_chunkhdr#chunk_flags. = SCTP_HAD_NO_TCBcxx . . $ `usrsctplib/netinet/sctp.h:488:9`!;
11815 }
11816 ch->chunk_lengthcxx . . $ sctp_chunkhdr#chunk_length. = htonscxx . . $ htons(a18c05e4017afb3d).((uint16_tcxx . . $ uint16_t#)(sizeof(struct sctp_chunkhdrcxx . . $ sctp_chunkhdr#) + cause_len));
11817 len += sizeof(struct sctp_chunkhdrcxx . . $ sctp_chunkhdr#);
11818 len += cause_len + padding_len;
11819
11820 if (SCTP_GET_HEADER_FOR_OUTPUTcxx . . $ `usrsctplib/netinet/sctp_os_userspace.h:913:9`!(o_pak)) {
11821 sctp_m_freemcxx . . $ `usrsctplib/netinet/sctputil.h:57:9`!(mout);
11822 return;
11823 }
11824 SCTP_ATTACH_CHAINcxx . . $ `usrsctplib/netinet/sctp_os_userspace.h:922:9`!(o_pak, mout, len);
11825 switch (dst->sa_familycxx . . $ sockaddr#sa_family.) {
11826 #ifdef INETcxx . . $ `<built-in>:431:9`!
11827 case AF_INETcxx . . $ `<external>/8962547315054503424/socket.h:97:9`!:
11828 #if defined(__APPLE__) && !defined(__Userspace__cxx . . $ `<built-in>:442:9`!)
11829 /* zap the stack pointer to the route */
11830 memset(&ro, 0, sizeof(sctp_route_t));
11831 #endif
11832 if (port) {
11833 #if !defined(_WIN32) && !defined(__Userspace__cxx . . $ `<built-in>:442:9`!)
11834 #if defined(__FreeBSD__)
11835 if (V_udp_cksum) {
11836 udp->uh_sum = in_pseudo(ip->ip_src.s_addr, ip->ip_dst.s_addr, udp->uh_ulen + htons(IPPROTO_UDP));
11837 } else {
11838 udp->uh_sum = 0;
11839 }
11840 #else
11841 udp->uh_sum = in_pseudo(ip->ip_src.s_addr, ip->ip_dst.s_addr, udp->uh_ulen + htons(IPPROTO_UDP));
11842 #endif
11843 #else
11844 udp->uh_sumcxx . . $ udphdr#$anonymous_type_0#$anonymous_type_1#uh_sum. = 0;
11845 #endif
11846 }
11847 #if defined(__FreeBSD__) && !defined(__Userspace__cxx . . $ `<built-in>:442:9`!)
11848 ip->ip_len = htons(len);
11849 #elif defined(__APPLE__) || defined(__Userspace__cxx . . $ `<built-in>:442:9`!)
11850 ip->ip_lencxx . . $ ip#ip_len. = len;
11851 #else
11852 ip->ip_len = htons(len);
11853 #endif
11854 if (port) {
11855 shout->checksumcxx . . $ sctphdr#checksum. = sctp_calculate_cksumcxx . . $ sctp_calculate_cksum(ee29b78d597cafbf).(mout, sizeof(struct ipcxx . . $ ip#) + sizeof(struct udphdrcxx . . $ udphdr#));
11856 SCTP_STAT_INCRcxx . . $ `./netinet/sctp_uio.h:1111:9`!(sctps_sendswcrc);
11857 #if !defined(_WIN32) && !defined(__Userspace__cxx . . $ `<built-in>:442:9`!)
11858 #if defined(__FreeBSD__)
11859 if (V_udp_cksum) {
11860 SCTP_ENABLE_UDP_CSUM(o_pak);
11861 }
11862 #else
11863 SCTP_ENABLE_UDP_CSUM(o_pak);
11864 #endif
11865 #endif
11866 } else {
11867 #if defined(__FreeBSD__) && !defined(__Userspace__cxx . . $ `<built-in>:442:9`!)
11868 mout->m_pkthdr.csum_flags = CSUM_SCTP;
11869 mout->m_pkthdr.csum_data = offsetof(struct sctphdr, checksum);
11870 SCTP_STAT_INCR(sctps_sendhwcrc);
11871 #else
11872 shout->checksumcxx . . $ sctphdr#checksum. = sctp_calculate_cksumcxx . . $ sctp_calculate_cksum(ee29b78d597cafbf).(mout, sizeof(struct ipcxx . . $ ip#));
11873 SCTP_STAT_INCRcxx . . $ `./netinet/sctp_uio.h:1111:9`!(sctps_sendswcrc);
11874 #endif
11875 }
11876 #ifdef SCTP_PACKET_LOGGING
11877 if (SCTP_BASE_SYSCTL(sctp_logging_level) & SCTP_LAST_PACKET_TRACING) {
11878 sctp_packet_log(o_pak);
11879 }
11880 #endif
11881 #if defined(__APPLE__) && !defined(__Userspace__cxx . . $ `<built-in>:442:9`!)
11882 SCTP_IP_OUTPUT(ret, o_pak, &ro, NULL, vrf_id);
11883 /* Free the route if we got one back */
11884 if (ro.ro_rt) {
11885 RTFREE(ro.ro_rt);
11886 ro.ro_rt = NULL;
11887 }
11888 #else
11889 #if defined(__FreeBSD__) && !defined(__Userspace__cxx . . $ `<built-in>:442:9`!)
11890 SCTP_PROBE5(send, NULL, NULL, ip, NULL, shout);
11891 #endif
11892 SCTP_IP_OUTPUTcxx . . $ `usrsctplib/netinet/sctp_os_userspace.h:1037:9`!(ret, o_pak, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!, vrf_id);
11893 #endif
11894 break;
11895 #endif
11896 #ifdef INET6cxx . . $ `<built-in>:432:9`!
11897 case AF_INET6cxx . . $ `<external>/8962547315054503424/socket.h:105:9`!:
11898 ip6->ip6_plencxx . . $ `<external>/1166123355531259342/ip6.h:44:9`! = htonscxx . . $ htons(a18c05e4017afb3d).((uint16_tcxx . . $ uint16_t#)(len - sizeof(struct ip6_hdrcxx . . $ ip6_hdr#)));
11899 if (port) {
11900 shout->checksumcxx . . $ sctphdr#checksum. = sctp_calculate_cksumcxx . . $ sctp_calculate_cksum(ee29b78d597cafbf).(mout, sizeof(struct ip6_hdrcxx . . $ ip6_hdr#) + sizeof(struct udphdrcxx . . $ udphdr#));
11901 SCTP_STAT_INCRcxx . . $ `./netinet/sctp_uio.h:1111:9`!(sctps_sendswcrc);
11902 #if !defined(__Userspace__cxx . . $ `<built-in>:442:9`!)
11903 #if defined(_WIN32)
11904 udp->uh_sum = 0;
11905 #else
11906 if ((udp->uh_sum = in6_cksum(o_pak, IPPROTO_UDP, sizeof(struct ip6_hdr), len - sizeof(struct ip6_hdr))) == 0) {
11907 udp->uh_sum = 0xffff;
11908 }
11909 #endif
11910 #endif
11911 } else {
11912 #if defined(__FreeBSD__) && !defined(__Userspace__cxx . . $ `<built-in>:442:9`!)
11913 mout->m_pkthdr.csum_flags = CSUM_SCTP_IPV6;
11914 mout->m_pkthdr.csum_data = offsetof(struct sctphdr, checksum);
11915 SCTP_STAT_INCR(sctps_sendhwcrc);
11916 #else
11917 shout->checksumcxx . . $ sctphdr#checksum. = sctp_calculate_cksumcxx . . $ sctp_calculate_cksum(ee29b78d597cafbf).(mout, sizeof(struct ip6_hdrcxx . . $ ip6_hdr#));
11918 SCTP_STAT_INCRcxx . . $ `./netinet/sctp_uio.h:1111:9`!(sctps_sendswcrc);
11919 #endif
11920 }
11921 #ifdef SCTP_PACKET_LOGGING
11922 if (SCTP_BASE_SYSCTL(sctp_logging_level) & SCTP_LAST_PACKET_TRACING) {
11923 sctp_packet_log(o_pak);
11924 }
11925 #endif
11926 #if defined(__FreeBSD__) && !defined(__Userspace__cxx . . $ `<built-in>:442:9`!)
11927 SCTP_PROBE5(send, NULL, NULL, ip6, NULL, shout);
11928 #endif
11929 SCTP_IP6_OUTPUTcxx . . $ `usrsctplib/netinet/sctp_os_userspace.h:1043:9`!(ret, o_pak, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!, NULL, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!, vrf_id);
11930 break;
11931 #endif
11932 #if defined(__Userspace__cxx . . $ `<built-in>:442:9`!)
11933 case AF_CONNcxx . . $ `usrsctplib/netinet/sctp_os_userspace.h:995:9`!:
11934 {
11935 char *buffer;
11936 struct sockaddr_conncxx . . $ sockaddr_conn# *sconn;
11937
11938 sconn = (struct sockaddr_conncxx . . $ sockaddr_conn# *)src;
11939 if (SCTP_BASE_VARcxx . . $ `usrsctplib/netinet/sctp_os_userspace.h:580:9`!(crc32c_offloaded) == 0) {
11940 shout->checksumcxx . . $ sctphdr#checksum. = sctp_calculate_cksumcxx . . $ sctp_calculate_cksum(ee29b78d597cafbf).(mout, 0);
11941 SCTP_STAT_INCRcxx . . $ `./netinet/sctp_uio.h:1111:9`!(sctps_sendswcrc);
11942 } else {
11943 SCTP_STAT_INCRcxx . . $ `./netinet/sctp_uio.h:1111:9`!(sctps_sendhwcrc);
11944 }
11945 #ifdef SCTP_PACKET_LOGGING
11946 if (SCTP_BASE_SYSCTL(sctp_logging_level) & SCTP_LAST_PACKET_TRACING) {
11947 sctp_packet_log(mout);
11948 }
11949 #endif
11950 /* Don't alloc/free for each packet */
11951 if ((buffer = malloccxx . . $ malloc(bfcfa4d6b7f7ef64).(len)) != NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!) {
11952 m_copydatacxx . . $ m_copydata(fee92403c79d6892).(mout, 0, len, buffer);
11953 ret = SCTP_BASE_VARcxx . . $ `usrsctplib/netinet/sctp_os_userspace.h:580:9`!(conn_output)(sconn->sconn_addrcxx . . $ sockaddr_conn#sconn_addr., buffer, len, 0, 0);
11954 freecxx . . $ free(5d22bdacc48458e8).(buffer);
11955 } else {
11956 ret = ENOMEMcxx . . $ `<external>/8987895939074593727/errno-base.h:16:9`!;
11957 }
11958 sctp_m_freemcxx . . $ `usrsctplib/netinet/sctputil.h:57:9`!(mout);
11959 break;
11960 }
11961 #endif
11962 default:
11963 SCTPDBGcxx . . $ `usrsctplib/netinet/sctp_os_userspace.h:591:9`!(SCTP_DEBUG_OUTPUT1cxx . . $ `usrsctplib/netinet/sctp_constants.h:643:9`!, "Unknown protocol (TSNH) type %d\n",
11964 dst->sa_family);
11965 sctp_m_freemcxx . . $ `usrsctplib/netinet/sctputil.h:57:9`!(mout);
11966 SCTP_LTRACE_ERR_RET_PKTcxx . . $ `usrsctplib/netinet/sctp_os_userspace.h:628:9`!(mout, NULL, NULL, NULL, SCTP_FROM_SCTP_OUTPUT, EFAULT);
11967 return;
11968 }
11969 SCTPDBGcxx . . $ `usrsctplib/netinet/sctp_os_userspace.h:591:9`!(SCTP_DEBUG_OUTPUT3cxx . . $ `usrsctplib/netinet/sctp_constants.h:645:9`!, "return from send is %d\n", ret);
11970 #if defined(__FreeBSD__) && !defined(__Userspace__cxx . . $ `<built-in>:442:9`!)
11971 if (port) {
11972 UDPSTAT_INC(udps_opackets);
11973 }
11974 #endif
11975 SCTP_STAT_INCRcxx . . $ `./netinet/sctp_uio.h:1111:9`!(sctps_sendpackets);
11976 SCTP_STAT_INCR_COUNTER64cxx . . $ `./netinet/sctp_uio.h:1127:9`!(sctps_outpackets);
11977 SCTP_STAT_INCR_COUNTER64cxx . . $ `./netinet/sctp_uio.h:1127:9`!(sctps_outcontrolchunks);
11978 if (ret) {
11979 SCTP_STAT_INCRcxx . . $ `./netinet/sctp_uio.h:1111:9`!(sctps_senderrors);
11980 }
11981 return;
11982 }
11983
11984 void
11985 sctp_send_shutdown_complete2cxx . . $ sctp_send_shutdown_complete2(adce74127a4d4d4e).(struct sockaddrcxx . . $ sockaddr# *src, struct sockaddrcxx . . $ sockaddr# *dst,
11986 struct sctphdrcxx . . $ sctphdr# *sh,
11987 #if defined(__FreeBSD__) && !defined(__Userspace__cxx . . $ `<built-in>:442:9`!)
11988 uint8_t mflowtype, uint32_t mflowid, uint16_t fibnum,
11989 #endif
11990 uint32_tcxx . . $ uint32_t# vrf_id, uint16_tcxx . . $ uint16_t# port)
11991 {
11992 sctp_send_resp_msgcxx . . $ sctp_send_resp_msg(fa185149314b05ca).(src, dst, sh, 0, SCTP_SHUTDOWN_COMPLETEcxx . . $ `usrsctplib/netinet/sctp.h:463:9`!, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!,
11993 #if defined(__FreeBSD__) && !defined(__Userspace__cxx . . $ `<built-in>:442:9`!)
11994 mflowtype, mflowid, fibnum,
11995 #endif
11996 vrf_id, port);
11997 }
11998
11999 void
12000 sctp_send_hbcxx . . $ sctp_send_hb(406952e61e1e418d).(struct sctp_tcbcxx . . $ sctp_tcb# *stcb, struct sctp_netscxx . . $ sctp_nets# *net,int so_locked)
12001 {
12002 struct sctp_tmit_chunkcxx . . $ sctp_tmit_chunk# *chk;
12003 struct sctp_heartbeat_chunkcxx . . $ sctp_heartbeat_chunk# *hb;
12004 struct timevalcxx . . $ timeval# now;
12005
12006 SCTP_TCB_LOCK_ASSERTcxx . . $ `usrsctplib/netinet/sctp_process_lock.h:478:9`!(stcb);
12007 if (net == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!) {
12008 return;
12009 }
12010 (void)SCTP_GETTIME_TIMEVALcxx . . $ `usrsctplib/netinet/sctp_constants.h:995:9`!(&now);
12011 switch (net->rocxx . . $ sctp_nets#ro.._l_addrcxx . . $ sctp_net_route#_l_addr..sa.sa_familycxx . . $ sockaddr#sa_family.) {
12012 #ifdef INETcxx . . $ `<built-in>:431:9`!
12013 case AF_INETcxx . . $ `<external>/8962547315054503424/socket.h:97:9`!:
12014 break;
12015 #endif
12016 #ifdef INET6cxx . . $ `<built-in>:432:9`!
12017 case AF_INET6cxx . . $ `<external>/8962547315054503424/socket.h:105:9`!:
12018 break;
12019 #endif
12020 #if defined(__Userspace__cxx . . $ `<built-in>:442:9`!)
12021 case AF_CONNcxx . . $ `usrsctplib/netinet/sctp_os_userspace.h:995:9`!:
12022 break;
12023 #endif
12024 default:
12025 return;
12026 }
12027 sctp_alloc_a_chunkcxx . . $ `usrsctplib/netinet/sctp_var.h:170:9`!(stcb, chk);
12028 if (chk == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!) {
12029 SCTPDBGcxx . . $ `usrsctplib/netinet/sctp_os_userspace.h:591:9`!(SCTP_DEBUG_OUTPUT4cxx . . $ `usrsctplib/netinet/sctp_constants.h:646:9`!, "Gak, can't get a chunk for hb\n");
12030 return;
12031 }
12032
12033 chk->copy_by_refcxx . . $ sctp_tmit_chunk#copy_by_ref. = 0;
12034 chk->reccxx . . $ sctp_tmit_chunk#rec..chunk_idcxx . . $ sctp_tmit_chunk#$anonymous_type_3#chunk_id..idcxx . . $ chk_id#id. = SCTP_HEARTBEAT_REQUESTcxx . . $ `usrsctplib/netinet/sctp.h:453:9`!;
12035 chk->reccxx . . $ sctp_tmit_chunk#rec..chunk_idcxx . . $ sctp_tmit_chunk#$anonymous_type_3#chunk_id..can_take_datacxx . . $ chk_id#can_take_data. = 1;
12036 chk->flagscxx . . $ sctp_tmit_chunk#flags. = 0;
12037 chk->asoccxx . . $ sctp_tmit_chunk#asoc. = &stcb->asoccxx . . $ sctp_tcb#asoc.;
12038 chk->send_sizecxx . . $ sctp_tmit_chunk#send_size. = sizeof(struct sctp_heartbeat_chunkcxx . . $ sctp_heartbeat_chunk#);
12039
12040 chk->datacxx . . $ sctp_tmit_chunk#data. = sctp_get_mbuf_for_msgcxx . . $ sctp_get_mbuf_for_msg(c7c30fc329598377).(chk->send_sizecxx . . $ sctp_tmit_chunk#send_size., 0, M_NOWAITcxx . . $ `usrsctplib/user_malloc.h:60:9`!, 1, MT_HEADERcxx . . $ `usrsctplib/user_mbuf.h:290:9`!);
12041 if (chk->datacxx . . $ sctp_tmit_chunk#data. == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!) {
12042 sctp_free_a_chunkcxx . . $ `usrsctplib/netinet/sctp_var.h:144:9`!(stcb, chk, so_locked);
12043 return;
12044 }
12045 SCTP_BUF_RESV_UFcxx . . $ `usrsctplib/netinet/sctp_os_userspace.h:793:9`!(chk->data, SCTP_MIN_OVERHEADcxx . . $ `usrsctplib/netinet/sctp_header.h:561:9`!);
12046 SCTP_BUF_LENcxx . . $ `usrsctplib/netinet/sctp_os_userspace.h:790:9`!(chk->data) = chk->send_sizecxx . . $ sctp_tmit_chunk#send_size.;
12047 chk->sentcxx . . $ sctp_tmit_chunk#sent. = SCTP_DATAGRAM_UNSENTcxx . . $ `usrsctplib/netinet/sctp_constants.h:353:9`!;
12048 chk->snd_countcxx . . $ sctp_tmit_chunk#snd_count. = 0;
12049 chk->whoTocxx . . $ sctp_tmit_chunk#whoTo. = net;
12050 atomic_add_intcxx . . $ `usrsctplib/user_atomic.h:94:9`!(&chk->whoTo->ref_count, 1);
12051 /* Now we have a mbuf that we can fill in with the details */
12052 hb = mtodcxx . . $ `usrsctplib/user_mbuf.h:96:9`!(chk->data, struct sctp_heartbeat_chunk *);
12053 memsetcxx . . $ memset(d1de1e4fb215f1c6).(hb, 0, sizeof(struct sctp_heartbeat_chunkcxx . . $ sctp_heartbeat_chunk#));
12054 /* fill out chunk header */
12055 hb->chcxx . . $ sctp_heartbeat_chunk#ch..chunk_typecxx . . $ sctp_chunkhdr#chunk_type. = SCTP_HEARTBEAT_REQUESTcxx . . $ `usrsctplib/netinet/sctp.h:453:9`!;
12056 hb->chcxx . . $ sctp_heartbeat_chunk#ch..chunk_flagscxx . . $ sctp_chunkhdr#chunk_flags. = 0;
12057 hb->chcxx . . $ sctp_heartbeat_chunk#ch..chunk_lengthcxx . . $ sctp_chunkhdr#chunk_length. = htonscxx . . $ htons(a18c05e4017afb3d).(chk->send_sizecxx . . $ sctp_tmit_chunk#send_size.);
12058 /* Fill out hb parameter */
12059 hb->heartbeatcxx . . $ sctp_heartbeat_chunk#heartbeat..hb_infocxx . . $ sctp_heartbeat#hb_info..phcxx . . $ sctp_heartbeat_info_param#ph..param_typecxx . . $ sctp_paramhdr#param_type. = htonscxx . . $ htons(a18c05e4017afb3d).(SCTP_HEARTBEAT_INFOcxx . . $ `usrsctplib/netinet/sctp_constants.h:395:9`!);
12060 hb->heartbeatcxx . . $ sctp_heartbeat_chunk#heartbeat..hb_infocxx . . $ sctp_heartbeat#hb_info..phcxx . . $ sctp_heartbeat_info_param#ph..param_lengthcxx . . $ sctp_paramhdr#param_length. = htonscxx . . $ htons(a18c05e4017afb3d).(sizeof(struct sctp_heartbeat_info_paramcxx . . $ sctp_heartbeat_info_param#));
12061 hb->heartbeatcxx . . $ sctp_heartbeat_chunk#heartbeat..hb_infocxx . . $ sctp_heartbeat#hb_info..time_value_1cxx . . $ sctp_heartbeat_info_param#time_value_1. = now.tv_seccxx . . $ timeval#tv_sec.;
12062 hb->heartbeatcxx . . $ sctp_heartbeat_chunk#heartbeat..hb_infocxx . . $ sctp_heartbeat#hb_info..time_value_2cxx . . $ sctp_heartbeat_info_param#time_value_2. = now.tv_useccxx . . $ timeval#tv_usec.;
12063 /* Did our user request this one, put it in */
12064 hb->heartbeatcxx . . $ sctp_heartbeat_chunk#heartbeat..hb_infocxx . . $ sctp_heartbeat#hb_info..addr_familycxx . . $ sctp_heartbeat_info_param#addr_family. = (uint8_tcxx . . $ uint8_t#)net->rocxx . . $ sctp_nets#ro.._l_addrcxx . . $ sctp_net_route#_l_addr..sa.sa_familycxx . . $ sockaddr#sa_family.;
12065 #ifdef HAVE_SA_LEN
12066 hb->heartbeat.hb_info.addr_len = net->ro._l_addr.sa.sa_len;
12067 #else
12068 switch (net->rocxx . . $ sctp_nets#ro.._l_addrcxx . . $ sctp_net_route#_l_addr..sa.sa_familycxx . . $ sockaddr#sa_family.) {
12069 #ifdef INETcxx . . $ `<built-in>:431:9`!
12070 case AF_INETcxx . . $ `<external>/8962547315054503424/socket.h:97:9`!:
12071 hb->heartbeatcxx . . $ sctp_heartbeat_chunk#heartbeat..hb_infocxx . . $ sctp_heartbeat#hb_info..addr_lencxx . . $ sctp_heartbeat_info_param#addr_len. = sizeof(struct sockaddr_incxx . . $ sockaddr_in#);
12072 break;
12073 #endif
12074 #ifdef INET6cxx . . $ `<built-in>:432:9`!
12075 case AF_INET6cxx . . $ `<external>/8962547315054503424/socket.h:105:9`!:
12076 hb->heartbeatcxx . . $ sctp_heartbeat_chunk#heartbeat..hb_infocxx . . $ sctp_heartbeat#hb_info..addr_lencxx . . $ sctp_heartbeat_info_param#addr_len. = sizeof(struct sockaddr_in6cxx . . $ sockaddr_in6#);
12077 break;
12078 #endif
12079 #if defined(__Userspace__cxx . . $ `<built-in>:442:9`!)
12080 case AF_CONNcxx . . $ `usrsctplib/netinet/sctp_os_userspace.h:995:9`!:
12081 hb->heartbeatcxx . . $ sctp_heartbeat_chunk#heartbeat..hb_infocxx . . $ sctp_heartbeat#hb_info..addr_lencxx . . $ sctp_heartbeat_info_param#addr_len. = sizeof(struct sockaddr_conncxx . . $ sockaddr_conn#);
12082 break;
12083 #endif
12084 default:
12085 hb->heartbeatcxx . . $ sctp_heartbeat_chunk#heartbeat..hb_infocxx . . $ sctp_heartbeat#hb_info..addr_lencxx . . $ sctp_heartbeat_info_param#addr_len. = 0;
12086 break;
12087 }
12088 #endif
12089 if (net->dest_statecxx . . $ sctp_nets#dest_state. & SCTP_ADDR_UNCONFIRMEDcxx . . $ `usrsctplib/netinet/sctp_constants.h:492:9`!) {
12090 /*
12091 * we only take from the entropy pool if the address is not
12092 * confirmed.
12093 */
12094 net->heartbeat_random1cxx . . $ sctp_nets#heartbeat_random1. = hb->heartbeatcxx . . $ sctp_heartbeat_chunk#heartbeat..hb_infocxx . . $ sctp_heartbeat#hb_info..random_value1cxx . . $ sctp_heartbeat_info_param#random_value1. = sctp_select_initial_TSNcxx . . $ sctp_select_initial_TSN(4bcc659f5dd09fb6).(&stcb->sctp_epcxx . . $ sctp_tcb#sctp_ep.->sctp_epcxx . . $ sctp_inpcb#sctp_ep.);
12095 net->heartbeat_random2cxx . . $ sctp_nets#heartbeat_random2. = hb->heartbeatcxx . . $ sctp_heartbeat_chunk#heartbeat..hb_infocxx . . $ sctp_heartbeat#hb_info..random_value2cxx . . $ sctp_heartbeat_info_param#random_value2. = sctp_select_initial_TSNcxx . . $ sctp_select_initial_TSN(4bcc659f5dd09fb6).(&stcb->sctp_epcxx . . $ sctp_tcb#sctp_ep.->sctp_epcxx . . $ sctp_inpcb#sctp_ep.);
12096 } else {
12097 net->heartbeat_random1cxx . . $ sctp_nets#heartbeat_random1. = hb->heartbeatcxx . . $ sctp_heartbeat_chunk#heartbeat..hb_infocxx . . $ sctp_heartbeat#hb_info..random_value1cxx . . $ sctp_heartbeat_info_param#random_value1. = 0;
12098 net->heartbeat_random2cxx . . $ sctp_nets#heartbeat_random2. = hb->heartbeatcxx . . $ sctp_heartbeat_chunk#heartbeat..hb_infocxx . . $ sctp_heartbeat#hb_info..random_value2cxx . . $ sctp_heartbeat_info_param#random_value2. = 0;
12099 }
12100 switch (net->rocxx . . $ sctp_nets#ro.._l_addrcxx . . $ sctp_net_route#_l_addr..sa.sa_familycxx . . $ sockaddr#sa_family.) {
12101 #ifdef INETcxx . . $ `<built-in>:431:9`!
12102 case AF_INETcxx . . $ `<external>/8962547315054503424/socket.h:97:9`!:
12103 memcpycxx . . $ memcpy(cc817cb175f282d).(hb->heartbeatcxx . . $ sctp_heartbeat_chunk#heartbeat..hb_infocxx . . $ sctp_heartbeat#hb_info..addresscxx . . $ sctp_heartbeat_info_param#address.,
12104 &net->rocxx . . $ sctp_nets#ro.._l_addrcxx . . $ sctp_net_route#_l_addr..sin.sin_addrcxx . . $ sockaddr_in#sin_addr.,
12105 sizeof(net->rocxx . . $ sctp_nets#ro.._l_addrcxx . . $ sctp_net_route#_l_addr..sin.sin_addrcxx . . $ sockaddr_in#sin_addr.));
12106 break;
12107 #endif
12108 #ifdef INET6cxx . . $ `<built-in>:432:9`!
12109 case AF_INET6cxx . . $ `<external>/8962547315054503424/socket.h:105:9`!:
12110 memcpycxx . . $ memcpy(cc817cb175f282d).(hb->heartbeatcxx . . $ sctp_heartbeat_chunk#heartbeat..hb_infocxx . . $ sctp_heartbeat#hb_info..addresscxx . . $ sctp_heartbeat_info_param#address.,
12111 &net->rocxx . . $ sctp_nets#ro.._l_addrcxx . . $ sctp_net_route#_l_addr..sin6.sin6_addrcxx . . $ sockaddr_in6#sin6_addr.,
12112 sizeof(net->rocxx . . $ sctp_nets#ro.._l_addrcxx . . $ sctp_net_route#_l_addr..sin6.sin6_addrcxx . . $ sockaddr_in6#sin6_addr.));
12113 break;
12114 #endif
12115 #if defined(__Userspace__cxx . . $ `<built-in>:442:9`!)
12116 case AF_CONNcxx . . $ `usrsctplib/netinet/sctp_os_userspace.h:995:9`!:
12117 memcpycxx . . $ memcpy(cc817cb175f282d).(hb->heartbeatcxx . . $ sctp_heartbeat_chunk#heartbeat..hb_infocxx . . $ sctp_heartbeat#hb_info..addresscxx . . $ sctp_heartbeat_info_param#address.,
12118 &net->rocxx . . $ sctp_nets#ro.._l_addrcxx . . $ sctp_net_route#_l_addr..sconn.sconn_addrcxx . . $ sockaddr_conn#sconn_addr.,
12119 sizeof(net->rocxx . . $ sctp_nets#ro.._l_addrcxx . . $ sctp_net_route#_l_addr..sconn.sconn_addrcxx . . $ sockaddr_conn#sconn_addr.));
12120 break;
12121 #endif
12122 default:
12123 if (chk->datacxx . . $ sctp_tmit_chunk#data.) {
12124 sctp_m_freemcxx . . $ `usrsctplib/netinet/sctputil.h:57:9`!(chk->datacxx . . $ sctp_tmit_chunk#data.);
12125 chk->datacxx . . $ sctp_tmit_chunk#data. = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!;
12126 }
12127 sctp_free_a_chunkcxx . . $ `usrsctplib/netinet/sctp_var.h:144:9`!(stcb, chk, so_locked);
12128 return;
12129 break;
12130 }
12131 net->hb_respondedcxx . . $ sctp_nets#hb_responded. = 0;
12132 TAILQ_INSERT_TAILcxx . . $ `<external>/2546723208511035544/queue.h:402:9`!(&stcb->asoc.control_send_queue, chk, sctp_next);
12133 stcb->asoccxx . . $ sctp_tcb#asoc..ctrl_queue_cntcxx . . $ sctp_association#ctrl_queue_cnt.++;
12134 SCTP_STAT_INCRcxx . . $ `./netinet/sctp_uio.h:1111:9`!(sctps_sendheartbeat);
12135 return;
12136 }
12137
12138 void
12139 sctp_send_ecn_echocxx . . $ sctp_send_ecn_echo(746ba0cd86760d6c).(struct sctp_tcbcxx . . $ sctp_tcb# *stcb, struct sctp_netscxx . . $ sctp_nets# *net,
12140 uint32_tcxx . . $ uint32_t# high_tsn)
12141 {
12142 struct sctp_associationcxx . . $ sctp_association# *asoc;
12143 struct sctp_ecne_chunkcxx . . $ sctp_ecne_chunk# *ecne;
12144 struct sctp_tmit_chunkcxx . . $ sctp_tmit_chunk# *chk;
12145
12146 if (net == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!) {
12147 return;
12148 }
12149 asoc = &stcb->asoccxx . . $ sctp_tcb#asoc.;
12150 SCTP_TCB_LOCK_ASSERTcxx . . $ `usrsctplib/netinet/sctp_process_lock.h:478:9`!(stcb);
12151 TAILQ_FOREACHcxx . . $ `<external>/2546723208511035544/queue.h:435:9`!(chk, &asoc->control_send_queue, sctp_next) {
12152 if ((chk->reccxx . . $ sctp_tmit_chunk#rec..chunk_idcxx . . $ sctp_tmit_chunk#$anonymous_type_3#chunk_id..idcxx . . $ chk_id#id. == SCTP_ECN_ECHOcxx . . $ `usrsctplib/netinet/sctp.h:461:9`!) && (net == chk->whoTocxx . . $ sctp_tmit_chunk#whoTo.)) {
12153 /* found a previous ECN_ECHO update it if needed */
12154 uint32_tcxx . . $ uint32_t# cnt, ctsn;
12155 ecne = mtodcxx . . $ `usrsctplib/user_mbuf.h:96:9`!(chk->data, struct sctp_ecne_chunk *);
12156 ctsn = ntohlcxx . . $ ntohl(2141b656ce2cc063).(ecne->tsncxx . . $ sctp_ecne_chunk#tsn.);
12157 if (SCTP_TSN_GTcxx . . $ `usrsctplib/netinet/sctp_constants.h:893:9`!(high_tsn, ctsn)) {
12158 ecne->tsncxx . . $ sctp_ecne_chunk#tsn. = htonlcxx . . $ htonl(2141b656ce2cc063).(high_tsn);
12159 SCTP_STAT_INCRcxx . . $ `./netinet/sctp_uio.h:1111:9`!(sctps_queue_upd_ecne);
12160 }
12161 cnt = ntohlcxx . . $ ntohl(2141b656ce2cc063).(ecne->num_pkts_since_cwrcxx . . $ sctp_ecne_chunk#num_pkts_since_cwr.);
12162 cnt++;
12163 ecne->num_pkts_since_cwrcxx . . $ sctp_ecne_chunk#num_pkts_since_cwr. = htonlcxx . . $ htonl(2141b656ce2cc063).(cnt);
12164 return;
12165 }
12166 }
12167 /* nope could not find one to update so we must build one */
12168 sctp_alloc_a_chunkcxx . . $ `usrsctplib/netinet/sctp_var.h:170:9`!(stcb, chk);
12169 if (chk == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!) {
12170 return;
12171 }
12172 SCTP_STAT_INCRcxx . . $ `./netinet/sctp_uio.h:1111:9`!(sctps_queue_upd_ecne);
12173 chk->copy_by_refcxx . . $ sctp_tmit_chunk#copy_by_ref. = 0;
12174 chk->reccxx . . $ sctp_tmit_chunk#rec..chunk_idcxx . . $ sctp_tmit_chunk#$anonymous_type_3#chunk_id..idcxx . . $ chk_id#id. = SCTP_ECN_ECHOcxx . . $ `usrsctplib/netinet/sctp.h:461:9`!;
12175 chk->reccxx . . $ sctp_tmit_chunk#rec..chunk_idcxx . . $ sctp_tmit_chunk#$anonymous_type_3#chunk_id..can_take_datacxx . . $ chk_id#can_take_data. = 0;
12176 chk->flagscxx . . $ sctp_tmit_chunk#flags. = 0;
12177 chk->asoccxx . . $ sctp_tmit_chunk#asoc. = &stcb->asoccxx . . $ sctp_tcb#asoc.;
12178 chk->send_sizecxx . . $ sctp_tmit_chunk#send_size. = sizeof(struct sctp_ecne_chunkcxx . . $ sctp_ecne_chunk#);
12179 chk->datacxx . . $ sctp_tmit_chunk#data. = sctp_get_mbuf_for_msgcxx . . $ sctp_get_mbuf_for_msg(c7c30fc329598377).(chk->send_sizecxx . . $ sctp_tmit_chunk#send_size., 0, M_NOWAITcxx . . $ `usrsctplib/user_malloc.h:60:9`!, 1, MT_HEADERcxx . . $ `usrsctplib/user_mbuf.h:290:9`!);
12180 if (chk->datacxx . . $ sctp_tmit_chunk#data. == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!) {
12181 sctp_free_a_chunkcxx . . $ `usrsctplib/netinet/sctp_var.h:144:9`!(stcb, chk, SCTP_SO_NOT_LOCKEDcxx . . $ `usrsctplib/netinet/sctp_constants.h:964:9`!);
12182 return;
12183 }
12184 SCTP_BUF_RESV_UFcxx . . $ `usrsctplib/netinet/sctp_os_userspace.h:793:9`!(chk->data, SCTP_MIN_OVERHEADcxx . . $ `usrsctplib/netinet/sctp_header.h:561:9`!);
12185 SCTP_BUF_LENcxx . . $ `usrsctplib/netinet/sctp_os_userspace.h:790:9`!(chk->data) = chk->send_sizecxx . . $ sctp_tmit_chunk#send_size.;
12186 chk->sentcxx . . $ sctp_tmit_chunk#sent. = SCTP_DATAGRAM_UNSENTcxx . . $ `usrsctplib/netinet/sctp_constants.h:353:9`!;
12187 chk->snd_countcxx . . $ sctp_tmit_chunk#snd_count. = 0;
12188 chk->whoTocxx . . $ sctp_tmit_chunk#whoTo. = net;
12189 atomic_add_intcxx . . $ `usrsctplib/user_atomic.h:94:9`!(&chk->whoTo->ref_count, 1);
12190
12191 stcb->asoccxx . . $ sctp_tcb#asoc..ecn_echo_cnt_onqcxx . . $ sctp_association#ecn_echo_cnt_onq.++;
12192 ecne = mtodcxx . . $ `usrsctplib/user_mbuf.h:96:9`!(chk->data, struct sctp_ecne_chunk *);
12193 ecne->chcxx . . $ sctp_ecne_chunk#ch..chunk_typecxx . . $ sctp_chunkhdr#chunk_type. = SCTP_ECN_ECHOcxx . . $ `usrsctplib/netinet/sctp.h:461:9`!;
12194 ecne->chcxx . . $ sctp_ecne_chunk#ch..chunk_flagscxx . . $ sctp_chunkhdr#chunk_flags. = 0;
12195 ecne->chcxx . . $ sctp_ecne_chunk#ch..chunk_lengthcxx . . $ sctp_chunkhdr#chunk_length. = htonscxx . . $ htons(a18c05e4017afb3d).(sizeof(struct sctp_ecne_chunkcxx . . $ sctp_ecne_chunk#));
12196 ecne->tsncxx . . $ sctp_ecne_chunk#tsn. = htonlcxx . . $ htonl(2141b656ce2cc063).(high_tsn);
12197 ecne->num_pkts_since_cwrcxx . . $ sctp_ecne_chunk#num_pkts_since_cwr. = htonlcxx . . $ htonl(2141b656ce2cc063).(1);
12198 TAILQ_INSERT_HEADcxx . . $ `<external>/2546723208511035544/queue.h:392:9`!(&stcb->asoc.control_send_queue, chk, sctp_next);
12199 asoc->ctrl_queue_cntcxx . . $ sctp_association#ctrl_queue_cnt.++;
12200 }
12201
12202 void
12203 sctp_send_packet_droppedcxx . . $ sctp_send_packet_dropped(ffed3e5a354c5488).(struct sctp_tcbcxx . . $ sctp_tcb# *stcb, struct sctp_netscxx . . $ sctp_nets# *net,
12204 struct mbufcxx . . $ mbuf# *m, int len, int iphlen, int bad_crc)
12205 {
12206 struct sctp_associationcxx . . $ sctp_association# *asoc;
12207 struct sctp_pktdrop_chunkcxx . . $ sctp_pktdrop_chunk# *drp;
12208 struct sctp_tmit_chunkcxx . . $ sctp_tmit_chunk# *chk;
12209 uint8_tcxx . . $ uint8_t# *datap;
12210 int was_trunc = 0;
12211 int fullsz = 0;
12212 long spc;
12213 int offset;
12214 struct sctp_chunkhdrcxx . . $ sctp_chunkhdr# *ch, chunk_buf;
12215 unsigned int chk_length;
12216
12217 if (!stcb) {
12218 return;
12219 }
12220 asoc = &stcb->asoccxx . . $ sctp_tcb#asoc.;
12221 SCTP_TCB_LOCK_ASSERTcxx . . $ `usrsctplib/netinet/sctp_process_lock.h:478:9`!(stcb);
12222 if (asoc->pktdrop_supportedcxx . . $ sctp_association#pktdrop_supported. == 0) {
12223 /*-
12224 * peer must declare support before I send one.
12225 */
12226 return;
12227 }
12228 if (stcb->sctp_socketcxx . . $ sctp_tcb#sctp_socket. == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!) {
12229 return;
12230 }
12231 sctp_alloc_a_chunkcxx . . $ `usrsctplib/netinet/sctp_var.h:170:9`!(stcb, chk);
12232 if (chk == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!) {
12233 return;
12234 }
12235 chk->copy_by_refcxx . . $ sctp_tmit_chunk#copy_by_ref. = 0;
12236 chk->reccxx . . $ sctp_tmit_chunk#rec..chunk_idcxx . . $ sctp_tmit_chunk#$anonymous_type_3#chunk_id..idcxx . . $ chk_id#id. = SCTP_PACKET_DROPPEDcxx . . $ `usrsctplib/netinet/sctp.h:474:9`!;
12237 chk->reccxx . . $ sctp_tmit_chunk#rec..chunk_idcxx . . $ sctp_tmit_chunk#$anonymous_type_3#chunk_id..can_take_datacxx . . $ chk_id#can_take_data. = 1;
12238 chk->flagscxx . . $ sctp_tmit_chunk#flags. = 0;
12239 len -= iphlen;
12240 chk->send_sizecxx . . $ sctp_tmit_chunk#send_size. = len;
12241 /* Validate that we do not have an ABORT in here. */
12242 offset = iphlen + sizeof(struct sctphdrcxx . . $ sctphdr#);
12243 ch = (struct sctp_chunkhdrcxx . . $ sctp_chunkhdr# *)sctp_m_getptrcxx . . $ sctp_m_getptr(c590cb75a4c01e43).(m, offset,
12244 sizeof(*ch), (uint8_tcxx . . $ uint8_t# *) & chunk_buf);
12245 while (ch != NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!) {
12246 chk_length = ntohscxx . . $ ntohs(a18c05e4017afb3d).(ch->chunk_lengthcxx . . $ sctp_chunkhdr#chunk_length.);
12247 if (chk_length < sizeof(*ch)) {
12248 /* break to abort land */
12249 break;
12250 }
12251 switch (ch->chunk_typecxx . . $ sctp_chunkhdr#chunk_type.) {
12252 case SCTP_PACKET_DROPPEDcxx . . $ `usrsctplib/netinet/sctp.h:474:9`!:
12253 case SCTP_ABORT_ASSOCIATIONcxx . . $ `usrsctplib/netinet/sctp.h:455:9`!:
12254 case SCTP_INITIATION_ACKcxx . . $ `usrsctplib/netinet/sctp.h:451:9`!:
12255 /**
12256 * We don't respond with an PKT-DROP to an ABORT
12257 * or PKT-DROP. We also do not respond to an
12258 * INIT-ACK, because we can't know if the initiation
12259 * tag is correct or not.
12260 */
12261 sctp_free_a_chunkcxx . . $ `usrsctplib/netinet/sctp_var.h:144:9`!(stcb, chk, SCTP_SO_NOT_LOCKEDcxx . . $ `usrsctplib/netinet/sctp_constants.h:964:9`!);
12262 return;
12263 default:
12264 break;
12265 }
12266 offset += SCTP_SIZE32cxx . . $ `usrsctplib/netinet/sctp_constants.h:388:9`!(chk_length);
12267 ch = (struct sctp_chunkhdrcxx . . $ sctp_chunkhdr# *)sctp_m_getptrcxx . . $ sctp_m_getptr(c590cb75a4c01e43).(m, offset,
12268 sizeof(*ch), (uint8_tcxx . . $ uint8_t# *) & chunk_buf);
12269 }
12270
12271 if ((len + SCTP_MAX_OVERHEADcxx . . $ `usrsctplib/netinet/sctp_header.h:551:9`! + sizeof(struct sctp_pktdrop_chunkcxx . . $ sctp_pktdrop_chunk#)) >
12272 mincxx . . $ `usrsctplib/user_environment.h:66:9`!(stcb->asoc.smallest_mtu, MCLBYTEScxx . . $ `usrsctplib/user_mbuf.h:51:9`!)) {
12273 /* only send 1 mtu worth, trim off the
12274 * excess on the end.
12275 */
12276 fullsz = len;
12277 len = mincxx . . $ `usrsctplib/user_environment.h:66:9`!(stcb->asoc.smallest_mtu, MCLBYTEScxx . . $ `usrsctplib/user_mbuf.h:51:9`!) - SCTP_MAX_OVERHEADcxx . . $ `usrsctplib/netinet/sctp_header.h:551:9`!;
12278 was_trunc = 1;
12279 }
12280 chk->asoccxx . . $ sctp_tmit_chunk#asoc. = &stcb->asoccxx . . $ sctp_tcb#asoc.;
12281 chk->datacxx . . $ sctp_tmit_chunk#data. = sctp_get_mbuf_for_msgcxx . . $ sctp_get_mbuf_for_msg(c7c30fc329598377).(MCLBYTEScxx . . $ `usrsctplib/user_mbuf.h:51:9`!, 0, M_NOWAITcxx . . $ `usrsctplib/user_malloc.h:60:9`!, 1, MT_DATAcxx . . $ `usrsctplib/user_mbuf.h:289:9`!);
12282 if (chk->datacxx . . $ sctp_tmit_chunk#data. == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!) {
12283 jump_out:
12284 sctp_free_a_chunkcxx . . $ `usrsctplib/netinet/sctp_var.h:144:9`!(stcb, chk, SCTP_SO_NOT_LOCKEDcxx . . $ `usrsctplib/netinet/sctp_constants.h:964:9`!);
12285 return;
12286 }
12287 SCTP_BUF_RESV_UFcxx . . $ `usrsctplib/netinet/sctp_os_userspace.h:793:9`!(chk->data, SCTP_MIN_OVERHEADcxx . . $ `usrsctplib/netinet/sctp_header.h:561:9`!);
12288 drp = mtodcxx . . $ `usrsctplib/user_mbuf.h:96:9`!(chk->data, struct sctp_pktdrop_chunk *);
12289 if (drp == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!) {
12290 sctp_m_freemcxx . . $ `usrsctplib/netinet/sctputil.h:57:9`!(chk->datacxx . . $ sctp_tmit_chunk#data.);
12291 chk->datacxx . . $ sctp_tmit_chunk#data. = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!;
12292 goto jump_out;
12293 }
12294 chk->book_sizecxx . . $ sctp_tmit_chunk#book_size. = SCTP_SIZE32cxx . . $ `usrsctplib/netinet/sctp_constants.h:388:9`!((chk->send_size + sizeof(struct sctp_pktdrop_chunk) +
12295 sizeof(struct sctphdr) + SCTP_MED_OVERHEADcxx . . $ `usrsctplib/netinet/sctp_header.h:557:9`!));
12296 chk->book_size_scalecxx . . $ sctp_tmit_chunk#book_size_scale. = 0;
12297 if (was_trunc) {
12298 drp->chcxx . . $ sctp_pktdrop_chunk#ch..chunk_flagscxx . . $ sctp_chunkhdr#chunk_flags. = SCTP_PACKET_TRUNCATEDcxx . . $ `usrsctplib/netinet/sctp.h:493:9`!;
12299 drp->trunc_lencxx . . $ sctp_pktdrop_chunk#trunc_len. = htonscxx . . $ htons(a18c05e4017afb3d).(fullsz);
12300 /* Len is already adjusted to size minus overhead above
12301 * take out the pkt_drop chunk itself from it.
12302 */
12303 chk->send_sizecxx . . $ sctp_tmit_chunk#send_size. = (uint16_tcxx . . $ uint16_t#)(len - sizeof(struct sctp_pktdrop_chunkcxx . . $ sctp_pktdrop_chunk#));
12304 len = chk->send_sizecxx . . $ sctp_tmit_chunk#send_size.;
12305 } else {
12306 /* no truncation needed */
12307 drp->chcxx . . $ sctp_pktdrop_chunk#ch..chunk_flagscxx . . $ sctp_chunkhdr#chunk_flags. = 0;
12308 drp->trunc_lencxx . . $ sctp_pktdrop_chunk#trunc_len. = htonscxx . . $ htons(a18c05e4017afb3d).(0);
12309 }
12310 if (bad_crc) {
12311 drp->chcxx . . $ sctp_pktdrop_chunk#ch..chunk_flagscxx . . $ sctp_chunkhdr#chunk_flags. |= SCTP_BADCRCcxx . . $ `usrsctplib/netinet/sctp.h:492:9`!;
12312 }
12313 chk->send_sizecxx . . $ sctp_tmit_chunk#send_size. += sizeof(struct sctp_pktdrop_chunkcxx . . $ sctp_pktdrop_chunk#);
12314 SCTP_BUF_LENcxx . . $ `usrsctplib/netinet/sctp_os_userspace.h:790:9`!(chk->data) = chk->send_sizecxx . . $ sctp_tmit_chunk#send_size.;
12315 chk->sentcxx . . $ sctp_tmit_chunk#sent. = SCTP_DATAGRAM_UNSENTcxx . . $ `usrsctplib/netinet/sctp_constants.h:353:9`!;
12316 chk->snd_countcxx . . $ sctp_tmit_chunk#snd_count. = 0;
12317 if (net) {
12318 /* we should hit here */
12319 chk->whoTocxx . . $ sctp_tmit_chunk#whoTo. = net;
12320 atomic_add_intcxx . . $ `usrsctplib/user_atomic.h:94:9`!(&chk->whoTo->ref_count, 1);
12321 } else {
12322 chk->whoTocxx . . $ sctp_tmit_chunk#whoTo. = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!;
12323 }
12324 drp->chcxx . . $ sctp_pktdrop_chunk#ch..chunk_typecxx . . $ sctp_chunkhdr#chunk_type. = SCTP_PACKET_DROPPEDcxx . . $ `usrsctplib/netinet/sctp.h:474:9`!;
12325 drp->chcxx . . $ sctp_pktdrop_chunk#ch..chunk_lengthcxx . . $ sctp_chunkhdr#chunk_length. = htonscxx . . $ htons(a18c05e4017afb3d).(chk->send_sizecxx . . $ sctp_tmit_chunk#send_size.);
12326 spc = SCTP_SB_LIMIT_RCVcxx . . $ `usrsctplib/netinet/sctp_os_userspace.h:964:9`!(stcb->sctp_socket);
12327 if (spc < 0) {
12328 spc = 0;
12329 }
12330 drp->bottle_bwcxx . . $ sctp_pktdrop_chunk#bottle_bw. = htonlcxx . . $ htonl(2141b656ce2cc063).(spc);
12331 if (asoc->my_rwndcxx . . $ sctp_association#my_rwnd.) {
12332 drp->current_onqcxx . . $ sctp_pktdrop_chunk#current_onq. = htonlcxx . . $ htonl(2141b656ce2cc063).(asoc->size_on_reasm_queuecxx . . $ sctp_association#size_on_reasm_queue. +
12333 asoc->size_on_all_streamscxx . . $ sctp_association#size_on_all_streams. +
12334 asoc->my_rwnd_control_lencxx . . $ sctp_association#my_rwnd_control_len. +
12335 stcb->sctp_socketcxx . . $ sctp_tcb#sctp_socket.->so_rcvcxx . . $ socket#so_rcv..sb_cccxx . . $ sockbuf#sb_cc.);
12336 } else {
12337 /*-
12338 * If my rwnd is 0, possibly from mbuf depletion as well as
12339 * space used, tell the peer there is NO space aka onq == bw
12340 */
12341 drp->current_onqcxx . . $ sctp_pktdrop_chunk#current_onq. = htonlcxx . . $ htonl(2141b656ce2cc063).(spc);
12342 }
12343 drp->reservedcxx . . $ sctp_pktdrop_chunk#reserved. = 0;
12344 datap = drp->datacxx . . $ sctp_pktdrop_chunk#data.;
12345 m_copydatacxx . . $ m_copydata(fee92403c79d6892).(m, iphlen, len, (caddr_tcxx . . $ caddr_t#)datap);
12346 TAILQ_INSERT_TAILcxx . . $ `<external>/2546723208511035544/queue.h:402:9`!(&stcb->asoc.control_send_queue, chk, sctp_next);
12347 asoc->ctrl_queue_cntcxx . . $ sctp_association#ctrl_queue_cnt.++;
12348 }
12349
12350 void
12351 sctp_send_cwrcxx . . $ sctp_send_cwr(c22ddf3ee021e0b3).(struct sctp_tcbcxx . . $ sctp_tcb# *stcb, struct sctp_netscxx . . $ sctp_nets# *net, uint32_tcxx . . $ uint32_t# high_tsn, uint8_tcxx . . $ uint8_t# override)
12352 {
12353 struct sctp_associationcxx . . $ sctp_association# *asoc;
12354 struct sctp_cwr_chunkcxx . . $ sctp_cwr_chunk# *cwr;
12355 struct sctp_tmit_chunkcxx . . $ sctp_tmit_chunk# *chk;
12356
12357 SCTP_TCB_LOCK_ASSERTcxx . . $ `usrsctplib/netinet/sctp_process_lock.h:478:9`!(stcb);
12358 if (net == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!) {
12359 return;
12360 }
12361 asoc = &stcb->asoccxx . . $ sctp_tcb#asoc.;
12362 TAILQ_FOREACHcxx . . $ `<external>/2546723208511035544/queue.h:435:9`!(chk, &asoc->control_send_queue, sctp_next) {
12363 if ((chk->reccxx . . $ sctp_tmit_chunk#rec..chunk_idcxx . . $ sctp_tmit_chunk#$anonymous_type_3#chunk_id..idcxx . . $ chk_id#id. == SCTP_ECN_CWRcxx . . $ `usrsctplib/netinet/sctp.h:462:9`!) && (net == chk->whoTocxx . . $ sctp_tmit_chunk#whoTo.)) {
12364 /* found a previous CWR queued to same destination update it if needed */
12365 uint32_tcxx . . $ uint32_t# ctsn;
12366 cwr = mtodcxx . . $ `usrsctplib/user_mbuf.h:96:9`!(chk->data, struct sctp_cwr_chunk *);
12367 ctsn = ntohlcxx . . $ ntohl(2141b656ce2cc063).(cwr->tsncxx . . $ sctp_cwr_chunk#tsn.);
12368 if (SCTP_TSN_GTcxx . . $ `usrsctplib/netinet/sctp_constants.h:893:9`!(high_tsn, ctsn)) {
12369 cwr->tsncxx . . $ sctp_cwr_chunk#tsn. = htonlcxx . . $ htonl(2141b656ce2cc063).(high_tsn);
12370 }
12371 if (override & SCTP_CWR_REDUCE_OVERRIDEcxx . . $ `usrsctplib/netinet/sctp.h:496:9`!) {
12372 /* Make sure override is carried */
12373 cwr->chcxx . . $ sctp_cwr_chunk#ch..chunk_flagscxx . . $ sctp_chunkhdr#chunk_flags. |= SCTP_CWR_REDUCE_OVERRIDEcxx . . $ `usrsctplib/netinet/sctp.h:496:9`!;
12374 }
12375 return;
12376 }
12377 }
12378 sctp_alloc_a_chunkcxx . . $ `usrsctplib/netinet/sctp_var.h:170:9`!(stcb, chk);
12379 if (chk == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!) {
12380 return;
12381 }
12382 chk->copy_by_refcxx . . $ sctp_tmit_chunk#copy_by_ref. = 0;
12383 chk->reccxx . . $ sctp_tmit_chunk#rec..chunk_idcxx . . $ sctp_tmit_chunk#$anonymous_type_3#chunk_id..idcxx . . $ chk_id#id. = SCTP_ECN_CWRcxx . . $ `usrsctplib/netinet/sctp.h:462:9`!;
12384 chk->reccxx . . $ sctp_tmit_chunk#rec..chunk_idcxx . . $ sctp_tmit_chunk#$anonymous_type_3#chunk_id..can_take_datacxx . . $ chk_id#can_take_data. = 1;
12385 chk->flagscxx . . $ sctp_tmit_chunk#flags. = 0;
12386 chk->asoccxx . . $ sctp_tmit_chunk#asoc. = &stcb->asoccxx . . $ sctp_tcb#asoc.;
12387 chk->send_sizecxx . . $ sctp_tmit_chunk#send_size. = sizeof(struct sctp_cwr_chunkcxx . . $ sctp_cwr_chunk#);
12388 chk->datacxx . . $ sctp_tmit_chunk#data. = sctp_get_mbuf_for_msgcxx . . $ sctp_get_mbuf_for_msg(c7c30fc329598377).(chk->send_sizecxx . . $ sctp_tmit_chunk#send_size., 0, M_NOWAITcxx . . $ `usrsctplib/user_malloc.h:60:9`!, 1, MT_HEADERcxx . . $ `usrsctplib/user_mbuf.h:290:9`!);
12389 if (chk->datacxx . . $ sctp_tmit_chunk#data. == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!) {
12390 sctp_free_a_chunkcxx . . $ `usrsctplib/netinet/sctp_var.h:144:9`!(stcb, chk, SCTP_SO_NOT_LOCKEDcxx . . $ `usrsctplib/netinet/sctp_constants.h:964:9`!);
12391 return;
12392 }
12393 SCTP_BUF_RESV_UFcxx . . $ `usrsctplib/netinet/sctp_os_userspace.h:793:9`!(chk->data, SCTP_MIN_OVERHEADcxx . . $ `usrsctplib/netinet/sctp_header.h:561:9`!);
12394 SCTP_BUF_LENcxx . . $ `usrsctplib/netinet/sctp_os_userspace.h:790:9`!(chk->data) = chk->send_sizecxx . . $ sctp_tmit_chunk#send_size.;
12395 chk->sentcxx . . $ sctp_tmit_chunk#sent. = SCTP_DATAGRAM_UNSENTcxx . . $ `usrsctplib/netinet/sctp_constants.h:353:9`!;
12396 chk->snd_countcxx . . $ sctp_tmit_chunk#snd_count. = 0;
12397 chk->whoTocxx . . $ sctp_tmit_chunk#whoTo. = net;
12398 atomic_add_intcxx . . $ `usrsctplib/user_atomic.h:94:9`!(&chk->whoTo->ref_count, 1);
12399 cwr = mtodcxx . . $ `usrsctplib/user_mbuf.h:96:9`!(chk->data, struct sctp_cwr_chunk *);
12400 cwr->chcxx . . $ sctp_cwr_chunk#ch..chunk_typecxx . . $ sctp_chunkhdr#chunk_type. = SCTP_ECN_CWRcxx . . $ `usrsctplib/netinet/sctp.h:462:9`!;
12401 cwr->chcxx . . $ sctp_cwr_chunk#ch..chunk_flagscxx . . $ sctp_chunkhdr#chunk_flags. = override;
12402 cwr->chcxx . . $ sctp_cwr_chunk#ch..chunk_lengthcxx . . $ sctp_chunkhdr#chunk_length. = htonscxx . . $ htons(a18c05e4017afb3d).(sizeof(struct sctp_cwr_chunkcxx . . $ sctp_cwr_chunk#));
12403 cwr->tsncxx . . $ sctp_cwr_chunk#tsn. = htonlcxx . . $ htonl(2141b656ce2cc063).(high_tsn);
12404 TAILQ_INSERT_TAILcxx . . $ `<external>/2546723208511035544/queue.h:402:9`!(&stcb->asoc.control_send_queue, chk, sctp_next);
12405 asoc->ctrl_queue_cntcxx . . $ sctp_association#ctrl_queue_cnt.++;
12406 }
12407
12408 static int
12409 sctp_add_stream_reset_outcxx . . $ sctp_add_stream_reset_out(6a92e992b29a855b).(struct sctp_tcbcxx . . $ sctp_tcb# *stcb, struct sctp_tmit_chunkcxx . . $ sctp_tmit_chunk# *chk,
12410 uint32_tcxx . . $ uint32_t# seq, uint32_tcxx . . $ uint32_t# resp_seq, uint32_tcxx . . $ uint32_t# last_sent)
12411 {
12412 uint16_tcxx . . $ uint16_t# len, old_len, i;
12413 struct sctp_stream_reset_out_requestcxx . . $ sctp_stream_reset_out_request# *req_out;
12414 struct sctp_chunkhdrcxx . . $ sctp_chunkhdr# *ch;
12415 int at;
12416 int number_entries=0;
12417
12418 ch = mtodcxx . . $ `usrsctplib/user_mbuf.h:96:9`!(chk->data, struct sctp_chunkhdr *);
12419 old_len = len = SCTP_SIZE32cxx . . $ `usrsctplib/netinet/sctp_constants.h:388:9`!(ntohs(ch->chunk_length));
12420 /* get to new offset for the param. */
12421 req_out = (struct sctp_stream_reset_out_requestcxx . . $ sctp_stream_reset_out_request# *)((caddr_tcxx . . $ caddr_t#)ch + len);
12422 /* now how long will this param be? */
12423 for (i = 0; i < stcb->asoccxx . . $ sctp_tcb#asoc..streamoutcntcxx . . $ sctp_association#streamoutcnt.; i++) {
12424 if ((stcb->asoccxx . . $ sctp_tcb#asoc..strmoutcxx . . $ sctp_association#strmout.[i].statecxx . . $ sctp_stream_out#state. == SCTP_STREAM_RESET_PENDINGcxx . . $ `usrsctplib/netinet/sctp_structs.h:651:9`!) &&
12425 (stcb->asoccxx . . $ sctp_tcb#asoc..strmoutcxx . . $ sctp_association#strmout.[i].chunks_on_queuescxx . . $ sctp_stream_out#chunks_on_queues. == 0) &&
12426 TAILQ_EMPTYcxx . . $ `<external>/2546723208511035544/queue.h:457:9`!(&stcb->asoc.strmout[i].outqueue)) {
12427 number_entries++;
12428 }
12429 }
12430 if (number_entries == 0) {
12431 return (0);
12432 }
12433 if (number_entries == stcb->asoccxx . . $ sctp_tcb#asoc..streamoutcntcxx . . $ sctp_association#streamoutcnt.) {
12434 number_entries = 0;
12435 }
12436 if (number_entries > SCTP_MAX_STREAMS_AT_ONCE_RESETcxx . . $ `usrsctplib/netinet/sctp_structs.h:654:9`!) {
12437 number_entries = SCTP_MAX_STREAMS_AT_ONCE_RESETcxx . . $ `usrsctplib/netinet/sctp_structs.h:654:9`!;
12438 }
12439 len = (uint16_tcxx . . $ uint16_t#)(sizeof(struct sctp_stream_reset_out_requestcxx . . $ sctp_stream_reset_out_request#) + (sizeof(uint16_tcxx . . $ uint16_t#) * number_entries));
12440 req_out->phcxx . . $ sctp_stream_reset_out_request#ph..param_typecxx . . $ sctp_paramhdr#param_type. = htonscxx . . $ htons(a18c05e4017afb3d).(SCTP_STR_RESET_OUT_REQUESTcxx . . $ `usrsctplib/netinet/sctp_constants.h:408:9`!);
12441 req_out->phcxx . . $ sctp_stream_reset_out_request#ph..param_lengthcxx . . $ sctp_paramhdr#param_length. = htonscxx . . $ htons(a18c05e4017afb3d).(len);
12442 req_out->request_seqcxx . . $ sctp_stream_reset_out_request#request_seq. = htonlcxx . . $ htonl(2141b656ce2cc063).(seq);
12443 req_out->response_seqcxx . . $ sctp_stream_reset_out_request#response_seq. = htonlcxx . . $ htonl(2141b656ce2cc063).(resp_seq);
12444 req_out->send_reset_at_tsncxx . . $ sctp_stream_reset_out_request#send_reset_at_tsn. = htonlcxx . . $ htonl(2141b656ce2cc063).(last_sent);
12445 at = 0;
12446 if (number_entries) {
12447 for (i = 0; i < stcb->asoccxx . . $ sctp_tcb#asoc..streamoutcntcxx . . $ sctp_association#streamoutcnt.; i++) {
12448 if ((stcb->asoccxx . . $ sctp_tcb#asoc..strmoutcxx . . $ sctp_association#strmout.[i].statecxx . . $ sctp_stream_out#state. == SCTP_STREAM_RESET_PENDINGcxx . . $ `usrsctplib/netinet/sctp_structs.h:651:9`!) &&
12449 (stcb->asoccxx . . $ sctp_tcb#asoc..strmoutcxx . . $ sctp_association#strmout.[i].chunks_on_queuescxx . . $ sctp_stream_out#chunks_on_queues. == 0) &&
12450 TAILQ_EMPTYcxx . . $ `<external>/2546723208511035544/queue.h:457:9`!(&stcb->asoc.strmout[i].outqueue)) {
12451 req_out->list_of_streamscxx . . $ sctp_stream_reset_out_request#list_of_streams.[at] = htonscxx . . $ htons(a18c05e4017afb3d).(i);
12452 at++;
12453 stcb->asoccxx . . $ sctp_tcb#asoc..strmoutcxx . . $ sctp_association#strmout.[i].statecxx . . $ sctp_stream_out#state. = SCTP_STREAM_RESET_IN_FLIGHTcxx . . $ `usrsctplib/netinet/sctp_structs.h:652:9`!;
12454 if (at >= number_entries) {
12455 break;
12456 }
12457 }
12458 }
12459 } else {
12460 for (i = 0; i < stcb->asoccxx . . $ sctp_tcb#asoc..streamoutcntcxx . . $ sctp_association#streamoutcnt.; i++) {
12461 stcb->asoccxx . . $ sctp_tcb#asoc..strmoutcxx . . $ sctp_association#strmout.[i].statecxx . . $ sctp_stream_out#state. = SCTP_STREAM_RESET_IN_FLIGHTcxx . . $ `usrsctplib/netinet/sctp_structs.h:652:9`!;
12462 }
12463 }
12464 if (SCTP_SIZE32cxx . . $ `usrsctplib/netinet/sctp_constants.h:388:9`!(len) > len) {
12465 /*-
12466 * Need to worry about the pad we may end up adding to the
12467 * end. This is easy since the struct is either aligned to 4
12468 * bytes or 2 bytes off.
12469 */
12470 req_out->list_of_streamscxx . . $ sctp_stream_reset_out_request#list_of_streams.[number_entries] = 0;
12471 }
12472 /* now fix the chunk length */
12473 ch->chunk_lengthcxx . . $ sctp_chunkhdr#chunk_length. = htonscxx . . $ htons(a18c05e4017afb3d).(len + old_len);
12474 chk->book_sizecxx . . $ sctp_tmit_chunk#book_size. = len + old_len;
12475 chk->book_size_scalecxx . . $ sctp_tmit_chunk#book_size_scale. = 0;
12476 chk->send_sizecxx . . $ sctp_tmit_chunk#send_size. = SCTP_SIZE32cxx . . $ `usrsctplib/netinet/sctp_constants.h:388:9`!(chk->book_size);
12477 SCTP_BUF_LENcxx . . $ `usrsctplib/netinet/sctp_os_userspace.h:790:9`!(chk->data) = chk->send_sizecxx . . $ sctp_tmit_chunk#send_size.;
12478 return (1);
12479 }
12480
12481 static void
12482 sctp_add_stream_reset_incxx . . $ sctp_add_stream_reset_in(ed9c13f2cf4d8ff3).(struct sctp_tmit_chunkcxx . . $ sctp_tmit_chunk# *chk,
12483 int number_entries, uint16_tcxx . . $ uint16_t# *list,
12484 uint32_tcxx . . $ uint32_t# seq)
12485 {
12486 uint16_tcxx . . $ uint16_t# len, old_len, i;
12487 struct sctp_stream_reset_in_requestcxx . . $ sctp_stream_reset_in_request# *req_in;
12488 struct sctp_chunkhdrcxx . . $ sctp_chunkhdr# *ch;
12489
12490 ch = mtodcxx . . $ `usrsctplib/user_mbuf.h:96:9`!(chk->data, struct sctp_chunkhdr *);
12491 old_len = len = SCTP_SIZE32cxx . . $ `usrsctplib/netinet/sctp_constants.h:388:9`!(ntohs(ch->chunk_length));
12492
12493 /* get to new offset for the param. */
12494 req_in = (struct sctp_stream_reset_in_requestcxx . . $ sctp_stream_reset_in_request# *)((caddr_tcxx . . $ caddr_t#)ch + len);
12495 /* now how long will this param be? */
12496 len = (uint16_tcxx . . $ uint16_t#)(sizeof(struct sctp_stream_reset_in_requestcxx . . $ sctp_stream_reset_in_request#) + (sizeof(uint16_tcxx . . $ uint16_t#) * number_entries));
12497 req_in->phcxx . . $ sctp_stream_reset_in_request#ph..param_typecxx . . $ sctp_paramhdr#param_type. = htonscxx . . $ htons(a18c05e4017afb3d).(SCTP_STR_RESET_IN_REQUESTcxx . . $ `usrsctplib/netinet/sctp_constants.h:409:9`!);
12498 req_in->phcxx . . $ sctp_stream_reset_in_request#ph..param_lengthcxx . . $ sctp_paramhdr#param_length. = htonscxx . . $ htons(a18c05e4017afb3d).(len);
12499 req_in->request_seqcxx . . $ sctp_stream_reset_in_request#request_seq. = htonlcxx . . $ htonl(2141b656ce2cc063).(seq);
12500 if (number_entries) {
12501 for (i = 0; i < number_entries; i++) {
12502 req_in->list_of_streamscxx . . $ sctp_stream_reset_in_request#list_of_streams.[i] = htonscxx . . $ htons(a18c05e4017afb3d).(list[i]);
12503 }
12504 }
12505 if (SCTP_SIZE32cxx . . $ `usrsctplib/netinet/sctp_constants.h:388:9`!(len) > len) {
12506 /*-
12507 * Need to worry about the pad we may end up adding to the
12508 * end. This is easy since the struct is either aligned to 4
12509 * bytes or 2 bytes off.
12510 */
12511 req_in->list_of_streamscxx . . $ sctp_stream_reset_in_request#list_of_streams.[number_entries] = 0;
12512 }
12513 /* now fix the chunk length */
12514 ch->chunk_lengthcxx . . $ sctp_chunkhdr#chunk_length. = htonscxx . . $ htons(a18c05e4017afb3d).(len + old_len);
12515 chk->book_sizecxx . . $ sctp_tmit_chunk#book_size. = len + old_len;
12516 chk->book_size_scalecxx . . $ sctp_tmit_chunk#book_size_scale. = 0;
12517 chk->send_sizecxx . . $ sctp_tmit_chunk#send_size. = SCTP_SIZE32cxx . . $ `usrsctplib/netinet/sctp_constants.h:388:9`!(chk->book_size);
12518 SCTP_BUF_LENcxx . . $ `usrsctplib/netinet/sctp_os_userspace.h:790:9`!(chk->data) = chk->send_sizecxx . . $ sctp_tmit_chunk#send_size.;
12519 return;
12520 }
12521
12522 static void
12523 sctp_add_stream_reset_tsncxx . . $ sctp_add_stream_reset_tsn(8220631b27122eaf).(struct sctp_tmit_chunkcxx . . $ sctp_tmit_chunk# *chk,
12524 uint32_tcxx . . $ uint32_t# seq)
12525 {
12526 uint16_tcxx . . $ uint16_t# len, old_len;
12527 struct sctp_stream_reset_tsn_requestcxx . . $ sctp_stream_reset_tsn_request# *req_tsn;
12528 struct sctp_chunkhdrcxx . . $ sctp_chunkhdr# *ch;
12529
12530 ch = mtodcxx . . $ `usrsctplib/user_mbuf.h:96:9`!(chk->data, struct sctp_chunkhdr *);
12531 old_len = len = SCTP_SIZE32cxx . . $ `usrsctplib/netinet/sctp_constants.h:388:9`!(ntohs(ch->chunk_length));
12532
12533 /* get to new offset for the param. */
12534 req_tsn = (struct sctp_stream_reset_tsn_requestcxx . . $ sctp_stream_reset_tsn_request# *)((caddr_tcxx . . $ caddr_t#)ch + len);
12535 /* now how long will this param be? */
12536 len = sizeof(struct sctp_stream_reset_tsn_requestcxx . . $ sctp_stream_reset_tsn_request#);
12537 req_tsn->phcxx . . $ sctp_stream_reset_tsn_request#ph..param_typecxx . . $ sctp_paramhdr#param_type. = htonscxx . . $ htons(a18c05e4017afb3d).(SCTP_STR_RESET_TSN_REQUESTcxx . . $ `usrsctplib/netinet/sctp_constants.h:410:9`!);
12538 req_tsn->phcxx . . $ sctp_stream_reset_tsn_request#ph..param_lengthcxx . . $ sctp_paramhdr#param_length. = htonscxx . . $ htons(a18c05e4017afb3d).(len);
12539 req_tsn->request_seqcxx . . $ sctp_stream_reset_tsn_request#request_seq. = htonlcxx . . $ htonl(2141b656ce2cc063).(seq);
12540
12541 /* now fix the chunk length */
12542 ch->chunk_lengthcxx . . $ sctp_chunkhdr#chunk_length. = htonscxx . . $ htons(a18c05e4017afb3d).(len + old_len);
12543 chk->send_sizecxx . . $ sctp_tmit_chunk#send_size. = len + old_len;
12544 chk->book_sizecxx . . $ sctp_tmit_chunk#book_size. = SCTP_SIZE32cxx . . $ `usrsctplib/netinet/sctp_constants.h:388:9`!(chk->send_size);
12545 chk->book_size_scalecxx . . $ sctp_tmit_chunk#book_size_scale. = 0;
12546 SCTP_BUF_LENcxx . . $ `usrsctplib/netinet/sctp_os_userspace.h:790:9`!(chk->data) = SCTP_SIZE32cxx . . $ `usrsctplib/netinet/sctp_constants.h:388:9`!(chk->send_size);
12547 return;
12548 }
12549
12550 void
12551 sctp_add_stream_reset_resultcxx . . $ sctp_add_stream_reset_result(79ae0b04e69c142).(struct sctp_tmit_chunkcxx . . $ sctp_tmit_chunk# *chk,
12552 uint32_tcxx . . $ uint32_t# resp_seq, uint32_tcxx . . $ uint32_t# result)
12553 {
12554 uint16_tcxx . . $ uint16_t# len, old_len;
12555 struct sctp_stream_reset_responsecxx . . $ sctp_stream_reset_response# *resp;
12556 struct sctp_chunkhdrcxx . . $ sctp_chunkhdr# *ch;
12557
12558 ch = mtodcxx . . $ `usrsctplib/user_mbuf.h:96:9`!(chk->data, struct sctp_chunkhdr *);
12559 old_len = len = SCTP_SIZE32cxx . . $ `usrsctplib/netinet/sctp_constants.h:388:9`!(ntohs(ch->chunk_length));
12560
12561 /* get to new offset for the param. */
12562 resp = (struct sctp_stream_reset_responsecxx . . $ sctp_stream_reset_response# *)((caddr_tcxx . . $ caddr_t#)ch + len);
12563 /* now how long will this param be? */
12564 len = sizeof(struct sctp_stream_reset_responsecxx . . $ sctp_stream_reset_response#);
12565 resp->phcxx . . $ sctp_stream_reset_response#ph..param_typecxx . . $ sctp_paramhdr#param_type. = htonscxx . . $ htons(a18c05e4017afb3d).(SCTP_STR_RESET_RESPONSEcxx . . $ `usrsctplib/netinet/sctp_constants.h:411:9`!);
12566 resp->phcxx . . $ sctp_stream_reset_response#ph..param_lengthcxx . . $ sctp_paramhdr#param_length. = htonscxx . . $ htons(a18c05e4017afb3d).(len);
12567 resp->response_seqcxx . . $ sctp_stream_reset_response#response_seq. = htonlcxx . . $ htonl(2141b656ce2cc063).(resp_seq);
12568 resp->resultcxx . . $ sctp_stream_reset_response#result. = ntohlcxx . . $ ntohl(2141b656ce2cc063).(result);
12569
12570 /* now fix the chunk length */
12571 ch->chunk_lengthcxx . . $ sctp_chunkhdr#chunk_length. = htonscxx . . $ htons(a18c05e4017afb3d).(len + old_len);
12572 chk->book_sizecxx . . $ sctp_tmit_chunk#book_size. = len + old_len;
12573 chk->book_size_scalecxx . . $ sctp_tmit_chunk#book_size_scale. = 0;
12574 chk->send_sizecxx . . $ sctp_tmit_chunk#send_size. = SCTP_SIZE32cxx . . $ `usrsctplib/netinet/sctp_constants.h:388:9`!(chk->book_size);
12575 SCTP_BUF_LENcxx . . $ `usrsctplib/netinet/sctp_os_userspace.h:790:9`!(chk->data) = chk->send_sizecxx . . $ sctp_tmit_chunk#send_size.;
12576 return;
12577 }
12578
12579 void
12580 sctp_send_deferred_reset_responsecxx . . $ sctp_send_deferred_reset_response(e548410f048ddb78).(struct sctp_tcbcxx . . $ sctp_tcb# *stcb,
12581 struct sctp_stream_reset_listcxx . . $ sctp_stream_reset_list# *ent,
12582 int response)
12583 {
12584 struct sctp_associationcxx . . $ sctp_association# *asoc;
12585 struct sctp_tmit_chunkcxx . . $ sctp_tmit_chunk# *chk;
12586 struct sctp_chunkhdrcxx . . $ sctp_chunkhdr# *ch;
12587
12588 asoc = &stcb->asoccxx . . $ sctp_tcb#asoc.;
12589
12590 /*
12591 * Reset our last reset action to the new one IP -> response
12592 * (PERFORMED probably). This assures that if we fail to send, a
12593 * retran from the peer will get the new response.
12594 */
12595 asoc->last_reset_actioncxx . . $ sctp_association#last_reset_action.[0] = response;
12596 if (asoc->stream_reset_outstandingcxx . . $ sctp_association#stream_reset_outstanding.) {
12597 return;
12598 }
12599 sctp_alloc_a_chunkcxx . . $ `usrsctplib/netinet/sctp_var.h:170:9`!(stcb, chk);
12600 if (chk == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!) {
12601 SCTP_LTRACE_ERR_RETcxx . . $ `usrsctplib/netinet/sctp_os_userspace.h:629:9`!(NULL, stcb, NULL, SCTP_FROM_SCTP_OUTPUT, ENOMEM);
12602 return;
12603 }
12604 chk->copy_by_refcxx . . $ sctp_tmit_chunk#copy_by_ref. = 0;
12605 chk->reccxx . . $ sctp_tmit_chunk#rec..chunk_idcxx . . $ sctp_tmit_chunk#$anonymous_type_3#chunk_id..idcxx . . $ chk_id#id. = SCTP_STREAM_RESETcxx . . $ `usrsctplib/netinet/sctp.h:476:9`!;
12606 chk->reccxx . . $ sctp_tmit_chunk#rec..chunk_idcxx . . $ sctp_tmit_chunk#$anonymous_type_3#chunk_id..can_take_datacxx . . $ chk_id#can_take_data. = 0;
12607 chk->flagscxx . . $ sctp_tmit_chunk#flags. = 0;
12608 chk->asoccxx . . $ sctp_tmit_chunk#asoc. = &stcb->asoccxx . . $ sctp_tcb#asoc.;
12609 chk->book_sizecxx . . $ sctp_tmit_chunk#book_size. = sizeof(struct sctp_chunkhdrcxx . . $ sctp_chunkhdr#);
12610 chk->send_sizecxx . . $ sctp_tmit_chunk#send_size. = SCTP_SIZE32cxx . . $ `usrsctplib/netinet/sctp_constants.h:388:9`!(chk->book_size);
12611 chk->book_size_scalecxx . . $ sctp_tmit_chunk#book_size_scale. = 0;
12612 chk->datacxx . . $ sctp_tmit_chunk#data. = sctp_get_mbuf_for_msgcxx . . $ sctp_get_mbuf_for_msg(c7c30fc329598377).(MCLBYTEScxx . . $ `usrsctplib/user_mbuf.h:51:9`!, 0, M_NOWAITcxx . . $ `usrsctplib/user_malloc.h:60:9`!, 1, MT_DATAcxx . . $ `usrsctplib/user_mbuf.h:289:9`!);
12613 if (chk->datacxx . . $ sctp_tmit_chunk#data. == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!) {
12614 sctp_free_a_chunkcxx . . $ `usrsctplib/netinet/sctp_var.h:144:9`!(stcb, chk, SCTP_SO_LOCKEDcxx . . $ `usrsctplib/netinet/sctp_constants.h:963:9`!);
12615 SCTP_LTRACE_ERR_RETcxx . . $ `usrsctplib/netinet/sctp_os_userspace.h:629:9`!(NULL, stcb, NULL, SCTP_FROM_SCTP_OUTPUT, ENOMEM);
12616 return;
12617 }
12618 SCTP_BUF_RESV_UFcxx . . $ `usrsctplib/netinet/sctp_os_userspace.h:793:9`!(chk->data, SCTP_MIN_OVERHEADcxx . . $ `usrsctplib/netinet/sctp_header.h:561:9`!);
12619 /* setup chunk parameters */
12620 chk->sentcxx . . $ sctp_tmit_chunk#sent. = SCTP_DATAGRAM_UNSENTcxx . . $ `usrsctplib/netinet/sctp_constants.h:353:9`!;
12621 chk->snd_countcxx . . $ sctp_tmit_chunk#snd_count. = 0;
12622 if (stcb->asoccxx . . $ sctp_tcb#asoc..alternatecxx . . $ sctp_association#alternate.) {
12623 chk->whoTocxx . . $ sctp_tmit_chunk#whoTo. = stcb->asoccxx . . $ sctp_tcb#asoc..alternatecxx . . $ sctp_association#alternate.;
12624 } else {
12625 chk->whoTocxx . . $ sctp_tmit_chunk#whoTo. = stcb->asoccxx . . $ sctp_tcb#asoc..primary_destinationcxx . . $ sctp_association#primary_destination.;
12626 }
12627 ch = mtodcxx . . $ `usrsctplib/user_mbuf.h:96:9`!(chk->data, struct sctp_chunkhdr *);
12628 ch->chunk_typecxx . . $ sctp_chunkhdr#chunk_type. = SCTP_STREAM_RESETcxx . . $ `usrsctplib/netinet/sctp.h:476:9`!;
12629 ch->chunk_flagscxx . . $ sctp_chunkhdr#chunk_flags. = 0;
12630 ch->chunk_lengthcxx . . $ sctp_chunkhdr#chunk_length. = htonscxx . . $ htons(a18c05e4017afb3d).(chk->book_sizecxx . . $ sctp_tmit_chunk#book_size.);
12631 atomic_add_intcxx . . $ `usrsctplib/user_atomic.h:94:9`!(&chk->whoTo->ref_count, 1);
12632 SCTP_BUF_LENcxx . . $ `usrsctplib/netinet/sctp_os_userspace.h:790:9`!(chk->data) = chk->send_sizecxx . . $ sctp_tmit_chunk#send_size.;
12633 sctp_add_stream_reset_resultcxx . . $ sctp_add_stream_reset_result(79ae0b04e69c142).(chk, ent->seqcxx . . $ sctp_stream_reset_list#seq., response);
12634 /* insert the chunk for sending */
12635 TAILQ_INSERT_TAILcxx . . $ `<external>/2546723208511035544/queue.h:402:9`!(&asoc->control_send_queue,
12636 chk,
12637 sctp_next);
12638 asoc->ctrl_queue_cntcxx . . $ sctp_association#ctrl_queue_cnt.++;
12639 }
12640
12641 void
12642 sctp_add_stream_reset_result_tsncxx . . $ sctp_add_stream_reset_result_tsn(914d9e3432381c4a).(struct sctp_tmit_chunkcxx . . $ sctp_tmit_chunk# *chk,
12643 uint32_tcxx . . $ uint32_t# resp_seq, uint32_tcxx . . $ uint32_t# result,
12644 uint32_tcxx . . $ uint32_t# send_una, uint32_tcxx . . $ uint32_t# recv_next)
12645 {
12646 uint16_tcxx . . $ uint16_t# len, old_len;
12647 struct sctp_stream_reset_response_tsncxx . . $ sctp_stream_reset_response_tsn# *resp;
12648 struct sctp_chunkhdrcxx . . $ sctp_chunkhdr# *ch;
12649
12650 ch = mtodcxx . . $ `usrsctplib/user_mbuf.h:96:9`!(chk->data, struct sctp_chunkhdr *);
12651 old_len = len = SCTP_SIZE32cxx . . $ `usrsctplib/netinet/sctp_constants.h:388:9`!(ntohs(ch->chunk_length));
12652
12653 /* get to new offset for the param. */
12654 resp = (struct sctp_stream_reset_response_tsncxx . . $ sctp_stream_reset_response_tsn# *)((caddr_tcxx . . $ caddr_t#)ch + len);
12655 /* now how long will this param be? */
12656 len = sizeof(struct sctp_stream_reset_response_tsncxx . . $ sctp_stream_reset_response_tsn#);
12657 resp->phcxx . . $ sctp_stream_reset_response_tsn#ph..param_typecxx . . $ sctp_paramhdr#param_type. = htonscxx . . $ htons(a18c05e4017afb3d).(SCTP_STR_RESET_RESPONSEcxx . . $ `usrsctplib/netinet/sctp_constants.h:411:9`!);
12658 resp->phcxx . . $ sctp_stream_reset_response_tsn#ph..param_lengthcxx . . $ sctp_paramhdr#param_length. = htonscxx . . $ htons(a18c05e4017afb3d).(len);
12659 resp->response_seqcxx . . $ sctp_stream_reset_response_tsn#response_seq. = htonlcxx . . $ htonl(2141b656ce2cc063).(resp_seq);
12660 resp->resultcxx . . $ sctp_stream_reset_response_tsn#result. = htonlcxx . . $ htonl(2141b656ce2cc063).(result);
12661 resp->senders_next_tsncxx . . $ sctp_stream_reset_response_tsn#senders_next_tsn. = htonlcxx . . $ htonl(2141b656ce2cc063).(send_una);
12662 resp->receivers_next_tsncxx . . $ sctp_stream_reset_response_tsn#receivers_next_tsn. = htonlcxx . . $ htonl(2141b656ce2cc063).(recv_next);
12663
12664 /* now fix the chunk length */
12665 ch->chunk_lengthcxx . . $ sctp_chunkhdr#chunk_length. = htonscxx . . $ htons(a18c05e4017afb3d).(len + old_len);
12666 chk->book_sizecxx . . $ sctp_tmit_chunk#book_size. = len + old_len;
12667 chk->send_sizecxx . . $ sctp_tmit_chunk#send_size. = SCTP_SIZE32cxx . . $ `usrsctplib/netinet/sctp_constants.h:388:9`!(chk->book_size);
12668 chk->book_size_scalecxx . . $ sctp_tmit_chunk#book_size_scale. = 0;
12669 SCTP_BUF_LENcxx . . $ `usrsctplib/netinet/sctp_os_userspace.h:790:9`!(chk->data) = chk->send_sizecxx . . $ sctp_tmit_chunk#send_size.;
12670 return;
12671 }
12672
12673 static void
12674 sctp_add_an_out_streamcxx . . $ sctp_add_an_out_stream(d588b4ea68be4d64).(struct sctp_tmit_chunkcxx . . $ sctp_tmit_chunk# *chk,
12675 uint32_tcxx . . $ uint32_t# seq,
12676 uint16_tcxx . . $ uint16_t# adding)
12677 {
12678 uint16_tcxx . . $ uint16_t# len, old_len;
12679 struct sctp_chunkhdrcxx . . $ sctp_chunkhdr# *ch;
12680 struct sctp_stream_reset_add_strmcxx . . $ sctp_stream_reset_add_strm# *addstr;
12681
12682 ch = mtodcxx . . $ `usrsctplib/user_mbuf.h:96:9`!(chk->data, struct sctp_chunkhdr *);
12683 old_len = len = SCTP_SIZE32cxx . . $ `usrsctplib/netinet/sctp_constants.h:388:9`!(ntohs(ch->chunk_length));
12684
12685 /* get to new offset for the param. */
12686 addstr = (struct sctp_stream_reset_add_strmcxx . . $ sctp_stream_reset_add_strm# *)((caddr_tcxx . . $ caddr_t#)ch + len);
12687 /* now how long will this param be? */
12688 len = sizeof(struct sctp_stream_reset_add_strmcxx . . $ sctp_stream_reset_add_strm#);
12689
12690 /* Fill it out. */
12691 addstr->phcxx . . $ sctp_stream_reset_add_strm#ph..param_typecxx . . $ sctp_paramhdr#param_type. = htonscxx . . $ htons(a18c05e4017afb3d).(SCTP_STR_RESET_ADD_OUT_STREAMScxx . . $ `usrsctplib/netinet/sctp_constants.h:412:9`!);
12692 addstr->phcxx . . $ sctp_stream_reset_add_strm#ph..param_lengthcxx . . $ sctp_paramhdr#param_length. = htonscxx . . $ htons(a18c05e4017afb3d).(len);
12693 addstr->request_seqcxx . . $ sctp_stream_reset_add_strm#request_seq. = htonlcxx . . $ htonl(2141b656ce2cc063).(seq);
12694 addstr->number_of_streamscxx . . $ sctp_stream_reset_add_strm#number_of_streams. = htonscxx . . $ htons(a18c05e4017afb3d).(adding);
12695 addstr->reservedcxx . . $ sctp_stream_reset_add_strm#reserved. = 0;
12696
12697 /* now fix the chunk length */
12698 ch->chunk_lengthcxx . . $ sctp_chunkhdr#chunk_length. = htonscxx . . $ htons(a18c05e4017afb3d).(len + old_len);
12699 chk->send_sizecxx . . $ sctp_tmit_chunk#send_size. = len + old_len;
12700 chk->book_sizecxx . . $ sctp_tmit_chunk#book_size. = SCTP_SIZE32cxx . . $ `usrsctplib/netinet/sctp_constants.h:388:9`!(chk->send_size);
12701 chk->book_size_scalecxx . . $ sctp_tmit_chunk#book_size_scale. = 0;
12702 SCTP_BUF_LENcxx . . $ `usrsctplib/netinet/sctp_os_userspace.h:790:9`!(chk->data) = SCTP_SIZE32cxx . . $ `usrsctplib/netinet/sctp_constants.h:388:9`!(chk->send_size);
12703 return;
12704 }
12705
12706 static void
12707 sctp_add_an_in_streamcxx . . $ sctp_add_an_in_stream(d588b4ea68be4d64).(struct sctp_tmit_chunkcxx . . $ sctp_tmit_chunk# *chk,
12708 uint32_tcxx . . $ uint32_t# seq,
12709 uint16_tcxx . . $ uint16_t# adding)
12710 {
12711 uint16_tcxx . . $ uint16_t# len, old_len;
12712 struct sctp_chunkhdrcxx . . $ sctp_chunkhdr# *ch;
12713 struct sctp_stream_reset_add_strmcxx . . $ sctp_stream_reset_add_strm# *addstr;
12714
12715 ch = mtodcxx . . $ `usrsctplib/user_mbuf.h:96:9`!(chk->data, struct sctp_chunkhdr *);
12716 old_len = len = SCTP_SIZE32cxx . . $ `usrsctplib/netinet/sctp_constants.h:388:9`!(ntohs(ch->chunk_length));
12717
12718 /* get to new offset for the param. */
12719 addstr = (struct sctp_stream_reset_add_strmcxx . . $ sctp_stream_reset_add_strm# *)((caddr_tcxx . . $ caddr_t#)ch + len);
12720 /* now how long will this param be? */
12721 len = sizeof(struct sctp_stream_reset_add_strmcxx . . $ sctp_stream_reset_add_strm#);
12722 /* Fill it out. */
12723 addstr->phcxx . . $ sctp_stream_reset_add_strm#ph..param_typecxx . . $ sctp_paramhdr#param_type. = htonscxx . . $ htons(a18c05e4017afb3d).(SCTP_STR_RESET_ADD_IN_STREAMScxx . . $ `usrsctplib/netinet/sctp_constants.h:413:9`!);
12724 addstr->phcxx . . $ sctp_stream_reset_add_strm#ph..param_lengthcxx . . $ sctp_paramhdr#param_length. = htonscxx . . $ htons(a18c05e4017afb3d).(len);
12725 addstr->request_seqcxx . . $ sctp_stream_reset_add_strm#request_seq. = htonlcxx . . $ htonl(2141b656ce2cc063).(seq);
12726 addstr->number_of_streamscxx . . $ sctp_stream_reset_add_strm#number_of_streams. = htonscxx . . $ htons(a18c05e4017afb3d).(adding);
12727 addstr->reservedcxx . . $ sctp_stream_reset_add_strm#reserved. = 0;
12728
12729 /* now fix the chunk length */
12730 ch->chunk_lengthcxx . . $ sctp_chunkhdr#chunk_length. = htonscxx . . $ htons(a18c05e4017afb3d).(len + old_len);
12731 chk->send_sizecxx . . $ sctp_tmit_chunk#send_size. = len + old_len;
12732 chk->book_sizecxx . . $ sctp_tmit_chunk#book_size. = SCTP_SIZE32cxx . . $ `usrsctplib/netinet/sctp_constants.h:388:9`!(chk->send_size);
12733 chk->book_size_scalecxx . . $ sctp_tmit_chunk#book_size_scale. = 0;
12734 SCTP_BUF_LENcxx . . $ `usrsctplib/netinet/sctp_os_userspace.h:790:9`!(chk->data) = SCTP_SIZE32cxx . . $ `usrsctplib/netinet/sctp_constants.h:388:9`!(chk->send_size);
12735 return;
12736 }
12737
12738 int
12739 sctp_send_stream_reset_out_if_possiblecxx . . $ sctp_send_stream_reset_out_if_possible(ac3aa47b47eaac09).(struct sctp_tcbcxx . . $ sctp_tcb# *stcb, int so_locked)
12740 {
12741 struct sctp_associationcxx . . $ sctp_association# *asoc;
12742 struct sctp_tmit_chunkcxx . . $ sctp_tmit_chunk# *chk;
12743 struct sctp_chunkhdrcxx . . $ sctp_chunkhdr# *ch;
12744 uint32_tcxx . . $ uint32_t# seq;
12745
12746 asoc = &stcb->asoccxx . . $ sctp_tcb#asoc.;
12747 asoc->trigger_resetcxx . . $ sctp_association#trigger_reset. = 0;
12748 if (asoc->stream_reset_outstandingcxx . . $ sctp_association#stream_reset_outstanding.) {
12749 return (EALREADYcxx . . $ `<external>/17922322188510340118/errno.h:98:9`!);
12750 }
12751 sctp_alloc_a_chunkcxx . . $ `usrsctplib/netinet/sctp_var.h:170:9`!(stcb, chk);
12752 if (chk == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!) {
12753 SCTP_LTRACE_ERR_RETcxx . . $ `usrsctplib/netinet/sctp_os_userspace.h:629:9`!(NULL, stcb, NULL, SCTP_FROM_SCTP_OUTPUT, ENOMEM);
12754 return (ENOMEMcxx . . $ `<external>/8987895939074593727/errno-base.h:16:9`!);
12755 }
12756 chk->copy_by_refcxx . . $ sctp_tmit_chunk#copy_by_ref. = 0;
12757 chk->reccxx . . $ sctp_tmit_chunk#rec..chunk_idcxx . . $ sctp_tmit_chunk#$anonymous_type_3#chunk_id..idcxx . . $ chk_id#id. = SCTP_STREAM_RESETcxx . . $ `usrsctplib/netinet/sctp.h:476:9`!;
12758 chk->reccxx . . $ sctp_tmit_chunk#rec..chunk_idcxx . . $ sctp_tmit_chunk#$anonymous_type_3#chunk_id..can_take_datacxx . . $ chk_id#can_take_data. = 0;
12759 chk->flagscxx . . $ sctp_tmit_chunk#flags. = 0;
12760 chk->asoccxx . . $ sctp_tmit_chunk#asoc. = &stcb->asoccxx . . $ sctp_tcb#asoc.;
12761 chk->book_sizecxx . . $ sctp_tmit_chunk#book_size. = sizeof(struct sctp_chunkhdrcxx . . $ sctp_chunkhdr#);
12762 chk->send_sizecxx . . $ sctp_tmit_chunk#send_size. = SCTP_SIZE32cxx . . $ `usrsctplib/netinet/sctp_constants.h:388:9`!(chk->book_size);
12763 chk->book_size_scalecxx . . $ sctp_tmit_chunk#book_size_scale. = 0;
12764 chk->datacxx . . $ sctp_tmit_chunk#data. = sctp_get_mbuf_for_msgcxx . . $ sctp_get_mbuf_for_msg(c7c30fc329598377).(MCLBYTEScxx . . $ `usrsctplib/user_mbuf.h:51:9`!, 0, M_NOWAITcxx . . $ `usrsctplib/user_malloc.h:60:9`!, 1, MT_DATAcxx . . $ `usrsctplib/user_mbuf.h:289:9`!);
12765 if (chk->datacxx . . $ sctp_tmit_chunk#data. == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!) {
12766 sctp_free_a_chunkcxx . . $ `usrsctplib/netinet/sctp_var.h:144:9`!(stcb, chk, so_locked);
12767 SCTP_LTRACE_ERR_RETcxx . . $ `usrsctplib/netinet/sctp_os_userspace.h:629:9`!(NULL, stcb, NULL, SCTP_FROM_SCTP_OUTPUT, ENOMEM);
12768 return (ENOMEMcxx . . $ `<external>/8987895939074593727/errno-base.h:16:9`!);
12769 }
12770 SCTP_BUF_RESV_UFcxx . . $ `usrsctplib/netinet/sctp_os_userspace.h:793:9`!(chk->data, SCTP_MIN_OVERHEADcxx . . $ `usrsctplib/netinet/sctp_header.h:561:9`!);
12771
12772 /* setup chunk parameters */
12773 chk->sentcxx . . $ sctp_tmit_chunk#sent. = SCTP_DATAGRAM_UNSENTcxx . . $ `usrsctplib/netinet/sctp_constants.h:353:9`!;
12774 chk->snd_countcxx . . $ sctp_tmit_chunk#snd_count. = 0;
12775 if (stcb->asoccxx . . $ sctp_tcb#asoc..alternatecxx . . $ sctp_association#alternate.) {
12776 chk->whoTocxx . . $ sctp_tmit_chunk#whoTo. = stcb->asoccxx . . $ sctp_tcb#asoc..alternatecxx . . $ sctp_association#alternate.;
12777 } else {
12778 chk->whoTocxx . . $ sctp_tmit_chunk#whoTo. = stcb->asoccxx . . $ sctp_tcb#asoc..primary_destinationcxx . . $ sctp_association#primary_destination.;
12779 }
12780 ch = mtodcxx . . $ `usrsctplib/user_mbuf.h:96:9`!(chk->data, struct sctp_chunkhdr *);
12781 ch->chunk_typecxx . . $ sctp_chunkhdr#chunk_type. = SCTP_STREAM_RESETcxx . . $ `usrsctplib/netinet/sctp.h:476:9`!;
12782 ch->chunk_flagscxx . . $ sctp_chunkhdr#chunk_flags. = 0;
12783 ch->chunk_lengthcxx . . $ sctp_chunkhdr#chunk_length. = htonscxx . . $ htons(a18c05e4017afb3d).(chk->book_sizecxx . . $ sctp_tmit_chunk#book_size.);
12784 atomic_add_intcxx . . $ `usrsctplib/user_atomic.h:94:9`!(&chk->whoTo->ref_count, 1);
12785 SCTP_BUF_LENcxx . . $ `usrsctplib/netinet/sctp_os_userspace.h:790:9`!(chk->data) = chk->send_sizecxx . . $ sctp_tmit_chunk#send_size.;
12786 seq = stcb->asoccxx . . $ sctp_tcb#asoc..str_reset_seq_outcxx . . $ sctp_association#str_reset_seq_out.;
12787 if (sctp_add_stream_reset_outcxx . . $ sctp_add_stream_reset_out(6a92e992b29a855b).(stcb, chk, seq, (stcb->asoccxx . . $ sctp_tcb#asoc..str_reset_seq_incxx . . $ sctp_association#str_reset_seq_in. - 1), (stcb->asoccxx . . $ sctp_tcb#asoc..sending_seqcxx . . $ sctp_association#sending_seq. - 1))) {
12788 seq++;
12789 asoc->stream_reset_outstandingcxx . . $ sctp_association#stream_reset_outstanding.++;
12790 } else {
12791 m_freemcxx . . $ m_freem(b5fec356012cc555).(chk->datacxx . . $ sctp_tmit_chunk#data.);
12792 chk->datacxx . . $ sctp_tmit_chunk#data. = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!;
12793 sctp_free_a_chunkcxx . . $ `usrsctplib/netinet/sctp_var.h:144:9`!(stcb, chk, so_locked);
12794 return (ENOENTcxx . . $ `<external>/8987895939074593727/errno-base.h:6:9`!);
12795 }
12796 asoc->str_resetcxx . . $ sctp_association#str_reset. = chk;
12797 /* insert the chunk for sending */
12798 TAILQ_INSERT_TAILcxx . . $ `<external>/2546723208511035544/queue.h:402:9`!(&asoc->control_send_queue,
12799 chk,
12800 sctp_next);
12801 asoc->ctrl_queue_cntcxx . . $ sctp_association#ctrl_queue_cnt.++;
12802
12803 if (stcb->asoccxx . . $ sctp_tcb#asoc..send_sackcxx . . $ sctp_association#send_sack.) {
12804 sctp_send_sackcxx . . $ sctp_send_sack(309e9a20a883d7fc).(stcb, so_locked);
12805 }
12806 sctp_timer_startcxx . . $ sctp_timer_start(73c9263bfa4b937d).(SCTP_TIMER_TYPE_STRRESETcxx . . $ `usrsctplib/netinet/sctp_constants.h:549:9`!, stcb->sctp_epcxx . . $ sctp_tcb#sctp_ep., stcb, chk->whoTocxx . . $ sctp_tmit_chunk#whoTo.);
12807 return (0);
12808 }
12809
12810 int
12811 sctp_send_str_reset_reqcxx . . $ sctp_send_str_reset_req(9ddac443689ace4f).(struct sctp_tcbcxx . . $ sctp_tcb# *stcb,
12812 uint16_tcxx . . $ uint16_t# number_entries, uint16_tcxx . . $ uint16_t# *list,
12813 uint8_tcxx . . $ uint8_t# send_in_req,
12814 uint8_tcxx . . $ uint8_t# send_tsn_req,
12815 uint8_tcxx . . $ uint8_t# add_stream,
12816 uint16_tcxx . . $ uint16_t# adding_o,
12817 uint16_tcxx . . $ uint16_t# adding_i, uint8_tcxx . . $ uint8_t# peer_asked)
12818 {
12819 struct sctp_associationcxx . . $ sctp_association# *asoc;
12820 struct sctp_tmit_chunkcxx . . $ sctp_tmit_chunk# *chk;
12821 struct sctp_chunkhdrcxx . . $ sctp_chunkhdr# *ch;
12822 int can_send_out_req=0;
12823 uint32_tcxx . . $ uint32_t# seq;
12824
12825 asoc = &stcb->asoccxx . . $ sctp_tcb#asoc.;
12826 if (asoc->stream_reset_outstandingcxx . . $ sctp_association#stream_reset_outstanding.) {
12827 /*-
12828 * Already one pending, must get ACK back to clear the flag.
12829 */
12830 SCTP_LTRACE_ERR_RETcxx . . $ `usrsctplib/netinet/sctp_os_userspace.h:629:9`!(NULL, stcb, NULL, SCTP_FROM_SCTP_OUTPUT, EBUSY);
12831 return (EBUSYcxx . . $ `<external>/8987895939074593727/errno-base.h:20:9`!);
12832 }
12833 if ((send_in_req == 0) && (send_tsn_req == 0) &&
12834 (add_stream == 0)) {
12835 /* nothing to do */
12836 SCTP_LTRACE_ERR_RETcxx . . $ `usrsctplib/netinet/sctp_os_userspace.h:629:9`!(NULL, stcb, NULL, SCTP_FROM_SCTP_OUTPUT, EINVAL);
12837 return (EINVALcxx . . $ `<external>/8987895939074593727/errno-base.h:26:9`!);
12838 }
12839 if (send_tsn_req && send_in_req) {
12840 /* error, can't do that */
12841 SCTP_LTRACE_ERR_RETcxx . . $ `usrsctplib/netinet/sctp_os_userspace.h:629:9`!(NULL, stcb, NULL, SCTP_FROM_SCTP_OUTPUT, EINVAL);
12842 return (EINVALcxx . . $ `<external>/8987895939074593727/errno-base.h:26:9`!);
12843 } else if (send_in_req) {
12844 can_send_out_req = 1;
12845 }
12846 if (number_entries > (MCLBYTEScxx . . $ `usrsctplib/user_mbuf.h:51:9`! -
12847 SCTP_MIN_OVERHEADcxx . . $ `usrsctplib/netinet/sctp_header.h:561:9`! -
12848 sizeof(struct sctp_chunkhdrcxx . . $ sctp_chunkhdr#) -
12849 sizeof(struct sctp_stream_reset_out_requestcxx . . $ sctp_stream_reset_out_request#)) /
12850 sizeof(uint16_tcxx . . $ uint16_t#)) {
12851 SCTP_LTRACE_ERR_RETcxx . . $ `usrsctplib/netinet/sctp_os_userspace.h:629:9`!(NULL, stcb, NULL, SCTP_FROM_SCTP_OUTPUT, ENOMEM);
12852 return (ENOMEMcxx . . $ `<external>/8987895939074593727/errno-base.h:16:9`!);
12853 }
12854 sctp_alloc_a_chunkcxx . . $ `usrsctplib/netinet/sctp_var.h:170:9`!(stcb, chk);
12855 if (chk == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!) {
12856 SCTP_LTRACE_ERR_RETcxx . . $ `usrsctplib/netinet/sctp_os_userspace.h:629:9`!(NULL, stcb, NULL, SCTP_FROM_SCTP_OUTPUT, ENOMEM);
12857 return (ENOMEMcxx . . $ `<external>/8987895939074593727/errno-base.h:16:9`!);
12858 }
12859 chk->copy_by_refcxx . . $ sctp_tmit_chunk#copy_by_ref. = 0;
12860 chk->reccxx . . $ sctp_tmit_chunk#rec..chunk_idcxx . . $ sctp_tmit_chunk#$anonymous_type_3#chunk_id..idcxx . . $ chk_id#id. = SCTP_STREAM_RESETcxx . . $ `usrsctplib/netinet/sctp.h:476:9`!;
12861 chk->reccxx . . $ sctp_tmit_chunk#rec..chunk_idcxx . . $ sctp_tmit_chunk#$anonymous_type_3#chunk_id..can_take_datacxx . . $ chk_id#can_take_data. = 0;
12862 chk->flagscxx . . $ sctp_tmit_chunk#flags. = 0;
12863 chk->asoccxx . . $ sctp_tmit_chunk#asoc. = &stcb->asoccxx . . $ sctp_tcb#asoc.;
12864 chk->book_sizecxx . . $ sctp_tmit_chunk#book_size. = sizeof(struct sctp_chunkhdrcxx . . $ sctp_chunkhdr#);
12865 chk->send_sizecxx . . $ sctp_tmit_chunk#send_size. = SCTP_SIZE32cxx . . $ `usrsctplib/netinet/sctp_constants.h:388:9`!(chk->book_size);
12866 chk->book_size_scalecxx . . $ sctp_tmit_chunk#book_size_scale. = 0;
12867 chk->datacxx . . $ sctp_tmit_chunk#data. = sctp_get_mbuf_for_msgcxx . . $ sctp_get_mbuf_for_msg(c7c30fc329598377).(MCLBYTEScxx . . $ `usrsctplib/user_mbuf.h:51:9`!, 0, M_NOWAITcxx . . $ `usrsctplib/user_malloc.h:60:9`!, 1, MT_DATAcxx . . $ `usrsctplib/user_mbuf.h:289:9`!);
12868 if (chk->datacxx . . $ sctp_tmit_chunk#data. == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!) {
12869 sctp_free_a_chunkcxx . . $ `usrsctplib/netinet/sctp_var.h:144:9`!(stcb, chk, SCTP_SO_LOCKEDcxx . . $ `usrsctplib/netinet/sctp_constants.h:963:9`!);
12870 SCTP_LTRACE_ERR_RETcxx . . $ `usrsctplib/netinet/sctp_os_userspace.h:629:9`!(NULL, stcb, NULL, SCTP_FROM_SCTP_OUTPUT, ENOMEM);
12871 return (ENOMEMcxx . . $ `<external>/8987895939074593727/errno-base.h:16:9`!);
12872 }
12873 SCTP_BUF_RESV_UFcxx . . $ `usrsctplib/netinet/sctp_os_userspace.h:793:9`!(chk->data, SCTP_MIN_OVERHEADcxx . . $ `usrsctplib/netinet/sctp_header.h:561:9`!);
12874
12875 /* setup chunk parameters */
12876 chk->sentcxx . . $ sctp_tmit_chunk#sent. = SCTP_DATAGRAM_UNSENTcxx . . $ `usrsctplib/netinet/sctp_constants.h:353:9`!;
12877 chk->snd_countcxx . . $ sctp_tmit_chunk#snd_count. = 0;
12878 if (stcb->asoccxx . . $ sctp_tcb#asoc..alternatecxx . . $ sctp_association#alternate.) {
12879 chk->whoTocxx . . $ sctp_tmit_chunk#whoTo. = stcb->asoccxx . . $ sctp_tcb#asoc..alternatecxx . . $ sctp_association#alternate.;
12880 } else {
12881 chk->whoTocxx . . $ sctp_tmit_chunk#whoTo. = stcb->asoccxx . . $ sctp_tcb#asoc..primary_destinationcxx . . $ sctp_association#primary_destination.;
12882 }
12883 atomic_add_intcxx . . $ `usrsctplib/user_atomic.h:94:9`!(&chk->whoTo->ref_count, 1);
12884 ch = mtodcxx . . $ `usrsctplib/user_mbuf.h:96:9`!(chk->data, struct sctp_chunkhdr *);
12885 ch->chunk_typecxx . . $ sctp_chunkhdr#chunk_type. = SCTP_STREAM_RESETcxx . . $ `usrsctplib/netinet/sctp.h:476:9`!;
12886 ch->chunk_flagscxx . . $ sctp_chunkhdr#chunk_flags. = 0;
12887 ch->chunk_lengthcxx . . $ sctp_chunkhdr#chunk_length. = htonscxx . . $ htons(a18c05e4017afb3d).(chk->book_sizecxx . . $ sctp_tmit_chunk#book_size.);
12888 SCTP_BUF_LENcxx . . $ `usrsctplib/netinet/sctp_os_userspace.h:790:9`!(chk->data) = chk->send_sizecxx . . $ sctp_tmit_chunk#send_size.;
12889
12890 seq = stcb->asoccxx . . $ sctp_tcb#asoc..str_reset_seq_outcxx . . $ sctp_association#str_reset_seq_out.;
12891 if (can_send_out_req) {
12892 int ret;
12893 ret = sctp_add_stream_reset_outcxx . . $ sctp_add_stream_reset_out(6a92e992b29a855b).(stcb, chk, seq, (stcb->asoccxx . . $ sctp_tcb#asoc..str_reset_seq_incxx . . $ sctp_association#str_reset_seq_in. - 1), (stcb->asoccxx . . $ sctp_tcb#asoc..sending_seqcxx . . $ sctp_association#sending_seq. - 1));
12894 if (ret) {
12895 seq++;
12896 asoc->stream_reset_outstandingcxx . . $ sctp_association#stream_reset_outstanding.++;
12897 }
12898 }
12899 if ((add_stream & 1) &&
12900 ((stcb->asoccxx . . $ sctp_tcb#asoc..strm_realoutsizecxx . . $ sctp_association#strm_realoutsize. - stcb->asoccxx . . $ sctp_tcb#asoc..streamoutcntcxx . . $ sctp_association#streamoutcnt.) < adding_o)) {
12901 /* Need to allocate more */
12902 struct sctp_stream_outcxx . . $ sctp_stream_out# *oldstream;
12903 struct sctp_stream_queue_pendingcxx . . $ sctp_stream_queue_pending# *sp, *nsp;
12904 int i;
12905 #if defined(SCTP_DETAILED_STR_STATS)
12906 int j;
12907 #endif
12908
12909 oldstream = stcb->asoccxx . . $ sctp_tcb#asoc..strmoutcxx . . $ sctp_association#strmout.;
12910 /* get some more */
12911 SCTP_MALLOCcxx . . $ `usrsctplib/netinet/sctp_os_userspace.h:663:9`!(stcb->asoc.strmout, struct sctp_stream_out *,
12912 (stcb->asoc.streamoutcnt + adding_o) * sizeof(struct sctp_stream_out),
12913 SCTP_M_STRMO);
12914 if (stcb->asoccxx . . $ sctp_tcb#asoc..strmoutcxx . . $ sctp_association#strmout. == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!) {
12915 uint8_tcxx . . $ uint8_t# x;
12916 stcb->asoccxx . . $ sctp_tcb#asoc..strmoutcxx . . $ sctp_association#strmout. = oldstream;
12917 /* Turn off the bit */
12918 x = add_stream & 0xfe;
12919 add_stream = x;
12920 goto skip_stuff;
12921 }
12922 /* Ok now we proceed with copying the old out stuff and
12923 * initializing the new stuff.
12924 */
12925 SCTP_TCB_SEND_LOCKcxx . . $ `usrsctplib/netinet/sctp_process_lock.h:403:9`!(stcb);
12926 stcb->asoccxx . . $ sctp_tcb#asoc..ss_functionscxx . . $ sctp_association#ss_functions..sctp_ss_clearcxx . . $ sctp_ss_functions#sctp_ss_clear.(stcb, &stcb->asoccxx . . $ sctp_tcb#asoc., 0, 1);
12927 for (i = 0; i < stcb->asoccxx . . $ sctp_tcb#asoc..streamoutcntcxx . . $ sctp_association#streamoutcnt.; i++) {
12928 TAILQ_INITcxx . . $ `<external>/2546723208511035544/queue.h:387:9`!(&stcb->asoc.strmout[i].outqueue);
12929 stcb->asoccxx . . $ sctp_tcb#asoc..strmoutcxx . . $ sctp_association#strmout.[i].chunks_on_queuescxx . . $ sctp_stream_out#chunks_on_queues. = oldstream[i].chunks_on_queuescxx . . $ sctp_stream_out#chunks_on_queues.;
12930 stcb->asoccxx . . $ sctp_tcb#asoc..strmoutcxx . . $ sctp_association#strmout.[i].next_mid_orderedcxx . . $ sctp_stream_out#next_mid_ordered. = oldstream[i].next_mid_orderedcxx . . $ sctp_stream_out#next_mid_ordered.;
12931 stcb->asoccxx . . $ sctp_tcb#asoc..strmoutcxx . . $ sctp_association#strmout.[i].next_mid_unorderedcxx . . $ sctp_stream_out#next_mid_unordered. = oldstream[i].next_mid_unorderedcxx . . $ sctp_stream_out#next_mid_unordered.;
12932 stcb->asoccxx . . $ sctp_tcb#asoc..strmoutcxx . . $ sctp_association#strmout.[i].last_msg_incompletecxx . . $ sctp_stream_out#last_msg_incomplete. = oldstream[i].last_msg_incompletecxx . . $ sctp_stream_out#last_msg_incomplete.;
12933 stcb->asoccxx . . $ sctp_tcb#asoc..strmoutcxx . . $ sctp_association#strmout.[i].sidcxx . . $ sctp_stream_out#sid. = i;
12934 stcb->asoccxx . . $ sctp_tcb#asoc..strmoutcxx . . $ sctp_association#strmout.[i].statecxx . . $ sctp_stream_out#state. = oldstream[i].statecxx . . $ sctp_stream_out#state.;
12935 /* FIX ME FIX ME */
12936 /* This should be a SS_COPY operation FIX ME STREAM SCHEDULER EXPERT */
12937 stcb->asoccxx . . $ sctp_tcb#asoc..ss_functionscxx . . $ sctp_association#ss_functions..sctp_ss_init_streamcxx . . $ sctp_ss_functions#sctp_ss_init_stream.(stcb, &stcb->asoccxx . . $ sctp_tcb#asoc..strmoutcxx . . $ sctp_association#strmout.[i], &oldstream[i]);
12938 /* now anything on those queues? */
12939 TAILQ_FOREACH_SAFEcxx . . $ `usrsctplib/netinet/sctp_os_userspace.h:1109:9`!(sp, &oldstream[i].outqueue, next, nsp) {
12940 TAILQ_REMOVEcxx . . $ `<external>/2546723208511035544/queue.h:426:9`!(&oldstream[i].outqueue, sp, next);
12941 TAILQ_INSERT_TAILcxx . . $ `<external>/2546723208511035544/queue.h:402:9`!(&stcb->asoc.strmout[i].outqueue, sp, next);
12942 }
12943 }
12944 /* now the new streams */
12945 stcb->asoccxx . . $ sctp_tcb#asoc..ss_functionscxx . . $ sctp_association#ss_functions..sctp_ss_initcxx . . $ sctp_ss_functions#sctp_ss_init.(stcb, &stcb->asoccxx . . $ sctp_tcb#asoc., 1);
12946 for (i = stcb->asoccxx . . $ sctp_tcb#asoc..streamoutcntcxx . . $ sctp_association#streamoutcnt.; i < (stcb->asoccxx . . $ sctp_tcb#asoc..streamoutcntcxx . . $ sctp_association#streamoutcnt. + adding_o); i++) {
12947 TAILQ_INITcxx . . $ `<external>/2546723208511035544/queue.h:387:9`!(&stcb->asoc.strmout[i].outqueue);
12948 stcb->asoccxx . . $ sctp_tcb#asoc..strmoutcxx . . $ sctp_association#strmout.[i].chunks_on_queuescxx . . $ sctp_stream_out#chunks_on_queues. = 0;
12949 #if defined(SCTP_DETAILED_STR_STATS)
12950 for (j = 0; j < SCTP_PR_SCTP_MAX + 1; j++) {
12951 stcb->asoc.strmout[i].abandoned_sent[j] = 0;
12952 stcb->asoc.strmout[i].abandoned_unsent[j] = 0;
12953 }
12954 #else
12955 stcb->asoccxx . . $ sctp_tcb#asoc..strmoutcxx . . $ sctp_association#strmout.[i].abandoned_sentcxx . . $ sctp_stream_out#abandoned_sent.[0] = 0;
12956 stcb->asoccxx . . $ sctp_tcb#asoc..strmoutcxx . . $ sctp_association#strmout.[i].abandoned_unsentcxx . . $ sctp_stream_out#abandoned_unsent.[0] = 0;
12957 #endif
12958 stcb->asoccxx . . $ sctp_tcb#asoc..strmoutcxx . . $ sctp_association#strmout.[i].next_mid_orderedcxx . . $ sctp_stream_out#next_mid_ordered. = 0;
12959 stcb->asoccxx . . $ sctp_tcb#asoc..strmoutcxx . . $ sctp_association#strmout.[i].next_mid_unorderedcxx . . $ sctp_stream_out#next_mid_unordered. = 0;
12960 stcb->asoccxx . . $ sctp_tcb#asoc..strmoutcxx . . $ sctp_association#strmout.[i].sidcxx . . $ sctp_stream_out#sid. = i;
12961 stcb->asoccxx . . $ sctp_tcb#asoc..strmoutcxx . . $ sctp_association#strmout.[i].last_msg_incompletecxx . . $ sctp_stream_out#last_msg_incomplete. = 0;
12962 stcb->asoccxx . . $ sctp_tcb#asoc..ss_functionscxx . . $ sctp_association#ss_functions..sctp_ss_init_streamcxx . . $ sctp_ss_functions#sctp_ss_init_stream.(stcb, &stcb->asoccxx . . $ sctp_tcb#asoc..strmoutcxx . . $ sctp_association#strmout.[i], NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!);
12963 stcb->asoccxx . . $ sctp_tcb#asoc..strmoutcxx . . $ sctp_association#strmout.[i].statecxx . . $ sctp_stream_out#state. = SCTP_STREAM_CLOSEDcxx . . $ `usrsctplib/netinet/sctp_structs.h:648:9`!;
12964 }
12965 stcb->asoccxx . . $ sctp_tcb#asoc..strm_realoutsizecxx . . $ sctp_association#strm_realoutsize. = stcb->asoccxx . . $ sctp_tcb#asoc..streamoutcntcxx . . $ sctp_association#streamoutcnt. + adding_o;
12966 SCTP_FREEcxx . . $ `usrsctplib/netinet/sctp_os_userspace.h:668:9`!(oldstream, SCTP_M_STRMO);
12967 SCTP_TCB_SEND_UNLOCKcxx . . $ `usrsctplib/netinet/sctp_process_lock.h:405:9`!(stcb);
12968 }
12969 skip_stuff:
12970 if ((add_stream & 1) && (adding_o > 0)) {
12971 asoc->strm_pending_add_sizecxx . . $ sctp_association#strm_pending_add_size. = adding_o;
12972 asoc->peer_req_outcxx . . $ sctp_association#peer_req_out. = peer_asked;
12973 sctp_add_an_out_streamcxx . . $ sctp_add_an_out_stream(d588b4ea68be4d64).(chk, seq, adding_o);
12974 seq++;
12975 asoc->stream_reset_outstandingcxx . . $ sctp_association#stream_reset_outstanding.++;
12976 }
12977 if ((add_stream & 2) && (adding_i > 0)) {
12978 sctp_add_an_in_streamcxx . . $ sctp_add_an_in_stream(d588b4ea68be4d64).(chk, seq, adding_i);
12979 seq++;
12980 asoc->stream_reset_outstandingcxx . . $ sctp_association#stream_reset_outstanding.++;
12981 }
12982 if (send_in_req) {
12983 sctp_add_stream_reset_incxx . . $ sctp_add_stream_reset_in(ed9c13f2cf4d8ff3).(chk, number_entries, list, seq);
12984 seq++;
12985 asoc->stream_reset_outstandingcxx . . $ sctp_association#stream_reset_outstanding.++;
12986 }
12987 if (send_tsn_req) {
12988 sctp_add_stream_reset_tsncxx . . $ sctp_add_stream_reset_tsn(8220631b27122eaf).(chk, seq);
12989 asoc->stream_reset_outstandingcxx . . $ sctp_association#stream_reset_outstanding.++;
12990 }
12991 asoc->str_resetcxx . . $ sctp_association#str_reset. = chk;
12992 /* insert the chunk for sending */
12993 TAILQ_INSERT_TAILcxx . . $ `<external>/2546723208511035544/queue.h:402:9`!(&asoc->control_send_queue,
12994 chk,
12995 sctp_next);
12996 asoc->ctrl_queue_cntcxx . . $ sctp_association#ctrl_queue_cnt.++;
12997 if (stcb->asoccxx . . $ sctp_tcb#asoc..send_sackcxx . . $ sctp_association#send_sack.) {
12998 sctp_send_sackcxx . . $ sctp_send_sack(309e9a20a883d7fc).(stcb, SCTP_SO_LOCKEDcxx . . $ `usrsctplib/netinet/sctp_constants.h:963:9`!);
12999 }
13000 sctp_timer_startcxx . . $ sctp_timer_start(73c9263bfa4b937d).(SCTP_TIMER_TYPE_STRRESETcxx . . $ `usrsctplib/netinet/sctp_constants.h:549:9`!, stcb->sctp_epcxx . . $ sctp_tcb#sctp_ep., stcb, chk->whoTocxx . . $ sctp_tmit_chunk#whoTo.);
13001 return (0);
13002 }
13003
13004 void
13005 sctp_send_abortcxx . . $ sctp_send_abort(d57fc55c8a777e0c).(struct mbufcxx . . $ mbuf# *m, int iphlen, struct sockaddrcxx . . $ sockaddr# *src, struct sockaddrcxx . . $ sockaddr# *dst,
13006 struct sctphdrcxx . . $ sctphdr# *sh, uint32_tcxx . . $ uint32_t# vtag, struct mbufcxx . . $ mbuf# *cause,
13007 #if defined(__FreeBSD__) && !defined(__Userspace__cxx . . $ `<built-in>:442:9`!)
13008 uint8_t mflowtype, uint32_t mflowid, uint16_t fibnum,
13009 #endif
13010 uint32_tcxx . . $ uint32_t# vrf_id, uint16_tcxx . . $ uint16_t# port)
13011 {
13012 /* Don't respond to an ABORT with an ABORT. */
13013 if (sctp_is_there_an_abort_herecxx . . $ sctp_is_there_an_abort_here(996ed216bc3d3213).(m, iphlen, &vtag)) {
13014 if (cause)
13015 sctp_m_freemcxx . . $ `usrsctplib/netinet/sctputil.h:57:9`!(cause);
13016 return;
13017 }
13018 sctp_send_resp_msgcxx . . $ sctp_send_resp_msg(fa185149314b05ca).(src, dst, sh, vtag, SCTP_ABORT_ASSOCIATIONcxx . . $ `usrsctplib/netinet/sctp.h:455:9`!, cause,
13019 #if defined(__FreeBSD__) && !defined(__Userspace__cxx . . $ `<built-in>:442:9`!)
13020 mflowtype, mflowid, fibnum,
13021 #endif
13022 vrf_id, port);
13023 return;
13024 }
13025
13026 void
13027 sctp_send_operr_tocxx . . $ sctp_send_operr_to(36dd38b9ade48bc9).(struct sockaddrcxx . . $ sockaddr# *src, struct sockaddrcxx . . $ sockaddr# *dst,
13028 struct sctphdrcxx . . $ sctphdr# *sh, uint32_tcxx . . $ uint32_t# vtag, struct mbufcxx . . $ mbuf# *cause,
13029 #if defined(__FreeBSD__) && !defined(__Userspace__cxx . . $ `<built-in>:442:9`!)
13030 uint8_t mflowtype, uint32_t mflowid, uint16_t fibnum,
13031 #endif
13032 uint32_tcxx . . $ uint32_t# vrf_id, uint16_tcxx . . $ uint16_t# port)
13033 {
13034 sctp_send_resp_msgcxx . . $ sctp_send_resp_msg(fa185149314b05ca).(src, dst, sh, vtag, SCTP_OPERATION_ERRORcxx . . $ `usrsctplib/netinet/sctp.h:458:9`!, cause,
13035 #if defined(__FreeBSD__) && !defined(__Userspace__cxx . . $ `<built-in>:442:9`!)
13036 mflowtype, mflowid, fibnum,
13037 #endif
13038 vrf_id, port);
13039 return;
13040 }
13041
13042 static struct mbufcxx . . $ mbuf# *
13043 sctp_copy_resumecxx . . $ sctp_copy_resume(d841ccd8c5a7a27c).(struct uiocxx . . $ uio# *uio,
13044 int max_send_len,
13045 #if defined(__FreeBSD__) || defined(__Userspace__cxx . . $ `<built-in>:442:9`!)
13046 int user_marks_eor,
13047 #endif
13048 int *error,
13049 uint32_tcxx . . $ uint32_t# *sndout,
13050 struct mbufcxx . . $ mbuf# **new_tail)
13051 {
13052 #if defined(__FreeBSD__) || defined(__Userspace__cxx . . $ `<built-in>:442:9`!)
13053 struct mbufcxx . . $ mbuf# *m;
13054
13055 m = m_uiotombufcxx . . $ m_uiotombuf(252cee56bb062fc3).(uio, M_WAITOKcxx . . $ `usrsctplib/user_malloc.h:61:9`!, max_send_len, 0,
13056 (M_PKTHDRcxx . . $ `usrsctplib/user_mbuf.h:236:9`! | (user_marks_eor ? M_EORcxx . . $ `usrsctplib/user_mbuf.h:237:9`! : 0)));
13057 if (m == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!) {
13058 SCTP_LTRACE_ERR_RETcxx . . $ `usrsctplib/netinet/sctp_os_userspace.h:629:9`!(NULL, NULL, NULL, SCTP_FROM_SCTP_OUTPUT, ENOBUFS);
13059 *error = ENOBUFScxx . . $ `<external>/17922322188510340118/errno.h:89:9`!;
13060 } else {
13061 *sndout = m_lengthcxx . . $ m_length(57e68c541c76d63e).(m, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!);
13062 *new_tail = m_lastcxx . . $ m_last(378d68502b1574fb).(m);
13063 }
13064 return (m);
13065 #else
13066 int left, cancpy, willcpy;
13067 struct mbuf *m, *head;
13068
13069 #if defined(__APPLE__) && !defined(__Userspace__)
13070 #if defined(APPLE_LEOPARD)
13071 left = (int)min(uio->uio_resid, max_send_len);
13072 #else
13073 left = (int)min(uio_resid(uio), max_send_len);
13074 #endif
13075 #else
13076 left = (int)min(uio->uio_resid, max_send_len);
13077 #endif
13078 /* Always get a header just in case */
13079 head = sctp_get_mbuf_for_msg(left, 0, M_WAITOK, 0, MT_DATA);
13080 if (head == NULL) {
13081 SCTP_LTRACE_ERR_RET(NULL, NULL, NULL, SCTP_FROM_SCTP_OUTPUT, ENOBUFS);
13082 *error = ENOBUFS;
13083 return (NULL);
13084 }
13085 cancpy = (int)M_TRAILINGSPACE(head);
13086 willcpy = min(cancpy, left);
13087 *error = uiomove(mtod(head, caddr_t), willcpy, uio);
13088 if (*error) {
13089 sctp_m_freem(head);
13090 return (NULL);
13091 }
13092 *sndout += willcpy;
13093 left -= willcpy;
13094 SCTP_BUF_LEN(head) = willcpy;
13095 m = head;
13096 *new_tail = head;
13097 while (left > 0) {
13098 /* move in user data */
13099 SCTP_BUF_NEXT(m) = sctp_get_mbuf_for_msg(left, 0, M_WAITOK, 0, MT_DATA);
13100 if (SCTP_BUF_NEXT(m) == NULL) {
13101 sctp_m_freem(head);
13102 *new_tail = NULL;
13103 SCTP_LTRACE_ERR_RET(NULL, NULL, NULL, SCTP_FROM_SCTP_OUTPUT, ENOBUFS);
13104 *error = ENOBUFS;
13105 return (NULL);
13106 }
13107 m = SCTP_BUF_NEXT(m);
13108 cancpy = (int)M_TRAILINGSPACE(m);
13109 willcpy = min(cancpy, left);
13110 *error = uiomove(mtod(m, caddr_t), willcpy, uio);
13111 if (*error) {
13112 sctp_m_freem(head);
13113 *new_tail = NULL;
13114 SCTP_LTRACE_ERR_RET(NULL, NULL, NULL, SCTP_FROM_SCTP_OUTPUT, EFAULT);
13115 *error = EFAULT;
13116 return (NULL);
13117 }
13118 SCTP_BUF_LEN(m) = willcpy;
13119 left -= willcpy;
13120 *sndout += willcpy;
13121 *new_tail = m;
13122 if (left == 0) {
13123 SCTP_BUF_NEXT(m) = NULL;
13124 }
13125 }
13126 return (head);
13127 #endif
13128 }
13129
13130 static int
13131 sctp_copy_onecxx . . $ sctp_copy_one(383dea8dde4dd102).(struct sctp_stream_queue_pendingcxx . . $ sctp_stream_queue_pending# *sp,
13132 struct uiocxx . . $ uio# *uio,
13133 int resv_upfront)
13134 {
13135 #if defined(__FreeBSD__) || defined(__Userspace__cxx . . $ `<built-in>:442:9`!)
13136 sp->datacxx . . $ sctp_stream_queue_pending#data. = m_uiotombufcxx . . $ m_uiotombuf(252cee56bb062fc3).(uio, M_WAITOKcxx . . $ `usrsctplib/user_malloc.h:61:9`!, sp->lengthcxx . . $ sctp_stream_queue_pending#length.,
13137 resv_upfront, 0);
13138 if (sp->datacxx . . $ sctp_stream_queue_pending#data. == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!) {
13139 SCTP_LTRACE_ERR_RETcxx . . $ `usrsctplib/netinet/sctp_os_userspace.h:629:9`!(NULL, NULL, NULL, SCTP_FROM_SCTP_OUTPUT, ENOBUFS);
13140 return (ENOBUFScxx . . $ `<external>/17922322188510340118/errno.h:89:9`!);
13141 }
13142
13143 sp->tail_mbufcxx . . $ sctp_stream_queue_pending#tail_mbuf. = m_lastcxx . . $ m_last(378d68502b1574fb).(sp->datacxx . . $ sctp_stream_queue_pending#data.);
13144 return (0);
13145 #else
13146 int left;
13147 int cancpy, willcpy, error;
13148 struct mbuf *m, *head;
13149 int cpsz = 0;
13150
13151 /* First one gets a header */
13152 left = sp->length;
13153 head = m = sctp_get_mbuf_for_msg((left + resv_upfront), 0, M_WAITOK, 0, MT_DATA);
13154 if (m == NULL) {
13155 SCTP_LTRACE_ERR_RET(NULL, NULL, NULL, SCTP_FROM_SCTP_OUTPUT, ENOBUFS);
13156 return (ENOBUFS);
13157 }
13158 /*-
13159 * Add this one for m in now, that way if the alloc fails we won't
13160 * have a bad cnt.
13161 */
13162 SCTP_BUF_RESV_UF(m, resv_upfront);
13163 cancpy = (int)M_TRAILINGSPACE(m);
13164 willcpy = min(cancpy, left);
13165 while (left > 0) {
13166 /* move in user data */
13167 error = uiomove(mtod(m, caddr_t), willcpy, uio);
13168 if (error) {
13169 sctp_m_freem(head);
13170 return (error);
13171 }
13172 SCTP_BUF_LEN(m) = willcpy;
13173 left -= willcpy;
13174 cpsz += willcpy;
13175 if (left > 0) {
13176 SCTP_BUF_NEXT(m) = sctp_get_mbuf_for_msg(left, 0, M_WAITOK, 0, MT_DATA);
13177 if (SCTP_BUF_NEXT(m) == NULL) {
13178 /*
13179 * the head goes back to caller, he can free
13180 * the rest
13181 */
13182 sctp_m_freem(head);
13183 SCTP_LTRACE_ERR_RET(NULL, NULL, NULL, SCTP_FROM_SCTP_OUTPUT, ENOBUFS);
13184 return (ENOBUFS);
13185 }
13186 m = SCTP_BUF_NEXT(m);
13187 cancpy = (int)M_TRAILINGSPACE(m);
13188 willcpy = min(cancpy, left);
13189 } else {
13190 sp->tail_mbuf = m;
13191 SCTP_BUF_NEXT(m) = NULL;
13192 }
13193 }
13194 sp->data = head;
13195 sp->length = cpsz;
13196 return (0);
13197 #endif
13198 }
13199
13200 static struct sctp_stream_queue_pendingcxx . . $ sctp_stream_queue_pending# *
13201 sctp_copy_it_incxx . . $ sctp_copy_it_in(7da23d652d52c7b1).(struct sctp_tcbcxx . . $ sctp_tcb# *stcb,
13202 struct sctp_associationcxx . . $ sctp_association# *asoc,
13203 struct sctp_sndrcvinfo *srcv,
13204 struct uiocxx . . $ uio# *uio,
13205 struct sctp_netscxx . . $ sctp_nets# *net,
13206 ssize_tcxx . . $ ssize_t# max_send_len,
13207 int user_marks_eor,
13208 int *error)
13209
13210 {
13211 /*-
13212 * This routine must be very careful in its work. Protocol
13213 * processing is up and running so care must be taken to spl...()
13214 * when you need to do something that may effect the stcb/asoc. The
13215 * sb is locked however. When data is copied the protocol processing
13216 * should be enabled since this is a slower operation...
13217 */
13218 struct sctp_stream_queue_pendingcxx . . $ sctp_stream_queue_pending# *sp = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!;
13219 int resv_in_first;
13220
13221 *error = 0;
13222 /* Now can we send this? */
13223 if ((SCTP_GET_STATEcxx . . $ `usrsctplib/netinet/sctp_constants.h:476:9`!(stcb) == SCTP_STATE_SHUTDOWN_SENTcxx . . $ `usrsctplib/netinet/sctp_constants.h:465:9`!) ||
13224 (SCTP_GET_STATEcxx . . $ `usrsctplib/netinet/sctp_constants.h:476:9`!(stcb) == SCTP_STATE_SHUTDOWN_ACK_SENTcxx . . $ `usrsctplib/netinet/sctp_constants.h:467:9`!) ||
13225 (SCTP_GET_STATEcxx . . $ `usrsctplib/netinet/sctp_constants.h:476:9`!(stcb) == SCTP_STATE_SHUTDOWN_RECEIVEDcxx . . $ `usrsctplib/netinet/sctp_constants.h:466:9`!) ||
13226 (asoc->statecxx . . $ sctp_association#state. & SCTP_STATE_SHUTDOWN_PENDINGcxx . . $ `usrsctplib/netinet/sctp_constants.h:468:9`!)) {
13227 /* got data while shutting down */
13228 SCTP_LTRACE_ERR_RETcxx . . $ `usrsctplib/netinet/sctp_os_userspace.h:629:9`!(NULL, stcb, NULL, SCTP_FROM_SCTP_OUTPUT, ECONNRESET);
13229 *error = ECONNRESETcxx . . $ `<external>/17922322188510340118/errno.h:88:9`!;
13230 goto out_now;
13231 }
13232 sctp_alloc_a_strmoqcxx . . $ `usrsctplib/netinet/sctp_var.h:135:9`!(stcb, sp);
13233 if (sp == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!) {
13234 SCTP_LTRACE_ERR_RETcxx . . $ `usrsctplib/netinet/sctp_os_userspace.h:629:9`!(NULL, stcb, net, SCTP_FROM_SCTP_OUTPUT, ENOMEM);
13235 *error = ENOMEMcxx . . $ `<external>/8987895939074593727/errno-base.h:16:9`!;
13236 goto out_now;
13237 }
13238 sp->act_flagscxx . . $ sctp_stream_queue_pending#act_flags. = 0;
13239 sp->sender_all_donecxx . . $ sctp_stream_queue_pending#sender_all_done. = 0;
13240 sp->sinfo_flagscxx . . $ sctp_stream_queue_pending#sinfo_flags. = srcv->sinfo_flags;
13241 sp->timetolivecxx . . $ sctp_stream_queue_pending#timetolive. = srcv->sinfo_timetolive;
13242 sp->ppidcxx . . $ sctp_stream_queue_pending#ppid. = srcv->sinfo_ppid;
13243 sp->contextcxx . . $ sctp_stream_queue_pending#context. = srcv->sinfo_context;
13244 sp->fsncxx . . $ sctp_stream_queue_pending#fsn. = 0;
13245 (void)SCTP_GETTIME_TIMEVALcxx . . $ `usrsctplib/netinet/sctp_constants.h:995:9`!(&sp->ts);
13246
13247 sp->sidcxx . . $ sctp_stream_queue_pending#sid. = srcv->sinfo_stream;
13248 #if defined(__APPLE__) && !defined(__Userspace__cxx . . $ `<built-in>:442:9`!)
13249 #if defined(APPLE_LEOPARD)
13250 sp->length = (uint32_t)min(uio->uio_resid, max_send_len);
13251 #else
13252 sp->length = (uint32_t)min(uio_resid(uio), max_send_len);
13253 #endif
13254 #else
13255 sp->lengthcxx . . $ sctp_stream_queue_pending#length. = (uint32_tcxx . . $ uint32_t#)mincxx . . $ `usrsctplib/user_environment.h:66:9`!(uio->uio_resid, max_send_len);
13256 #endif
13257 #if defined(__APPLE__) && !defined(__Userspace__cxx . . $ `<built-in>:442:9`!)
13258 #if defined(APPLE_LEOPARD)
13259 if ((sp->length == (uint32_t)uio->uio_resid) &&
13260 #else
13261 if ((sp->length == (uint32_t)uio_resid(uio)) &&
13262 #endif
13263 #else
13264 if ((sp->lengthcxx . . $ sctp_stream_queue_pending#length. == (uint32_tcxx . . $ uint32_t#)uio->uio_residcxx . . $ uio#uio_resid.) &&
13265 #endif
13266 ((user_marks_eor == 0) ||
13267 (srcv->sinfo_flags & SCTP_EOFcxx . . $ `./netinet/sctp_uio.h:262:9`!) ||
13268 (user_marks_eor && (srcv->sinfo_flags & SCTP_EORcxx . . $ `./netinet/sctp_uio.h:267:9`!)))) {
13269 sp->msg_is_completecxx . . $ sctp_stream_queue_pending#msg_is_complete. = 1;
13270 } else {
13271 sp->msg_is_completecxx . . $ sctp_stream_queue_pending#msg_is_complete. = 0;
13272 }
13273 sp->sender_all_donecxx . . $ sctp_stream_queue_pending#sender_all_done. = 0;
13274 sp->some_takencxx . . $ sctp_stream_queue_pending#some_taken. = 0;
13275 sp->put_last_outcxx . . $ sctp_stream_queue_pending#put_last_out. = 0;
13276 resv_in_first = SCTP_DATA_CHUNK_OVERHEADcxx . . $ `usrsctplib/netinet/sctp_output.h:137:9`!(stcb);
13277 sp->datacxx . . $ sctp_stream_queue_pending#data. = sp->tail_mbufcxx . . $ sctp_stream_queue_pending#tail_mbuf. = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!;
13278 if (sp->lengthcxx . . $ sctp_stream_queue_pending#length. == 0) {
13279 goto skip_copy;
13280 }
13281 if (srcv->sinfo_keynumber_valid) {
13282 sp->auth_keyidcxx . . $ sctp_stream_queue_pending#auth_keyid. = srcv->sinfo_keynumber;
13283 } else {
13284 sp->auth_keyidcxx . . $ sctp_stream_queue_pending#auth_keyid. = stcb->asoccxx . . $ sctp_tcb#asoc..authinfocxx . . $ sctp_association#authinfo..active_keyidcxx . . $ sctp_authinformation#active_keyid.;
13285 }
13286 if (sctp_auth_is_required_chunkcxx . . $ `usrsctplib/netinet/sctp_auth.h:105:9`!(SCTP_DATAcxx . . $ `usrsctplib/netinet/sctp.h:449:9`!, stcb->asoc.peer_auth_chunks)) {
13287 sctp_auth_key_acquirecxx . . $ sctp_auth_key_acquire(f17400a79897d6ee).(stcb, sp->auth_keyidcxx . . $ sctp_stream_queue_pending#auth_keyid.);
13288 sp->holds_key_refcxx . . $ sctp_stream_queue_pending#holds_key_ref. = 1;
13289 }
13290 #if defined(__APPLE__) && !defined(__Userspace__cxx . . $ `<built-in>:442:9`!)
13291 SCTP_SOCKET_UNLOCK(SCTP_INP_SO(stcb->sctp_ep), 0);
13292 #endif
13293 *error = sctp_copy_onecxx . . $ sctp_copy_one(383dea8dde4dd102).(sp, uio, resv_in_first);
13294 #if defined(__APPLE__) && !defined(__Userspace__cxx . . $ `<built-in>:442:9`!)
13295 SCTP_SOCKET_LOCK(SCTP_INP_SO(stcb->sctp_ep), 0);
13296 #endif
13297 skip_copy:
13298 if (*error) {
13299 #if defined(__Userspace__cxx . . $ `<built-in>:442:9`!)
13300 SCTP_TCB_LOCKcxx . . $ `usrsctplib/netinet/sctp_process_lock.h:473:9`!(stcb);
13301 #endif
13302 sctp_free_a_strmoqcxx . . $ `usrsctplib/netinet/sctp_var.h:126:9`!(stcb, sp, SCTP_SO_LOCKEDcxx . . $ `usrsctplib/netinet/sctp_constants.h:963:9`!);
13303 #if defined(__Userspace__cxx . . $ `<built-in>:442:9`!)
13304 SCTP_TCB_UNLOCKcxx . . $ `usrsctplib/netinet/sctp_process_lock.h:476:9`!(stcb);
13305 #endif
13306 sp = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!;
13307 } else {
13308 if (sp->sinfo_flagscxx . . $ sctp_stream_queue_pending#sinfo_flags. & SCTP_ADDR_OVERcxx . . $ `./netinet/sctp_uio.h:265:9`!) {
13309 sp->netcxx . . $ sctp_stream_queue_pending#net. = net;
13310 atomic_add_intcxx . . $ `usrsctplib/user_atomic.h:94:9`!(&sp->net->ref_count, 1);
13311 } else {
13312 sp->netcxx . . $ sctp_stream_queue_pending#net. = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!;
13313 }
13314 sctp_set_prsctp_policycxx . . $ sctp_set_prsctp_policy(d559ce077b2531c0).(sp);
13315 }
13316 out_now:
13317 return (sp);
13318 }
13319
13320 int
13321 sctp_sosendcxx . . $ sctp_sosend(108d9d48198ffd7).(struct socketcxx . . $ socket# *so,
13322 struct sockaddrcxx . . $ sockaddr# *addr,
13323 struct uiocxx . . $ uio# *uio,
13324 struct mbufcxx . . $ mbuf# *top,
13325 struct mbufcxx . . $ mbuf# *control,
13326 #if defined(__APPLE__) && !defined(__Userspace__cxx . . $ `<built-in>:442:9`!)
13327 int flags
13328 #else
13329 int flags,
13330 #if defined(__FreeBSD__) && !defined(__Userspace__cxx . . $ `<built-in>:442:9`!)
13331 struct thread *p
13332 #elif defined(_WIN32) && !defined(__Userspace__cxx . . $ `<built-in>:442:9`!)
13333 PKTHREAD p
13334 #else
13335 #if defined(__Userspace__cxx . . $ `<built-in>:442:9`!)
13336 /*
13337 * proc is a dummy in __Userspace__ and will not be passed
13338 * to sctp_lower_sosend
13339 */
13340 #endif
13341 struct proccxx . . $ proc# *p
13342 #endif
13343 #endif
13344 )
13345 {
13346 #if defined(__APPLE__) && !defined(__Userspace__cxx . . $ `<built-in>:442:9`!)
13347 struct proc *p = current_proc();
13348 #endif
13349 int error, use_sndinfo = 0;
13350 struct sctp_sndrcvinfo sndrcvninfo;
13351 struct sockaddrcxx . . $ sockaddr# *addr_to_use;
13352 #if defined(INETcxx . . $ `<built-in>:431:9`!) && defined(INET6cxx . . $ `<built-in>:432:9`!)
13353 struct sockaddr_incxx . . $ sockaddr_in# sin;
13354 #endif
13355
13356 #if defined(__APPLE__) && !defined(__Userspace__cxx . . $ `<built-in>:442:9`!)
13357 SCTP_SOCKET_LOCK(so, 1);
13358 #endif
13359 if (control) {
13360 /* process cmsg snd/rcv info (maybe a assoc-id) */
13361 if (sctp_find_cmsgcxx . . $ sctp_find_cmsg(6b8ad251416065d1).(SCTP_SNDRCVcxx . . $ `./netinet/sctp_uio.h:98:9`!, (void *)&sndrcvninfo, control,
13362 sizeof(sndrcvninfo))) {
13363 /* got one */
13364 use_sndinfo = 1;
13365 }
13366 }
13367 addr_to_use = addr;
13368 #if defined(INETcxx . . $ `<built-in>:431:9`!) && defined(INET6cxx . . $ `<built-in>:432:9`!)
13369 if ((addr) && (addr->sa_familycxx . . $ sockaddr#sa_family. == AF_INET6cxx . . $ `<external>/8962547315054503424/socket.h:105:9`!)) {
13370 struct sockaddr_in6cxx . . $ sockaddr_in6# *sin6;
13371
13372 sin6 = (struct sockaddr_in6cxx . . $ sockaddr_in6# *)addr;
13373 if (IN6_IS_ADDR_V4MAPPEDcxx . . $ `<external>/9581057695539925927/in.h:463:10`!(&sin6->sin6_addr)) {
13374 in6_sin6_2_sincxx . . $ in6_sin6_2_sin(65922a4b0f886efe).(&sin, sin6);
13375 addr_to_use = (struct sockaddrcxx . . $ sockaddr# *)&sin;
13376 }
13377 }
13378 #endif
13379 error = sctp_lower_sosend(so, addr_to_use, uio, top,
13380 control,
13381 flags,
13382 use_sndinfo ? &sndrcvninfo: NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!
13383 #if !defined(__Userspace__cxx . . $ `<built-in>:442:9`!)
13384 , p
13385 #endif
13386 );
13387 #if defined(__APPLE__) && !defined(__Userspace__cxx . . $ `<built-in>:442:9`!)
13388 SCTP_SOCKET_UNLOCK(so, 1);
13389 #endif
13390 return (error);
13391 }
13392
13393 int
13394 sctp_lower_sosendcxx . . $ sctp_lower_sosend(f13d98f1054e26d).(struct socketcxx . . $ socket# *so,
13395 struct sockaddrcxx . . $ sockaddr# *addr,
13396 struct uiocxx . . $ uio# *uio,
13397 struct mbufcxx . . $ mbuf# *i_pak,
13398 struct mbufcxx . . $ mbuf# *control,
13399 int flags,
13400 struct sctp_sndrcvinfo *srcv
13401 #if !defined(__Userspace__cxx . . $ `<built-in>:442:9`!)
13402 ,
13403 #if defined(__FreeBSD__)
13404 struct thread *p
13405 #elif defined(_WIN32)
13406 PKTHREAD p
13407 #else
13408 struct proc *p
13409 #endif
13410 #endif
13411 )
13412 {
13413 #if defined(__FreeBSD__) && !defined(__Userspace__cxx . . $ `<built-in>:442:9`!)
13414 struct epoch_tracker et;
13415 #endif
13416 ssize_tcxx . . $ ssize_t# sndlen = 0, max_len, local_add_more;
•13417 int error;
13418 struct mbufcxx . . $ mbuf# *top = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!;
13419 int queue_only = 0, queue_only_for_init = 0;
13420 int free_cnt_applied = 0;
13421 int un_sent;
13422 int now_filled = 0;
13423 unsigned int inqueue_bytes = 0;
13424 struct sctp_block_entrycxx . . $ sctp_block_entry# be;
13425 struct sctp_inpcbcxx . . $ sctp_inpcb# *inp;
13426 struct sctp_tcbcxx . . $ sctp_tcb# *stcb = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!;
13427 struct timevalcxx . . $ timeval# now;
13428 struct sctp_netscxx . . $ sctp_nets# *net;
13429 struct sctp_associationcxx . . $ sctp_association# *asoc;
13430 struct sctp_inpcbcxx . . $ sctp_inpcb# *t_inp;
13431 int user_marks_eor;
13432 int create_lock_applied = 0;
13433 int nagle_applies = 0;
13434 int some_on_control = 0;
13435 int got_all_of_the_send = 0;
13436 int hold_tcblock = 0;
13437 int non_blocking = 0;
13438 ssize_tcxx . . $ ssize_t# local_soresv = 0;
13439 uint16_tcxx . . $ uint16_t# port;
13440 uint16_tcxx . . $ uint16_t# sinfo_flags;
13441 sctp_assoc_t sinfo_assoc_id;
13442
13443 error = 0;
13444 net = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!;
13445 stcb = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!;
13446 asoc = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!;
13447
13448 #if defined(__APPLE__) && !defined(__Userspace__cxx . . $ `<built-in>:442:9`!)
13449 sctp_lock_assert(so);
13450 #endif
13451 t_inp = inp = (struct sctp_inpcbcxx . . $ sctp_inpcb# *)so->so_pcbcxx . . $ socket#so_pcb.;
13452 if (inp == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!) {
13453 SCTP_LTRACE_ERR_RETcxx . . $ `usrsctplib/netinet/sctp_os_userspace.h:629:9`!(NULL, NULL, NULL, SCTP_FROM_SCTP_OUTPUT, EINVAL);
13454 error = EINVALcxx . . $ `<external>/8987895939074593727/errno-base.h:26:9`!;
13455 if (i_pak) {
13456 SCTP_RELEASE_PKTcxx . . $ `usrsctplib/netinet/sctp_os_userspace.h:915:9`!(i_pak);
13457 }
13458 return (error);
13459 }
13460 if ((uio == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!) && (i_pak == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!)) {
13461 SCTP_LTRACE_ERR_RETcxx . . $ `usrsctplib/netinet/sctp_os_userspace.h:629:9`!(inp, stcb, net, SCTP_FROM_SCTP_OUTPUT, EINVAL);
13462 return (EINVALcxx . . $ `<external>/8987895939074593727/errno-base.h:26:9`!);
13463 }
13464 user_marks_eor = sctp_is_feature_oncxx . . $ `usrsctplib/netinet/sctp_var.h:53:9`!(inp, SCTP_PCB_FLAGS_EXPLICIT_EORcxx . . $ `usrsctplib/netinet/sctp.h:584:9`!);
13465 atomic_add_intcxx . . $ `usrsctplib/user_atomic.h:94:9`!(&inp->total_sends, 1);
13466 if (uio) {
13467 #if defined(__APPLE__) && !defined(__Userspace__cxx . . $ `<built-in>:442:9`!)
13468 #if defined(APPLE_LEOPARD)
13469 if (uio->uio_resid < 0) {
13470 #else
13471 if (uio_resid(uio) < 0) {
13472 #endif
13473 #else
13474 if (uio->uio_residcxx . . $ uio#uio_resid. < 0) {
13475 #endif
13476 SCTP_LTRACE_ERR_RETcxx . . $ `usrsctplib/netinet/sctp_os_userspace.h:629:9`!(inp, stcb, net, SCTP_FROM_SCTP_OUTPUT, EINVAL);
13477 return (EINVALcxx . . $ `<external>/8987895939074593727/errno-base.h:26:9`!);
13478 }
13479 #if defined(__APPLE__) && !defined(__Userspace__cxx . . $ `<built-in>:442:9`!)
13480 #if defined(APPLE_LEOPARD)
13481 sndlen = uio->uio_resid;
13482 #else
13483 sndlen = uio_resid(uio);
13484 #endif
13485 #else
13486 sndlen = uio->uio_residcxx . . $ uio#uio_resid.;
13487 #endif
13488 } else {
13489 top = SCTP_HEADER_TO_CHAINcxx . . $ `usrsctplib/netinet/sctp_os_userspace.h:910:9`!(i_pak);
13490 sndlen = SCTP_HEADER_LENcxx . . $ `usrsctplib/netinet/sctp_os_userspace.h:912:9`!(i_pak);
13491 }
13492 SCTPDBGcxx . . $ `usrsctplib/netinet/sctp_os_userspace.h:591:9`!(SCTP_DEBUG_OUTPUT1cxx . . $ `usrsctplib/netinet/sctp_constants.h:643:9`!, "Send called addr:%p send length %zd\n",
13493 (void *)addr,
13494 sndlen);
13495 if ((inp->sctp_flagscxx . . $ sctp_inpcb#sctp_flags. & SCTP_PCB_FLAGS_TCPTYPEcxx . . $ `usrsctplib/netinet/sctp.h:524:9`!) &&
13496 SCTP_IS_LISTENINGcxx . . $ `usrsctplib/netinet/sctp_os_userspace.h:1133:9`!(inp)) {
13497 /* The listener can NOT send */
13498 SCTP_LTRACE_ERR_RETcxx . . $ `usrsctplib/netinet/sctp_os_userspace.h:629:9`!(NULL, NULL, NULL, SCTP_FROM_SCTP_OUTPUT, ENOTCONN);
13499 error = ENOTCONNcxx . . $ `<external>/17922322188510340118/errno.h:91:9`!;
13500 goto out_unlocked;
13501 }
13502 /**
13503 * Pre-screen address, if one is given the sin-len
13504 * must be set correctly!
13505 */
13506 if (addr) {
13507 union sctp_sockstore *raddr = (union sctp_sockstore *)addr;
13508 switch (raddr->sa.sa_familycxx . . $ sockaddr#sa_family.) {
13509 #ifdef INETcxx . . $ `<built-in>:431:9`!
13510 case AF_INETcxx . . $ `<external>/8962547315054503424/socket.h:97:9`!:
13511 #ifdef HAVE_SIN_LEN
13512 if (raddr->sin.sin_len != sizeof(struct sockaddr_in)) {
13513 SCTP_LTRACE_ERR_RET(inp, stcb, net, SCTP_FROM_SCTP_OUTPUT, EINVAL);
13514 error = EINVAL;
13515 goto out_unlocked;
13516 }
13517 #endif
13518 port = raddr->sin.sin_portcxx . . $ sockaddr_in#sin_port.;
13519 break;
13520 #endif
13521 #ifdef INET6cxx . . $ `<built-in>:432:9`!
13522 case AF_INET6cxx . . $ `<external>/8962547315054503424/socket.h:105:9`!:
13523 #ifdef HAVE_SIN6_LEN
13524 if (raddr->sin6.sin6_len != sizeof(struct sockaddr_in6)) {
13525 SCTP_LTRACE_ERR_RET(inp, stcb, net, SCTP_FROM_SCTP_OUTPUT, EINVAL);
13526 error = EINVAL;
13527 goto out_unlocked;
13528 }
13529 #endif
13530 port = raddr->sin6.sin6_portcxx . . $ sockaddr_in6#sin6_port.;
13531 break;
13532 #endif
13533 #if defined(__Userspace__cxx . . $ `<built-in>:442:9`!)
13534 case AF_CONNcxx . . $ `usrsctplib/netinet/sctp_os_userspace.h:995:9`!:
13535 #ifdef HAVE_SCONN_LEN
13536 if (raddr->sconn.sconn_len != sizeof(struct sockaddr_conn)) {
13537 SCTP_LTRACE_ERR_RET(inp, stcb, net, SCTP_FROM_SCTP_OUTPUT, EINVAL);
13538 error = EINVAL;
13539 goto out_unlocked;
13540 }
13541 #endif
13542 port = raddr->sconn.sconn_portcxx . . $ sockaddr_conn#sconn_port.;
13543 break;
13544 #endif
13545 default:
13546 SCTP_LTRACE_ERR_RETcxx . . $ `usrsctplib/netinet/sctp_os_userspace.h:629:9`!(inp, stcb, net, SCTP_FROM_SCTP_OUTPUT, EAFNOSUPPORT);
13547 error = EAFNOSUPPORTcxx . . $ `<external>/17922322188510340118/errno.h:81:9`!;
13548 goto out_unlocked;
13549 }
13550 } else
13551 port = 0;
13552
13553 if (srcv) {
13554 sinfo_flags = srcv->sinfo_flags;
13555 sinfo_assoc_id = srcv->sinfo_assoc_id;
13556 if (INVALID_SINFO_FLAGcxx . . $ `./netinet/sctp_uio.h:270:9`!(sinfo_flags) ||
13557 PR_SCTP_INVALID_POLICYcxx . . $ `./netinet/sctp_uio.h:291:9`!(sinfo_flags)) {
13558 SCTP_LTRACE_ERR_RETcxx . . $ `usrsctplib/netinet/sctp_os_userspace.h:629:9`!(inp, stcb, net, SCTP_FROM_SCTP_OUTPUT, EINVAL);
13559 error = EINVALcxx . . $ `<external>/8987895939074593727/errno-base.h:26:9`!;
13560 goto out_unlocked;
13561 }
13562 if (srcv->sinfo_flags)
13563 SCTP_STAT_INCRcxx . . $ `./netinet/sctp_uio.h:1111:9`!(sctps_sends_with_flags);
13564 } else {
13565 sinfo_flags = inp->def_sendcxx . . $ sctp_inpcb#def_send..sinfo_flagscxx . . $ sctp_nonpad_sndrcvinfo#sinfo_flags.;
13566 sinfo_assoc_id = inp->def_sendcxx . . $ sctp_inpcb#def_send..sinfo_assoc_idcxx . . $ sctp_nonpad_sndrcvinfo#sinfo_assoc_id.;
13567 }
13568 #if defined(__FreeBSD__) && !defined(__Userspace__cxx . . $ `<built-in>:442:9`!)
13569 if (flags & MSG_EOR) {
13570 sinfo_flags |= SCTP_EOR;
13571 }
13572 if (flags & MSG_EOF) {
13573 sinfo_flags |= SCTP_EOF;
13574 }
13575 #endif
13576 if (sinfo_flags & SCTP_SENDALLcxx . . $ `./netinet/sctp_uio.h:266:9`!) {
13577 /* its a sendall */
13578 error = sctp_sendallcxx . . $ sctp_sendall(ed2c7081b85208c6).(inp, uio, top, srcv);
13579 top = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!;
13580 goto out_unlocked;
13581 }
13582 if ((sinfo_flags & SCTP_ADDR_OVERcxx . . $ `./netinet/sctp_uio.h:265:9`!) && (addr == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!)) {
13583 SCTP_LTRACE_ERR_RETcxx . . $ `usrsctplib/netinet/sctp_os_userspace.h:629:9`!(inp, stcb, net, SCTP_FROM_SCTP_OUTPUT, EINVAL);
13584 error = EINVALcxx . . $ `<external>/8987895939074593727/errno-base.h:26:9`!;
13585 goto out_unlocked;
13586 }
13587 /* now we must find the assoc */
13588 if ((inp->sctp_flagscxx . . $ sctp_inpcb#sctp_flags. & SCTP_PCB_FLAGS_CONNECTEDcxx . . $ `usrsctplib/netinet/sctp.h:534:9`!) ||
13589 (inp->sctp_flagscxx . . $ sctp_inpcb#sctp_flags. & SCTP_PCB_FLAGS_IN_TCPPOOLcxx . . $ `usrsctplib/netinet/sctp.h:535:9`!)) {
13590 SCTP_INP_RLOCKcxx . . $ `usrsctplib/netinet/sctp_process_lock.h:376:9`!(inp);
13591 stcb = LIST_FIRSTcxx . . $ `<external>/2546723208511035544/queue.h:143:9`!(&inp->sctp_asoc_list);
13592 if (stcb) {
13593 SCTP_TCB_LOCKcxx . . $ `usrsctplib/netinet/sctp_process_lock.h:473:9`!(stcb);
13594 hold_tcblock = 1;
13595 }
13596 SCTP_INP_RUNLOCKcxx . . $ `usrsctplib/netinet/sctp_process_lock.h:381:9`!(inp);
13597 } else if (sinfo_assoc_id) {
13598 stcb = sctp_findassociation_ep_asocidcxx . . $ sctp_findassociation_ep_asocid(892768305218a9a2).(inp, sinfo_assoc_id, 1);
13599 if (stcb != NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!) {
13600 hold_tcblock = 1;
13601 }
13602 } else if (addr) {
13603 /*-
13604 * Since we did not use findep we must
13605 * increment it, and if we don't find a tcb
13606 * decrement it.
13607 */
13608 SCTP_INP_WLOCKcxx . . $ `usrsctplib/netinet/sctp_process_lock.h:378:9`!(inp);
13609 SCTP_INP_INCR_REFcxx . . $ `usrsctplib/netinet/sctp_process_lock.h:390:9`!(inp);
13610 SCTP_INP_WUNLOCKcxx . . $ `usrsctplib/netinet/sctp_process_lock.h:383:9`!(inp);
13611 stcb = sctp_findassociation_ep_addrcxx . . $ sctp_findassociation_ep_addr(c9fc63f2d9c07946).(&t_inp, addr, &net, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!);
13612 if (stcb == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!) {
13613 SCTP_INP_WLOCKcxx . . $ `usrsctplib/netinet/sctp_process_lock.h:378:9`!(inp);
13614 SCTP_INP_DECR_REFcxx . . $ `usrsctplib/netinet/sctp_process_lock.h:391:9`!(inp);
13615 SCTP_INP_WUNLOCKcxx . . $ `usrsctplib/netinet/sctp_process_lock.h:383:9`!(inp);
13616 } else {
13617 hold_tcblock = 1;
13618 }
13619 }
13620 if ((stcb == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!) && (addr)) {
13621 /* Possible implicit send? */
13622 SCTP_ASOC_CREATE_LOCKcxx . . $ `usrsctplib/netinet/sctp_process_lock.h:434:9`!(inp);
13623 create_lock_applied = 1;
13624 if ((inp->sctp_flagscxx . . $ sctp_inpcb#sctp_flags. & SCTP_PCB_FLAGS_SOCKET_GONEcxx . . $ `usrsctplib/netinet/sctp.h:541:9`!) ||
13625 (inp->sctp_flagscxx . . $ sctp_inpcb#sctp_flags. & SCTP_PCB_FLAGS_SOCKET_ALLGONEcxx . . $ `usrsctplib/netinet/sctp.h:542:9`!)) {
13626 /* Should I really unlock ? */
13627 SCTP_LTRACE_ERR_RETcxx . . $ `usrsctplib/netinet/sctp_os_userspace.h:629:9`!(NULL, NULL, NULL, SCTP_FROM_SCTP_OUTPUT, EINVAL);
13628 error = EINVALcxx . . $ `<external>/8987895939074593727/errno-base.h:26:9`!;
13629 goto out_unlocked;
13630 }
13631 if (((inp->sctp_flagscxx . . $ sctp_inpcb#sctp_flags. & SCTP_PCB_FLAGS_BOUND_V6cxx . . $ `usrsctplib/netinet/sctp.h:539:9`!) == 0) &&
13632 (addr->sa_familycxx . . $ sockaddr#sa_family. == AF_INET6cxx . . $ `<external>/8962547315054503424/socket.h:105:9`!)) {
13633 SCTP_LTRACE_ERR_RETcxx . . $ `usrsctplib/netinet/sctp_os_userspace.h:629:9`!(inp, stcb, net, SCTP_FROM_SCTP_OUTPUT, EINVAL);
13634 error = EINVALcxx . . $ `<external>/8987895939074593727/errno-base.h:26:9`!;
13635 goto out_unlocked;
13636 }
13637 SCTP_INP_WLOCKcxx . . $ `usrsctplib/netinet/sctp_process_lock.h:378:9`!(inp);
13638 SCTP_INP_INCR_REFcxx . . $ `usrsctplib/netinet/sctp_process_lock.h:390:9`!(inp);
13639 SCTP_INP_WUNLOCKcxx . . $ `usrsctplib/netinet/sctp_process_lock.h:383:9`!(inp);
13640 /* With the lock applied look again */
13641 stcb = sctp_findassociation_ep_addrcxx . . $ sctp_findassociation_ep_addr(c9fc63f2d9c07946).(&t_inp, addr, &net, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!);
13642 #if defined(INETcxx . . $ `<built-in>:431:9`!) || defined(INET6cxx . . $ `<built-in>:432:9`!)
13643 if ((stcb == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!) && (control != NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!) && (port > 0)) {
13644 stcb = sctp_findassociation_cmsgscxx . . $ sctp_findassociation_cmsgs(87f9494bfc331360).(&t_inp, port, control, &net, &error);
13645 }
13646 #endif
13647 if (stcb == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!) {
13648 SCTP_INP_WLOCKcxx . . $ `usrsctplib/netinet/sctp_process_lock.h:378:9`!(inp);
13649 SCTP_INP_DECR_REFcxx . . $ `usrsctplib/netinet/sctp_process_lock.h:391:9`!(inp);
13650 SCTP_INP_WUNLOCKcxx . . $ `usrsctplib/netinet/sctp_process_lock.h:383:9`!(inp);
13651 } else {
13652 hold_tcblock = 1;
13653 }
13654 if (error) {
13655 goto out_unlocked;
13656 }
13657 if (t_inp != inp) {
13658 SCTP_LTRACE_ERR_RETcxx . . $ `usrsctplib/netinet/sctp_os_userspace.h:629:9`!(inp, stcb, net, SCTP_FROM_SCTP_OUTPUT, ENOTCONN);
13659 error = ENOTCONNcxx . . $ `<external>/17922322188510340118/errno.h:91:9`!;
13660 goto out_unlocked;
13661 }
13662 }
13663 if (stcb == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!) {
13664 if (addr == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!) {
13665 SCTP_LTRACE_ERR_RETcxx . . $ `usrsctplib/netinet/sctp_os_userspace.h:629:9`!(inp, stcb, net, SCTP_FROM_SCTP_OUTPUT, ENOENT);
13666 error = ENOENTcxx . . $ `<external>/8987895939074593727/errno-base.h:6:9`!;
13667 goto out_unlocked;
13668 } else {
13669 /* We must go ahead and start the INIT process */
13670 uint32_tcxx . . $ uint32_t# vrf_id;
13671
13672 if ((sinfo_flags & SCTP_ABORTcxx . . $ `./netinet/sctp_uio.h:263:9`!) ||
13673 ((sinfo_flags & SCTP_EOFcxx . . $ `./netinet/sctp_uio.h:262:9`!) && (sndlen == 0))) {
13674 /*-
13675 * User asks to abort a non-existant assoc,
13676 * or EOF a non-existant assoc with no data
13677 */
13678 SCTP_LTRACE_ERR_RETcxx . . $ `usrsctplib/netinet/sctp_os_userspace.h:629:9`!(inp, stcb, net, SCTP_FROM_SCTP_OUTPUT, ENOENT);
13679 error = ENOENTcxx . . $ `<external>/8987895939074593727/errno-base.h:6:9`!;
13680 goto out_unlocked;
13681 }
13682 /* get an asoc/stcb struct */
13683 vrf_id = inp->def_vrf_idcxx . . $ sctp_inpcb#def_vrf_id.;
13684 #ifdef INVARIANTS
13685 if (create_lock_applied == 0) {
13686 panic("Error, should hold create lock and I don't?");
13687 }
13688 #endif
13689 stcb = sctp_aloc_assoccxx . . $ sctp_aloc_assoc(da675bf71def2315).(inp, addr, &error, 0, vrf_id,
13690 inp->sctp_epcxx . . $ sctp_inpcb#sctp_ep..pre_open_stream_countcxx . . $ sctp_pcb#pre_open_stream_count.,
13691 inp->sctp_epcxx . . $ sctp_inpcb#sctp_ep..portcxx . . $ sctp_pcb#port.,
13692 #if !defined(__Userspace__cxx . . $ `<built-in>:442:9`!)
13693 p,
13694 #else
13695 (struct proccxx . . $ proc# *)NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!,
13696 #endif
13697 SCTP_INITIALIZE_AUTH_PARAMScxx . . $ `usrsctplib/netinet/sctp_pcb.h:778:9`!);
13698 if (stcb == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!) {
13699 /* Error is setup for us in the call */
13700 goto out_unlocked;
13701 }
13702 if (stcb->sctp_epcxx . . $ sctp_tcb#sctp_ep.->sctp_flagscxx . . $ sctp_inpcb#sctp_flags. & SCTP_PCB_FLAGS_TCPTYPEcxx . . $ `usrsctplib/netinet/sctp.h:524:9`!) {
13703 stcb->sctp_epcxx . . $ sctp_tcb#sctp_ep.->sctp_flagscxx . . $ sctp_inpcb#sctp_flags. |= SCTP_PCB_FLAGS_CONNECTEDcxx . . $ `usrsctplib/netinet/sctp.h:534:9`!;
13704 /* Set the connected flag so we can queue data */
13705 soisconnectingcxx . . $ soisconnecting(ae6105f9f49454a6).(so);
13706 }
13707 hold_tcblock = 1;
13708 if (create_lock_applied) {
13709 SCTP_ASOC_CREATE_UNLOCKcxx . . $ `usrsctplib/netinet/sctp_process_lock.h:437:9`!(inp);
13710 create_lock_applied = 0;
13711 } else {
13712 SCTP_PRINTFcxx . . $ `usrsctplib/netinet/sctp_os_userspace.h:536:9`!("Huh-3? create lock should have been on??\n");
13713 }
13714 /* Turn on queue only flag to prevent data from being sent */
13715 queue_only = 1;
13716 asoc = &stcb->asoccxx . . $ sctp_tcb#asoc.;
13717 SCTP_SET_STATEcxx . . $ `usrsctplib/netinet/sctp_constants.h:478:9`!(stcb, SCTP_STATE_COOKIE_WAITcxx . . $ `usrsctplib/netinet/sctp_constants.h:462:9`!);
13718 (void)SCTP_GETTIME_TIMEVALcxx . . $ `usrsctplib/netinet/sctp_constants.h:995:9`!(&asoc->time_entered);
13719
13720 if (control) {
13721 if (sctp_process_cmsgs_for_initcxx . . $ sctp_process_cmsgs_for_init(da2a9b99f7879c8a).(stcb, control, &error)) {
13722 sctp_free_assoccxx . . $ sctp_free_assoc(69e1c9ccfdcaa16d).(inp, stcb, SCTP_PCBFREE_FORCEcxx . . $ `usrsctplib/netinet/sctp_constants.h:814:9`!,
13723 SCTP_FROM_SCTP_OUTPUTcxx . . $ `usrsctplib/netinet/sctp_constants.h:767:9`! + SCTP_LOC_6cxx . . $ `usrsctplib/netinet/sctp_constants.h:778:9`!);
13724 hold_tcblock = 0;
13725 stcb = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!;
13726 goto out_unlocked;
13727 }
13728 }
13729 /* out with the INIT */
13730 queue_only_for_init = 1;
13731 /*-
13732 * we may want to dig in after this call and adjust the MTU
13733 * value. It defaulted to 1500 (constant) but the ro
13734 * structure may now have an update and thus we may need to
13735 * change it BEFORE we append the message.
13736 */
13737 }
13738 } else
13739 asoc = &stcb->asoccxx . . $ sctp_tcb#asoc.;
13740 if (srcv == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!) {
13741 srcv = (struct sctp_sndrcvinfo *)&asoc->def_sendcxx . . $ sctp_association#def_send.;
13742 sinfo_flags = srcv->sinfo_flags;
13743 #if defined(__FreeBSD__) && !defined(__Userspace__cxx . . $ `<built-in>:442:9`!)
13744 if (flags & MSG_EOR) {
13745 sinfo_flags |= SCTP_EOR;
13746 }
13747 if (flags & MSG_EOF) {
13748 sinfo_flags |= SCTP_EOF;
13749 }
13750 #endif
13751 }
13752 if (sinfo_flags & SCTP_ADDR_OVERcxx . . $ `./netinet/sctp_uio.h:265:9`!) {
13753 if (addr)
13754 net = sctp_findnetcxx . . $ sctp_findnet(321fa7ec331b8ae4).(stcb, addr);
13755 else
13756 net = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!;
13757 if ((net == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!) ||
13758 ((port != 0) && (port != stcb->rportcxx . . $ sctp_tcb#rport.))) {
13759 SCTP_LTRACE_ERR_RETcxx . . $ `usrsctplib/netinet/sctp_os_userspace.h:629:9`!(inp, stcb, net, SCTP_FROM_SCTP_OUTPUT, EINVAL);
13760 error = EINVALcxx . . $ `<external>/8987895939074593727/errno-base.h:26:9`!;
13761 goto out_unlocked;
13762 }
13763 } else {
13764 if (stcb->asoccxx . . $ sctp_tcb#asoc..alternatecxx . . $ sctp_association#alternate.) {
13765 net = stcb->asoccxx . . $ sctp_tcb#asoc..alternatecxx . . $ sctp_association#alternate.;
13766 } else {
13767 net = stcb->asoccxx . . $ sctp_tcb#asoc..primary_destinationcxx . . $ sctp_association#primary_destination.;
13768 }
13769 }
13770 atomic_add_intcxx . . $ `usrsctplib/user_atomic.h:94:9`!(&stcb->total_sends, 1);
13771 /* Keep the stcb from being freed under our feet */
13772 atomic_add_intcxx . . $ `usrsctplib/user_atomic.h:94:9`!(&asoc->refcnt, 1);
13773 free_cnt_applied = 1;
13774
13775 if (sctp_is_feature_oncxx . . $ `usrsctplib/netinet/sctp_var.h:53:9`!(inp, SCTP_PCB_FLAGS_NO_FRAGMENTcxx . . $ `usrsctplib/netinet/sctp.h:583:9`!)) {
13776 if (sndlen > (ssize_tcxx . . $ ssize_t#)asoc->smallest_mtucxx . . $ sctp_association#smallest_mtu.) {
13777 SCTP_LTRACE_ERR_RETcxx . . $ `usrsctplib/netinet/sctp_os_userspace.h:629:9`!(inp, stcb, net, SCTP_FROM_SCTP_OUTPUT, EMSGSIZE);
13778 error = EMSGSIZEcxx . . $ `<external>/17922322188510340118/errno.h:74:9`!;
13779 goto out_unlocked;
13780 }
13781 }
13782 #if defined(__Userspace__cxx . . $ `<built-in>:442:9`!)
13783 if (inp->recv_callbackcxx . . $ sctp_inpcb#recv_callback.) {
13784 non_blocking = 1;
13785 }
13786 #endif
13787 if (SCTP_SO_IS_NBIOcxx . . $ `usrsctplib/netinet/sctp_os_userspace.h:947:9`!(so)
13788 #if defined(__FreeBSD__) && !defined(__Userspace__cxx . . $ `<built-in>:442:9`!)
13789 || (flags & (MSG_NBIO | MSG_DONTWAIT)) != 0
13790 #endif
13791 ) {
13792 non_blocking = 1;
13793 }
13794 /* would we block? */
13795 if (non_blocking) {
13796 ssize_tcxx . . $ ssize_t# amount;
13797
13798 if (hold_tcblock == 0) {
13799 SCTP_TCB_LOCKcxx . . $ `usrsctplib/netinet/sctp_process_lock.h:473:9`!(stcb);
13800 hold_tcblock = 1;
13801 }
13802 inqueue_bytes = stcb->asoccxx . . $ sctp_tcb#asoc..total_output_queue_sizecxx . . $ sctp_association#total_output_queue_size. - (stcb->asoccxx . . $ sctp_tcb#asoc..chunks_on_out_queuecxx . . $ sctp_association#chunks_on_out_queue. * SCTP_DATA_CHUNK_OVERHEADcxx . . $ `usrsctplib/netinet/sctp_output.h:137:9`!(stcb));
13803 if (user_marks_eor == 0) {
13804 amount = sndlen;
13805 } else {
13806 amount = 1;
13807 }
13808 if ((SCTP_SB_LIMIT_SNDcxx . . $ `usrsctplib/netinet/sctp_os_userspace.h:965:9`!(so) < (amount + inqueue_bytes + stcb->asoccxx . . $ sctp_tcb#asoc..sb_send_resvcxx . . $ sctp_association#sb_send_resv.)) ||
13809 (stcb->asoccxx . . $ sctp_tcb#asoc..chunks_on_out_queuecxx . . $ sctp_association#chunks_on_out_queue. >= SCTP_BASE_SYSCTLcxx . . $ `usrsctplib/netinet/sctp_os_userspace.h:579:9`!(sctp_max_chunks_on_queue))) {
13810 SCTP_LTRACE_ERR_RETcxx . . $ `usrsctplib/netinet/sctp_os_userspace.h:629:9`!(inp, stcb, net, SCTP_FROM_SCTP_OUTPUT, EWOULDBLOCK);
13811 if (sndlen > (ssize_tcxx . . $ ssize_t#)SCTP_SB_LIMIT_SNDcxx . . $ `usrsctplib/netinet/sctp_os_userspace.h:965:9`!(so))
13812 error = EMSGSIZEcxx . . $ `<external>/17922322188510340118/errno.h:74:9`!;
13813 else
13814 error = EWOULDBLOCKcxx . . $ `<external>/17922322188510340118/errno.h:22:9`!;
13815 goto out_unlocked;
13816 }
13817 stcb->asoccxx . . $ sctp_tcb#asoc..sb_send_resvcxx . . $ sctp_association#sb_send_resv. += (uint32_tcxx . . $ uint32_t#)sndlen;
13818 SCTP_TCB_UNLOCKcxx . . $ `usrsctplib/netinet/sctp_process_lock.h:476:9`!(stcb);
13819 hold_tcblock = 0;
13820 } else {
13821 atomic_add_intcxx . . $ `usrsctplib/user_atomic.h:94:9`!(&stcb->asoc.sb_send_resv, sndlen);
13822 }
13823 local_soresv = sndlen;
13824 if (stcb->asoccxx . . $ sctp_tcb#asoc..statecxx . . $ sctp_association#state. & SCTP_STATE_ABOUT_TO_BE_FREEDcxx . . $ `usrsctplib/netinet/sctp_constants.h:470:9`!) {
13825 SCTP_LTRACE_ERR_RETcxx . . $ `usrsctplib/netinet/sctp_os_userspace.h:629:9`!(NULL, stcb, NULL, SCTP_FROM_SCTP_OUTPUT, ECONNRESET);
13826 error = ECONNRESETcxx . . $ `<external>/17922322188510340118/errno.h:88:9`!;
13827 goto out_unlocked;
13828 }
13829 if (create_lock_applied) {
13830 SCTP_ASOC_CREATE_UNLOCKcxx . . $ `usrsctplib/netinet/sctp_process_lock.h:437:9`!(inp);
13831 create_lock_applied = 0;
13832 }
13833 /* Is the stream no. valid? */
13834 if (srcv->sinfo_stream >= asoc->streamoutcntcxx . . $ sctp_association#streamoutcnt.) {
13835 /* Invalid stream number */
13836 SCTP_LTRACE_ERR_RETcxx . . $ `usrsctplib/netinet/sctp_os_userspace.h:629:9`!(inp, stcb, net, SCTP_FROM_SCTP_OUTPUT, EINVAL);
13837 error = EINVALcxx . . $ `<external>/8987895939074593727/errno-base.h:26:9`!;
13838 goto out_unlocked;
13839 }
13840 if ((asoc->strmoutcxx . . $ sctp_association#strmout.[srcv->sinfo_stream].statecxx . . $ sctp_stream_out#state. != SCTP_STREAM_OPENcxx . . $ `usrsctplib/netinet/sctp_structs.h:650:9`!) &&
13841 (asoc->strmoutcxx . . $ sctp_association#strmout.[srcv->sinfo_stream].statecxx . . $ sctp_stream_out#state. != SCTP_STREAM_OPENINGcxx . . $ `usrsctplib/netinet/sctp_structs.h:649:9`!)) {
13842 /*
13843 * Can't queue any data while stream reset is underway.
13844 */
13845 if (asoc->strmoutcxx . . $ sctp_association#strmout.[srcv->sinfo_stream].statecxx . . $ sctp_stream_out#state. > SCTP_STREAM_OPENcxx . . $ `usrsctplib/netinet/sctp_structs.h:650:9`!) {
13846 error = EAGAINcxx . . $ `<external>/8987895939074593727/errno-base.h:15:9`!;
13847 } else {
13848 error = EINVALcxx . . $ `<external>/8987895939074593727/errno-base.h:26:9`!;
13849 }
13850 SCTP_LTRACE_ERR_RETcxx . . $ `usrsctplib/netinet/sctp_os_userspace.h:629:9`!(inp, stcb, net, SCTP_FROM_SCTP_OUTPUT, error);
13851 goto out_unlocked;
13852 }
13853 if ((SCTP_GET_STATEcxx . . $ `usrsctplib/netinet/sctp_constants.h:476:9`!(stcb) == SCTP_STATE_COOKIE_WAITcxx . . $ `usrsctplib/netinet/sctp_constants.h:462:9`!) ||
13854 (SCTP_GET_STATEcxx . . $ `usrsctplib/netinet/sctp_constants.h:476:9`!(stcb) == SCTP_STATE_COOKIE_ECHOEDcxx . . $ `usrsctplib/netinet/sctp_constants.h:463:9`!)) {
13855 queue_only = 1;
13856 }
13857 /* we are now done with all control */
13858 if (control) {
13859 sctp_m_freemcxx . . $ `usrsctplib/netinet/sctputil.h:57:9`!(control);
13860 control = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!;
13861 }
13862 if ((SCTP_GET_STATEcxx . . $ `usrsctplib/netinet/sctp_constants.h:476:9`!(stcb) == SCTP_STATE_SHUTDOWN_SENTcxx . . $ `usrsctplib/netinet/sctp_constants.h:465:9`!) ||
13863 (SCTP_GET_STATEcxx . . $ `usrsctplib/netinet/sctp_constants.h:476:9`!(stcb) == SCTP_STATE_SHUTDOWN_RECEIVEDcxx . . $ `usrsctplib/netinet/sctp_constants.h:466:9`!) ||
13864 (SCTP_GET_STATEcxx . . $ `usrsctplib/netinet/sctp_constants.h:476:9`!(stcb) == SCTP_STATE_SHUTDOWN_ACK_SENTcxx . . $ `usrsctplib/netinet/sctp_constants.h:467:9`!) ||
13865 (asoc->statecxx . . $ sctp_association#state. & SCTP_STATE_SHUTDOWN_PENDINGcxx . . $ `usrsctplib/netinet/sctp_constants.h:468:9`!)) {
13866 if (sinfo_flags & SCTP_ABORTcxx . . $ `./netinet/sctp_uio.h:263:9`!) {
13867 ;
13868 } else {
13869 SCTP_LTRACE_ERR_RETcxx . . $ `usrsctplib/netinet/sctp_os_userspace.h:629:9`!(NULL, stcb, NULL, SCTP_FROM_SCTP_OUTPUT, ECONNRESET);
13870 error = ECONNRESETcxx . . $ `<external>/17922322188510340118/errno.h:88:9`!;
13871 goto out_unlocked;
13872 }
13873 }
13874 /* Ok, we will attempt a msgsnd :> */
13875 #if !(defined(_WIN32) || defined(__Userspace__cxx . . $ `<built-in>:442:9`!))
13876 if (p) {
13877 #if defined(__FreeBSD__)
13878 p->td_ru.ru_msgsnd++;
13879 #else
13880 p->p_stats->p_ru.ru_msgsnd++;
13881 #endif
13882 }
13883 #endif
13884 /* Are we aborting? */
13885 if (sinfo_flags & SCTP_ABORTcxx . . $ `./netinet/sctp_uio.h:263:9`!) {
13886 struct mbufcxx . . $ mbuf# *mm;
13887 ssize_tcxx . . $ ssize_t# tot_demand, tot_out = 0, max_out;
13888
13889 SCTP_STAT_INCRcxx . . $ `./netinet/sctp_uio.h:1111:9`!(sctps_sends_with_abort);
13890 if ((SCTP_GET_STATEcxx . . $ `usrsctplib/netinet/sctp_constants.h:476:9`!(stcb) == SCTP_STATE_COOKIE_WAITcxx . . $ `usrsctplib/netinet/sctp_constants.h:462:9`!) ||
13891 (SCTP_GET_STATEcxx . . $ `usrsctplib/netinet/sctp_constants.h:476:9`!(stcb) == SCTP_STATE_COOKIE_ECHOEDcxx . . $ `usrsctplib/netinet/sctp_constants.h:463:9`!)) {
13892 /* It has to be up before we abort */
13893 /* how big is the user initiated abort? */
13894 SCTP_LTRACE_ERR_RETcxx . . $ `usrsctplib/netinet/sctp_os_userspace.h:629:9`!(inp, stcb, net, SCTP_FROM_SCTP_OUTPUT, EINVAL);
13895 error = EINVALcxx . . $ `<external>/8987895939074593727/errno-base.h:26:9`!;
13896 goto out;
13897 }
13898 if (hold_tcblock) {
13899 SCTP_TCB_UNLOCKcxx . . $ `usrsctplib/netinet/sctp_process_lock.h:476:9`!(stcb);
13900 hold_tcblock = 0;
13901 }
13902 if (top) {
13903 struct mbufcxx . . $ mbuf# *cntm = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!;
13904
13905 mm = sctp_get_mbuf_for_msgcxx . . $ sctp_get_mbuf_for_msg(c7c30fc329598377).(sizeof(struct sctp_paramhdrcxx . . $ sctp_paramhdr#), 0, M_WAITOKcxx . . $ `usrsctplib/user_malloc.h:61:9`!, 1, MT_DATAcxx . . $ `usrsctplib/user_mbuf.h:289:9`!);
13906 if (sndlen != 0) {
13907 for (cntm = top; cntm; cntm = SCTP_BUF_NEXTcxx . . $ `usrsctplib/netinet/sctp_os_userspace.h:791:9`!(cntm)) {
13908 tot_out += SCTP_BUF_LENcxx . . $ `usrsctplib/netinet/sctp_os_userspace.h:790:9`!(cntm);
13909 }
13910 }
13911 } else {
13912 /* Must fit in a MTU */
13913 tot_out = sndlen;
13914 tot_demand = (tot_out + sizeof(struct sctp_paramhdrcxx . . $ sctp_paramhdr#));
13915 if (tot_demand > SCTP_DEFAULT_ADD_MOREcxx . . $ `usrsctplib/netinet/sctp_constants.h:841:9`!) {
13916 /* To big */
13917 SCTP_LTRACE_ERR_RETcxx . . $ `usrsctplib/netinet/sctp_os_userspace.h:629:9`!(NULL, stcb, net, SCTP_FROM_SCTP_OUTPUT, EMSGSIZE);
13918 error = EMSGSIZEcxx . . $ `<external>/17922322188510340118/errno.h:74:9`!;
13919 goto out;
13920 }
13921 mm = sctp_get_mbuf_for_msgcxx . . $ sctp_get_mbuf_for_msg(c7c30fc329598377).((unsigned int)tot_demand, 0, M_WAITOKcxx . . $ `usrsctplib/user_malloc.h:61:9`!, 1, MT_DATAcxx . . $ `usrsctplib/user_mbuf.h:289:9`!);
13922 }
13923 if (mm == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!) {
13924 SCTP_LTRACE_ERR_RETcxx . . $ `usrsctplib/netinet/sctp_os_userspace.h:629:9`!(NULL, stcb, net, SCTP_FROM_SCTP_OUTPUT, ENOMEM);
13925 error = ENOMEMcxx . . $ `<external>/8987895939074593727/errno-base.h:16:9`!;
13926 goto out;
13927 }
13928 max_out = asoc->smallest_mtucxx . . $ sctp_association#smallest_mtu. - sizeof(struct sctp_paramhdrcxx . . $ sctp_paramhdr#);
13929 max_out -= sizeof(struct sctp_abort_msgcxx . . $ sctp_abort_msg#);
13930 if (tot_out > max_out) {
13931 tot_out = max_out;
13932 }
13933 if (mm) {
13934 struct sctp_paramhdrcxx . . $ sctp_paramhdr# *ph;
13935
13936 /* now move forward the data pointer */
13937 ph = mtodcxx . . $ `usrsctplib/user_mbuf.h:96:9`!(mm, struct sctp_paramhdr *);
13938 ph->param_typecxx . . $ sctp_paramhdr#param_type. = htonscxx . . $ htons(a18c05e4017afb3d).(SCTP_CAUSE_USER_INITIATED_ABTcxx . . $ `usrsctplib/netinet/sctp.h:372:9`!);
13939 ph->param_lengthcxx . . $ sctp_paramhdr#param_length. = htonscxx . . $ htons(a18c05e4017afb3d).((uint16_tcxx . . $ uint16_t#)(sizeof(struct sctp_paramhdrcxx . . $ sctp_paramhdr#) + tot_out));
13940 ph++;
13941 SCTP_BUF_LENcxx . . $ `usrsctplib/netinet/sctp_os_userspace.h:790:9`!(mm) = (int)(tot_out + sizeof(struct sctp_paramhdrcxx . . $ sctp_paramhdr#));
13942 if (top == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!) {
13943 #if defined(__APPLE__) && !defined(__Userspace__cxx . . $ `<built-in>:442:9`!)
13944 SCTP_SOCKET_UNLOCK(so, 0);
13945 #endif
13946 error = uiomovecxx . . $ uiomove(76b2b074f1e589d6).((caddr_tcxx . . $ caddr_t#)ph, (int)tot_out, uio);
13947 #if defined(__APPLE__) && !defined(__Userspace__cxx . . $ `<built-in>:442:9`!)
13948 SCTP_SOCKET_LOCK(so, 0);
13949 #endif
13950 if (error) {
13951 /*-
13952 * Here if we can't get his data we
13953 * still abort we just don't get to
13954 * send the users note :-0
13955 */
13956 sctp_m_freemcxx . . $ `usrsctplib/netinet/sctputil.h:57:9`!(mm);
13957 mm = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!;
13958 }
13959 } else {
13960 if (sndlen != 0) {
13961 SCTP_BUF_NEXTcxx . . $ `usrsctplib/netinet/sctp_os_userspace.h:791:9`!(mm) = top;
13962 }
13963 }
13964 }
13965 if (hold_tcblock == 0) {
13966 SCTP_TCB_LOCKcxx . . $ `usrsctplib/netinet/sctp_process_lock.h:473:9`!(stcb);
13967 }
13968 atomic_add_intcxx . . $ `usrsctplib/user_atomic.h:94:9`!(&stcb->asoc.refcnt, -1);
13969 free_cnt_applied = 0;
13970 /* release this lock, otherwise we hang on ourselves */
13971 #if defined(__FreeBSD__) && !defined(__Userspace__cxx . . $ `<built-in>:442:9`!)
13972 NET_EPOCH_ENTER(et);
13973 #endif
13974 sctp_abort_an_associationcxx . . $ sctp_abort_an_association(2bef2660eefb26cd).(stcb->sctp_epcxx . . $ sctp_tcb#sctp_ep., stcb, mm, SCTP_SO_LOCKEDcxx . . $ `usrsctplib/netinet/sctp_constants.h:963:9`!);
13975 #if defined(__FreeBSD__) && !defined(__Userspace__cxx . . $ `<built-in>:442:9`!)
13976 NET_EPOCH_EXIT(et);
13977 #endif
13978 /* now relock the stcb so everything is sane */
13979 hold_tcblock = 0;
13980 stcb = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!;
13981 /* In this case top is already chained to mm
13982 * avoid double free, since we free it below if
13983 * top != NULL and driver would free it after sending
13984 * the packet out
13985 */
13986 if (sndlen != 0) {
13987 top = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!;
13988 }
13989 goto out_unlocked;
13990 }
13991 /* Calculate the maximum we can send */
13992 inqueue_bytes = stcb->asoccxx . . $ sctp_tcb#asoc..total_output_queue_sizecxx . . $ sctp_association#total_output_queue_size. - (stcb->asoccxx . . $ sctp_tcb#asoc..chunks_on_out_queuecxx . . $ sctp_association#chunks_on_out_queue. * SCTP_DATA_CHUNK_OVERHEADcxx . . $ `usrsctplib/netinet/sctp_output.h:137:9`!(stcb));
13993 if (SCTP_SB_LIMIT_SNDcxx . . $ `usrsctplib/netinet/sctp_os_userspace.h:965:9`!(so) > inqueue_bytes) {
13994 max_len = SCTP_SB_LIMIT_SNDcxx . . $ `usrsctplib/netinet/sctp_os_userspace.h:965:9`!(so) - inqueue_bytes;
13995 } else {
13996 max_len = 0;
13997 }
13998 if (hold_tcblock) {
13999 SCTP_TCB_UNLOCKcxx . . $ `usrsctplib/netinet/sctp_process_lock.h:476:9`!(stcb);
14000 hold_tcblock = 0;
14001 }
14002 if (asoc->strmoutcxx . . $ sctp_association#strmout. == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!) {
14003 /* huh? software error */
14004 SCTP_LTRACE_ERR_RETcxx . . $ `usrsctplib/netinet/sctp_os_userspace.h:629:9`!(inp, stcb, net, SCTP_FROM_SCTP_OUTPUT, EFAULT);
14005 error = EFAULTcxx . . $ `<external>/8987895939074593727/errno-base.h:18:9`!;
14006 goto out_unlocked;
14007 }
14008
14009 /* Unless E_EOR mode is on, we must make a send FIT in one call. */
14010 if ((user_marks_eor == 0) &&
14011 (sndlen > (ssize_tcxx . . $ ssize_t#)SCTP_SB_LIMIT_SNDcxx . . $ `usrsctplib/netinet/sctp_os_userspace.h:965:9`!(stcb->sctp_socket))) {
14012 /* It will NEVER fit */
14013 SCTP_LTRACE_ERR_RETcxx . . $ `usrsctplib/netinet/sctp_os_userspace.h:629:9`!(NULL, stcb, net, SCTP_FROM_SCTP_OUTPUT, EMSGSIZE);
14014 error = EMSGSIZEcxx . . $ `<external>/17922322188510340118/errno.h:74:9`!;
14015 goto out_unlocked;
14016 }
14017 if ((uio == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!) && user_marks_eor) {
14018 /*-
14019 * We do not support eeor mode for
14020 * sending with mbuf chains (like sendfile).
14021 */
14022 SCTP_LTRACE_ERR_RETcxx . . $ `usrsctplib/netinet/sctp_os_userspace.h:629:9`!(NULL, stcb, net, SCTP_FROM_SCTP_OUTPUT, EINVAL);
14023 error = EINVALcxx . . $ `<external>/8987895939074593727/errno-base.h:26:9`!;
14024 goto out_unlocked;
14025 }
14026
14027 if (user_marks_eor) {
14028 local_add_more = (ssize_tcxx . . $ ssize_t#)mincxx . . $ `usrsctplib/user_environment.h:66:9`!(SCTP_SB_LIMIT_SNDcxx . . $ `usrsctplib/netinet/sctp_os_userspace.h:965:9`!(so), SCTP_BASE_SYSCTLcxx . . $ `usrsctplib/netinet/sctp_os_userspace.h:579:9`!(sctp_add_more_threshold));
14029 } else {
14030 /*-
14031 * For non-eeor the whole message must fit in
14032 * the socket send buffer.
14033 */
14034 local_add_more = sndlen;
14035 }
14036 if (non_blocking) {
14037 goto skip_preblock;
14038 }
14039 if (((max_len <= local_add_more) &&
14040 ((ssize_tcxx . . $ ssize_t#)SCTP_SB_LIMIT_SNDcxx . . $ `usrsctplib/netinet/sctp_os_userspace.h:965:9`!(so) >= local_add_more)) ||
14041 (max_len == 0) ||
14042 ((stcb->asoccxx . . $ sctp_tcb#asoc..chunks_on_out_queuecxx . . $ sctp_association#chunks_on_out_queue.+stcb->asoccxx . . $ sctp_tcb#asoc..stream_queue_cntcxx . . $ sctp_association#stream_queue_cnt.) >= SCTP_BASE_SYSCTLcxx . . $ `usrsctplib/netinet/sctp_os_userspace.h:579:9`!(sctp_max_chunks_on_queue))) {
14043 /* No room right now ! */
14044 SOCKBUF_LOCKcxx . . $ `usrsctplib/netinet/sctp_process_lock.h:516:9`!(&so->so_snd);
14045 inqueue_bytes = stcb->asoccxx . . $ sctp_tcb#asoc..total_output_queue_sizecxx . . $ sctp_association#total_output_queue_size. - (stcb->asoccxx . . $ sctp_tcb#asoc..chunks_on_out_queuecxx . . $ sctp_association#chunks_on_out_queue. * SCTP_DATA_CHUNK_OVERHEADcxx . . $ `usrsctplib/netinet/sctp_output.h:137:9`!(stcb));
14046 while ((SCTP_SB_LIMIT_SNDcxx . . $ `usrsctplib/netinet/sctp_os_userspace.h:965:9`!(so) < (inqueue_bytes + local_add_more)) ||
14047 ((stcb->asoccxx . . $ sctp_tcb#asoc..stream_queue_cntcxx . . $ sctp_association#stream_queue_cnt. + stcb->asoccxx . . $ sctp_tcb#asoc..chunks_on_out_queuecxx . . $ sctp_association#chunks_on_out_queue.) >= SCTP_BASE_SYSCTLcxx . . $ `usrsctplib/netinet/sctp_os_userspace.h:579:9`!(sctp_max_chunks_on_queue))) {
14048 SCTPDBGcxx . . $ `usrsctplib/netinet/sctp_os_userspace.h:591:9`!(SCTP_DEBUG_OUTPUT1cxx . . $ `usrsctplib/netinet/sctp_constants.h:643:9`!,"pre_block limit:%u <(inq:%d + %zd) || (%d+%d > %d)\n",
14049 (unsigned int)SCTP_SB_LIMIT_SNDcxx . . $ `usrsctplib/netinet/sctp_os_userspace.h:965:9`!(so),
14050 inqueue_bytes,
14051 local_add_more,
14052 stcb->asoc.stream_queue_cnt,
14053 stcb->asoc.chunks_on_out_queue,
14054 SCTP_BASE_SYSCTLcxx . . $ `usrsctplib/netinet/sctp_os_userspace.h:579:9`!(sctp_max_chunks_on_queue));
14055 if (SCTP_BASE_SYSCTLcxx . . $ `usrsctplib/netinet/sctp_os_userspace.h:579:9`!(sctp_logging_level) & SCTP_BLK_LOGGING_ENABLEcxx . . $ `usrsctplib/netinet/sctp.h:638:9`!) {
14056 sctp_log_blockcxx . . $ sctp_log_block(ca2f4465ee2724ed).(SCTP_BLOCK_LOG_INTO_BLKAcxx . . $ `usrsctplib/netinet/sctp_constants.h:190:9`!, asoc, sndlen);
14057 }
14058 be.errorcxx . . $ sctp_block_entry#error. = 0;
14059 #if !(defined(_WIN32) && !defined(__Userspace__cxx . . $ `<built-in>:442:9`!))
14060 stcb->block_entrycxx . . $ sctp_tcb#block_entry. = &be;
14061 #endif
14062 error = sbwaitcxx . . $ sbwait(ada175fcc3abaf35).(&so->so_sndcxx . . $ socket#so_snd.);
14063 stcb->block_entrycxx . . $ sctp_tcb#block_entry. = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!;
14064 if (error || so->so_errorcxx . . $ socket#so_error. || be.errorcxx . . $ sctp_block_entry#error.) {
14065 if (error == 0) {
14066 if (so->so_errorcxx . . $ socket#so_error.)
14067 error = so->so_errorcxx . . $ socket#so_error.;
14068 if (be.errorcxx . . $ sctp_block_entry#error.) {
14069 error = be.errorcxx . . $ sctp_block_entry#error.;
14070 }
14071 }
14072 SOCKBUF_UNLOCKcxx . . $ `usrsctplib/netinet/sctp_process_lock.h:518:9`!(&so->so_snd);
14073 goto out_unlocked;
14074 }
14075 if (SCTP_BASE_SYSCTLcxx . . $ `usrsctplib/netinet/sctp_os_userspace.h:579:9`!(sctp_logging_level) & SCTP_BLK_LOGGING_ENABLEcxx . . $ `usrsctplib/netinet/sctp.h:638:9`!) {
14076 sctp_log_blockcxx . . $ sctp_log_block(ca2f4465ee2724ed).(SCTP_BLOCK_LOG_OUTOF_BLKcxx . . $ `usrsctplib/netinet/sctp_constants.h:118:9`!,
14077 asoc, stcb->asoccxx . . $ sctp_tcb#asoc..total_output_queue_sizecxx . . $ sctp_association#total_output_queue_size.);
14078 }
14079 if (stcb->asoccxx . . $ sctp_tcb#asoc..statecxx . . $ sctp_association#state. & SCTP_STATE_ABOUT_TO_BE_FREEDcxx . . $ `usrsctplib/netinet/sctp_constants.h:470:9`!) {
14080 SOCKBUF_UNLOCKcxx . . $ `usrsctplib/netinet/sctp_process_lock.h:518:9`!(&so->so_snd);
14081 goto out_unlocked;
14082 }
14083 inqueue_bytes = stcb->asoccxx . . $ sctp_tcb#asoc..total_output_queue_sizecxx . . $ sctp_association#total_output_queue_size. - (stcb->asoccxx . . $ sctp_tcb#asoc..chunks_on_out_queuecxx . . $ sctp_association#chunks_on_out_queue. * SCTP_DATA_CHUNK_OVERHEADcxx . . $ `usrsctplib/netinet/sctp_output.h:137:9`!(stcb));
14084 }
14085 if (SCTP_SB_LIMIT_SNDcxx . . $ `usrsctplib/netinet/sctp_os_userspace.h:965:9`!(so) > inqueue_bytes) {
14086 max_len = SCTP_SB_LIMIT_SNDcxx . . $ `usrsctplib/netinet/sctp_os_userspace.h:965:9`!(so) - inqueue_bytes;
14087 } else {
14088 max_len = 0;
14089 }
14090 SOCKBUF_UNLOCKcxx . . $ `usrsctplib/netinet/sctp_process_lock.h:518:9`!(&so->so_snd);
14091 }
14092
14093 skip_preblock:
14094 if (stcb->asoccxx . . $ sctp_tcb#asoc..statecxx . . $ sctp_association#state. & SCTP_STATE_ABOUT_TO_BE_FREEDcxx . . $ `usrsctplib/netinet/sctp_constants.h:470:9`!) {
14095 goto out_unlocked;
14096 }
14097 #if defined(__APPLE__) && !defined(__Userspace__cxx . . $ `<built-in>:442:9`!)
14098 error = sblock(&so->so_snd, SBLOCKWAIT(flags));
14099 #endif
14100 /* sndlen covers for mbuf case
14101 * uio_resid covers for the non-mbuf case
14102 * NOTE: uio will be null when top/mbuf is passed
14103 */
14104 if (sndlen == 0) {
14105 if (sinfo_flags & SCTP_EOFcxx . . $ `./netinet/sctp_uio.h:262:9`!) {
14106 got_all_of_the_send = 1;
14107 goto dataless_eof;
14108 } else {
14109 SCTP_LTRACE_ERR_RETcxx . . $ `usrsctplib/netinet/sctp_os_userspace.h:629:9`!(inp, stcb, net, SCTP_FROM_SCTP_OUTPUT, EINVAL);
14110 error = EINVALcxx . . $ `<external>/8987895939074593727/errno-base.h:26:9`!;
14111 goto out;
14112 }
14113 }
14114 if (top == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!) {
14115 struct sctp_stream_queue_pendingcxx . . $ sctp_stream_queue_pending# *sp;
14116 struct sctp_stream_outcxx . . $ sctp_stream_out# *strm;
14117 uint32_tcxx . . $ uint32_t# sndout;
14118
14119 SCTP_TCB_SEND_LOCKcxx . . $ `usrsctplib/netinet/sctp_process_lock.h:403:9`!(stcb);
14120 if ((asoc->stream_lockedcxx . . $ sctp_association#stream_locked.) &&
14121 (asoc->stream_locked_oncxx . . $ sctp_association#stream_locked_on. != srcv->sinfo_stream)) {
14122 SCTP_TCB_SEND_UNLOCKcxx . . $ `usrsctplib/netinet/sctp_process_lock.h:405:9`!(stcb);
14123 SCTP_LTRACE_ERR_RETcxx . . $ `usrsctplib/netinet/sctp_os_userspace.h:629:9`!(inp, stcb, net, SCTP_FROM_SCTP_OUTPUT, EINVAL);
14124 error = EINVALcxx . . $ `<external>/8987895939074593727/errno-base.h:26:9`!;
14125 goto out;
14126 }
14127 strm = &stcb->asoccxx . . $ sctp_tcb#asoc..strmoutcxx . . $ sctp_association#strmout.[srcv->sinfo_stream];
14128 if (strm->last_msg_incompletecxx . . $ sctp_stream_out#last_msg_incomplete. == 0) {
14129 do_a_copy_in:
14130 SCTP_TCB_SEND_UNLOCKcxx . . $ `usrsctplib/netinet/sctp_process_lock.h:405:9`!(stcb);
14131 sp = sctp_copy_it_incxx . . $ sctp_copy_it_in(7da23d652d52c7b1).(stcb, asoc, srcv, uio, net, max_len, user_marks_eor, &error);
14132 if (error) {
14133 goto out;
14134 }
14135 SCTP_TCB_SEND_LOCKcxx . . $ `usrsctplib/netinet/sctp_process_lock.h:403:9`!(stcb);
14136 if (sp->msg_is_completecxx . . $ sctp_stream_queue_pending#msg_is_complete.) {
14137 strm->last_msg_incompletecxx . . $ sctp_stream_out#last_msg_incomplete. = 0;
14138 asoc->stream_lockedcxx . . $ sctp_association#stream_locked. = 0;
14139 } else {
14140 /* Just got locked to this guy in
14141 * case of an interrupt.
14142 */
14143 strm->last_msg_incompletecxx . . $ sctp_stream_out#last_msg_incomplete. = 1;
14144 if (stcb->asoccxx . . $ sctp_tcb#asoc..idata_supportedcxx . . $ sctp_association#idata_supported. == 0) {
14145 asoc->stream_lockedcxx . . $ sctp_association#stream_locked. = 1;
14146 asoc->stream_locked_oncxx . . $ sctp_association#stream_locked_on. = srcv->sinfo_stream;
14147 }
14148 sp->sender_all_donecxx . . $ sctp_stream_queue_pending#sender_all_done. = 0;
14149 }
14150 sctp_snd_sb_alloccxx . . $ `usrsctplib/netinet/sctputil.h:327:9`!(stcb, sp->length);
14151 atomic_add_intcxx . . $ `usrsctplib/user_atomic.h:94:9`!(&asoc->stream_queue_cnt, 1);
14152 if (sinfo_flags & SCTP_UNORDEREDcxx . . $ `./netinet/sctp_uio.h:264:9`!) {
14153 SCTP_STAT_INCRcxx . . $ `./netinet/sctp_uio.h:1111:9`!(sctps_sends_with_unord);
14154 }
14155 sp->processingcxx . . $ sctp_stream_queue_pending#processing. = 1;
14156 TAILQ_INSERT_TAILcxx . . $ `<external>/2546723208511035544/queue.h:402:9`!(&strm->outqueue, sp, next);
14157 stcb->asoccxx . . $ sctp_tcb#asoc..ss_functionscxx . . $ sctp_association#ss_functions..sctp_ss_add_to_streamcxx . . $ sctp_ss_functions#sctp_ss_add_to_stream.(stcb, asoc, strm, sp, 1);
14158 } else {
14159 sp = TAILQ_LASTcxx . . $ `<external>/2546723208511035544/queue.h:461:9`!(&strm->outqueue, sctp_streamhead);
14160 if (sp == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!) {
14161 /* ???? Huh ??? last msg is gone */
14162 #ifdef INVARIANTS
14163 panic("Warning: Last msg marked incomplete, yet nothing left?");
14164 #else
14165 SCTP_PRINTFcxx . . $ `usrsctplib/netinet/sctp_os_userspace.h:536:9`!("Warning: Last msg marked incomplete, yet nothing left?\n");
14166 strm->last_msg_incompletecxx . . $ sctp_stream_out#last_msg_incomplete. = 0;
14167 #endif
14168 goto do_a_copy_in;
14169 }
14170 if (sp->processingcxx . . $ sctp_stream_queue_pending#processing.) {
14171 SCTP_TCB_SEND_UNLOCKcxx . . $ `usrsctplib/netinet/sctp_process_lock.h:405:9`!(stcb);
14172 SCTP_LTRACE_ERR_RETcxx . . $ `usrsctplib/netinet/sctp_os_userspace.h:629:9`!(inp, stcb, net, SCTP_FROM_SCTP_OUTPUT, EINVAL);
14173 error = EINVALcxx . . $ `<external>/8987895939074593727/errno-base.h:26:9`!;
14174 goto out;
14175 } else {
14176 sp->processingcxx . . $ sctp_stream_queue_pending#processing. = 1;
14177 }
14178 }
14179 SCTP_TCB_SEND_UNLOCKcxx . . $ `usrsctplib/netinet/sctp_process_lock.h:405:9`!(stcb);
14180 #if defined(__APPLE__) && !defined(__Userspace__cxx . . $ `<built-in>:442:9`!)
14181 #if defined(APPLE_LEOPARD)
14182 while (uio->uio_resid > 0) {
14183 #else
14184 while (uio_resid(uio) > 0) {
14185 #endif
14186 #else
14187 while (uio->uio_residcxx . . $ uio#uio_resid. > 0) {
14188 #endif
14189 /* How much room do we have? */
14190 struct mbufcxx . . $ mbuf# *new_tail, *mm;
14191
14192 inqueue_bytes = stcb->asoccxx . . $ sctp_tcb#asoc..total_output_queue_sizecxx . . $ sctp_association#total_output_queue_size. - (stcb->asoccxx . . $ sctp_tcb#asoc..chunks_on_out_queuecxx . . $ sctp_association#chunks_on_out_queue. * SCTP_DATA_CHUNK_OVERHEADcxx . . $ `usrsctplib/netinet/sctp_output.h:137:9`!(stcb));
14193 if (SCTP_SB_LIMIT_SNDcxx . . $ `usrsctplib/netinet/sctp_os_userspace.h:965:9`!(so) > inqueue_bytes)
14194 max_len = SCTP_SB_LIMIT_SNDcxx . . $ `usrsctplib/netinet/sctp_os_userspace.h:965:9`!(so) - inqueue_bytes;
14195 else
14196 max_len = 0;
14197
14198 if ((max_len > (ssize_tcxx . . $ ssize_t#)SCTP_BASE_SYSCTLcxx . . $ `usrsctplib/netinet/sctp_os_userspace.h:579:9`!(sctp_add_more_threshold)) ||
14199 (max_len && (SCTP_SB_LIMIT_SNDcxx . . $ `usrsctplib/netinet/sctp_os_userspace.h:965:9`!(so) < SCTP_BASE_SYSCTLcxx . . $ `usrsctplib/netinet/sctp_os_userspace.h:579:9`!(sctp_add_more_threshold))) ||
14200 #if defined(__APPLE__) && !defined(__Userspace__cxx . . $ `<built-in>:442:9`!)
14201 #if defined(APPLE_LEOPARD)
14202 (uio->uio_resid && (uio->uio_resid <= max_len))) {
14203 #else
14204 (uio_resid(uio) && (uio_resid(uio) <= max_len))) {
14205 #endif
14206 #else
14207 (uio->uio_residcxx . . $ uio#uio_resid. && (uio->uio_residcxx . . $ uio#uio_resid. <= max_len))) {
14208 #endif
14209 sndout = 0;
14210 new_tail = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!;
14211 if (hold_tcblock) {
14212 SCTP_TCB_UNLOCKcxx . . $ `usrsctplib/netinet/sctp_process_lock.h:476:9`!(stcb);
14213 hold_tcblock = 0;
14214 }
14215 #if defined(__APPLE__) && !defined(__Userspace__cxx . . $ `<built-in>:442:9`!)
14216 SCTP_SOCKET_UNLOCK(so, 0);
14217 #endif
14218 #if defined(__FreeBSD__) || defined(__Userspace__cxx . . $ `<built-in>:442:9`!)
14219 mm = sctp_copy_resumecxx . . $ sctp_copy_resume(d841ccd8c5a7a27c).(uio, (int)max_len, user_marks_eor, &error, &sndout, &new_tail);
14220 #else
14221 mm = sctp_copy_resume(uio, (int)max_len, &error, &sndout, &new_tail);
14222 #endif
14223 #if defined(__APPLE__) && !defined(__Userspace__cxx . . $ `<built-in>:442:9`!)
14224 SCTP_SOCKET_LOCK(so, 0);
14225 #endif
14226 if ((mm == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!) || error) {
14227 if (mm) {
14228 sctp_m_freemcxx . . $ `usrsctplib/netinet/sctputil.h:57:9`!(mm);
14229 }
14230 SCTP_TCB_SEND_LOCKcxx . . $ `usrsctplib/netinet/sctp_process_lock.h:403:9`!(stcb);
14231 if (((stcb->asoccxx . . $ sctp_tcb#asoc..statecxx . . $ sctp_association#state. & SCTP_STATE_ABOUT_TO_BE_FREEDcxx . . $ `usrsctplib/netinet/sctp_constants.h:470:9`!) == 0) &&
14232 ((stcb->asoccxx . . $ sctp_tcb#asoc..statecxx . . $ sctp_association#state. & SCTP_STATE_WAS_ABORTEDcxx . . $ `usrsctplib/netinet/sctp_constants.h:472:9`!) == 0) &&
14233 (sp != NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!)) {
14234 sp->processingcxx . . $ sctp_stream_queue_pending#processing. = 0;
14235 }
14236 SCTP_TCB_SEND_UNLOCKcxx . . $ `usrsctplib/netinet/sctp_process_lock.h:405:9`!(stcb);
14237 goto out;
14238 }
14239 /* Update the mbuf and count */
14240 SCTP_TCB_SEND_LOCKcxx . . $ `usrsctplib/netinet/sctp_process_lock.h:403:9`!(stcb);
14241 if ((stcb->asoccxx . . $ sctp_tcb#asoc..statecxx . . $ sctp_association#state. & SCTP_STATE_ABOUT_TO_BE_FREEDcxx . . $ `usrsctplib/netinet/sctp_constants.h:470:9`!) ||
14242 (stcb->asoccxx . . $ sctp_tcb#asoc..statecxx . . $ sctp_association#state. & SCTP_STATE_WAS_ABORTEDcxx . . $ `usrsctplib/netinet/sctp_constants.h:472:9`!)) {
14243 /* we need to get out.
14244 * Peer probably aborted.
14245 */
14246 sctp_m_freemcxx . . $ `usrsctplib/netinet/sctputil.h:57:9`!(mm);
14247 if (stcb->asoccxx . . $ sctp_tcb#asoc..statecxx . . $ sctp_association#state. & SCTP_STATE_WAS_ABORTEDcxx . . $ `usrsctplib/netinet/sctp_constants.h:472:9`!) {
14248 SCTP_LTRACE_ERR_RETcxx . . $ `usrsctplib/netinet/sctp_os_userspace.h:629:9`!(NULL, stcb, NULL, SCTP_FROM_SCTP_OUTPUT, ECONNRESET);
14249 error = ECONNRESETcxx . . $ `<external>/17922322188510340118/errno.h:88:9`!;
14250 }
14251 SCTP_TCB_SEND_UNLOCKcxx . . $ `usrsctplib/netinet/sctp_process_lock.h:405:9`!(stcb);
14252 goto out;
14253 }
14254 if (sp->tail_mbufcxx . . $ sctp_stream_queue_pending#tail_mbuf.) {
14255 /* tack it to the end */
14256 SCTP_BUF_NEXTcxx . . $ `usrsctplib/netinet/sctp_os_userspace.h:791:9`!(sp->tail_mbuf) = mm;
14257 sp->tail_mbufcxx . . $ sctp_stream_queue_pending#tail_mbuf. = new_tail;
14258 } else {
14259 /* A stolen mbuf */
14260 sp->datacxx . . $ sctp_stream_queue_pending#data. = mm;
14261 sp->tail_mbufcxx . . $ sctp_stream_queue_pending#tail_mbuf. = new_tail;
14262 }
14263 sctp_snd_sb_alloccxx . . $ `usrsctplib/netinet/sctputil.h:327:9`!(stcb, sndout);
14264 atomic_add_intcxx . . $ `usrsctplib/user_atomic.h:94:9`!(&sp->length, sndout);
14265 if (sinfo_flags & SCTP_SACK_IMMEDIATELYcxx . . $ `./netinet/sctp_uio.h:268:9`!) {
14266 sp->sinfo_flagscxx . . $ sctp_stream_queue_pending#sinfo_flags. |= SCTP_SACK_IMMEDIATELYcxx . . $ `./netinet/sctp_uio.h:268:9`!;
14267 }
14268
14269 /* Did we reach EOR? */
14270 #if defined(__APPLE__) && !defined(__Userspace__cxx . . $ `<built-in>:442:9`!)
14271 #if defined(APPLE_LEOPARD)
14272 if ((uio->uio_resid == 0) &&
14273 #else
14274 if ((uio_resid(uio) == 0) &&
14275 #endif
14276 #else
14277 if ((uio->uio_residcxx . . $ uio#uio_resid. == 0) &&
14278 #endif
14279 ((user_marks_eor == 0) ||
14280 (sinfo_flags & SCTP_EOFcxx . . $ `./netinet/sctp_uio.h:262:9`!) ||
14281 (user_marks_eor && (sinfo_flags & SCTP_EORcxx . . $ `./netinet/sctp_uio.h:267:9`!)))) {
14282 sp->msg_is_completecxx . . $ sctp_stream_queue_pending#msg_is_complete. = 1;
14283 } else {
14284 sp->msg_is_completecxx . . $ sctp_stream_queue_pending#msg_is_complete. = 0;
14285 }
14286 SCTP_TCB_SEND_UNLOCKcxx . . $ `usrsctplib/netinet/sctp_process_lock.h:405:9`!(stcb);
14287 }
14288 #if defined(__APPLE__) && !defined(__Userspace__cxx . . $ `<built-in>:442:9`!)
14289 #if defined(APPLE_LEOPARD)
14290 if (uio->uio_resid == 0) {
14291 #else
14292 if (uio_resid(uio) == 0) {
14293 #endif
14294 #else
14295 if (uio->uio_residcxx . . $ uio#uio_resid. == 0) {
14296 #endif
14297 /* got it all? */
14298 continue;
14299 }
14300 /* PR-SCTP? */
14301 if ((asoc->prsctp_supportedcxx . . $ sctp_association#prsctp_supported.) && (asoc->sent_queue_cnt_removeablecxx . . $ sctp_association#sent_queue_cnt_removeable. > 0)) {
14302 /* This is ugly but we must assure locking order */
14303 if (hold_tcblock == 0) {
14304 SCTP_TCB_LOCKcxx . . $ `usrsctplib/netinet/sctp_process_lock.h:473:9`!(stcb);
14305 hold_tcblock = 1;
14306 }
14307 sctp_prune_prsctpcxx . . $ sctp_prune_prsctp(d414e49fb135549e).(stcb, asoc, srcv, (int)sndlen);
14308 inqueue_bytes = stcb->asoccxx . . $ sctp_tcb#asoc..total_output_queue_sizecxx . . $ sctp_association#total_output_queue_size. - (stcb->asoccxx . . $ sctp_tcb#asoc..chunks_on_out_queuecxx . . $ sctp_association#chunks_on_out_queue. * SCTP_DATA_CHUNK_OVERHEADcxx . . $ `usrsctplib/netinet/sctp_output.h:137:9`!(stcb));
14309 if (SCTP_SB_LIMIT_SNDcxx . . $ `usrsctplib/netinet/sctp_os_userspace.h:965:9`!(so) > inqueue_bytes)
14310 max_len = SCTP_SB_LIMIT_SNDcxx . . $ `usrsctplib/netinet/sctp_os_userspace.h:965:9`!(so) - inqueue_bytes;
14311 else
14312 max_len = 0;
14313 if (max_len > 0) {
14314 continue;
14315 }
14316 SCTP_TCB_UNLOCKcxx . . $ `usrsctplib/netinet/sctp_process_lock.h:476:9`!(stcb);
14317 hold_tcblock = 0;
14318 }
14319 /* wait for space now */
14320 if (non_blocking) {
14321 /* Non-blocking io in place out */
14322 SCTP_TCB_SEND_LOCKcxx . . $ `usrsctplib/netinet/sctp_process_lock.h:403:9`!(stcb);
14323 if (sp != NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!) {
14324 sp->processingcxx . . $ sctp_stream_queue_pending#processing. = 0;
14325 }
14326 SCTP_TCB_SEND_UNLOCKcxx . . $ `usrsctplib/netinet/sctp_process_lock.h:405:9`!(stcb);
14327 goto skip_out_eof;
14328 }
14329 /* What about the INIT, send it maybe */
14330 if (queue_only_for_init) {
14331 if (hold_tcblock == 0) {
14332 SCTP_TCB_LOCKcxx . . $ `usrsctplib/netinet/sctp_process_lock.h:473:9`!(stcb);
14333 hold_tcblock = 1;
14334 }
14335 if (SCTP_GET_STATEcxx . . $ `usrsctplib/netinet/sctp_constants.h:476:9`!(stcb) == SCTP_STATE_OPENcxx . . $ `usrsctplib/netinet/sctp_constants.h:464:9`!) {
14336 /* a collision took us forward? */
14337 queue_only = 0;
14338 } else {
14339 #if defined(__FreeBSD__) && !defined(__Userspace__cxx . . $ `<built-in>:442:9`!)
14340 NET_EPOCH_ENTER(et);
14341 #endif
14342 sctp_send_initiatecxx . . $ sctp_send_initiate(a11f8a89c1538453).(inp, stcb, SCTP_SO_LOCKEDcxx . . $ `usrsctplib/netinet/sctp_constants.h:963:9`!);
14343 #if defined(__FreeBSD__) && !defined(__Userspace__cxx . . $ `<built-in>:442:9`!)
14344 NET_EPOCH_EXIT(et);
14345 #endif
14346 SCTP_SET_STATEcxx . . $ `usrsctplib/netinet/sctp_constants.h:478:9`!(stcb, SCTP_STATE_COOKIE_WAITcxx . . $ `usrsctplib/netinet/sctp_constants.h:462:9`!);
14347 queue_only = 1;
14348 }
14349 }
14350 if ((net->flight_sizecxx . . $ sctp_nets#flight_size. > net->cwndcxx . . $ sctp_nets#cwnd.) &&
14351 (asoc->sctp_cmt_on_offcxx . . $ sctp_association#sctp_cmt_on_off. == 0)) {
14352 SCTP_STAT_INCRcxx . . $ `./netinet/sctp_uio.h:1111:9`!(sctps_send_cwnd_avoid);
14353 queue_only = 1;
14354 } else if (asoc->ifp_had_enobufcxx . . $ sctp_association#ifp_had_enobuf.) {
14355 SCTP_STAT_INCRcxx . . $ `./netinet/sctp_uio.h:1111:9`!(sctps_ifnomemqueued);
14356 if (net->flight_sizecxx . . $ sctp_nets#flight_size. > (2 * net->mtucxx . . $ sctp_nets#mtu.)) {
14357 queue_only = 1;
14358 }
14359 asoc->ifp_had_enobufcxx . . $ sctp_association#ifp_had_enobuf. = 0;
14360 }
14361 un_sent = stcb->asoccxx . . $ sctp_tcb#asoc..total_output_queue_sizecxx . . $ sctp_association#total_output_queue_size. - stcb->asoccxx . . $ sctp_tcb#asoc..total_flightcxx . . $ sctp_association#total_flight.;
14362 if ((sctp_is_feature_offcxx . . $ `usrsctplib/netinet/sctp_var.h:54:9`!(inp, SCTP_PCB_FLAGS_NODELAYcxx . . $ `usrsctplib/netinet/sctp.h:571:9`!)) &&
14363 (stcb->asoccxx . . $ sctp_tcb#asoc..total_flightcxx . . $ sctp_association#total_flight. > 0) &&
14364 (stcb->asoccxx . . $ sctp_tcb#asoc..stream_queue_cntcxx . . $ sctp_association#stream_queue_cnt. < SCTP_MAX_DATA_BUNDLINGcxx . . $ `usrsctplib/netinet/sctp_constants.h:880:9`!) &&
14365 (un_sent < (int)(stcb->asoccxx . . $ sctp_tcb#asoc..smallest_mtucxx . . $ sctp_association#smallest_mtu. - SCTP_MIN_OVERHEADcxx . . $ `usrsctplib/netinet/sctp_header.h:561:9`!))) {
14366 /*-
14367 * Ok, Nagle is set on and we have data outstanding.
14368 * Don't send anything and let SACKs drive out the
14369 * data unless we have a "full" segment to send.
14370 */
14371 if (SCTP_BASE_SYSCTLcxx . . $ `usrsctplib/netinet/sctp_os_userspace.h:579:9`!(sctp_logging_level) & SCTP_NAGLE_LOGGING_ENABLEcxx . . $ `usrsctplib/netinet/sctp.h:647:9`!) {
14372 sctp_log_nagle_eventcxx . . $ sctp_log_nagle_event(309e9a20a883d7fc).(stcb, SCTP_NAGLE_APPLIEDcxx . . $ `usrsctplib/netinet/sctp_constants.h:181:9`!);
14373 }
14374 SCTP_STAT_INCRcxx . . $ `./netinet/sctp_uio.h:1111:9`!(sctps_naglequeued);
14375 nagle_applies = 1;
14376 } else {
14377 if (SCTP_BASE_SYSCTLcxx . . $ `usrsctplib/netinet/sctp_os_userspace.h:579:9`!(sctp_logging_level) & SCTP_NAGLE_LOGGING_ENABLEcxx . . $ `usrsctplib/netinet/sctp.h:647:9`!) {
14378 if (sctp_is_feature_offcxx . . $ `usrsctplib/netinet/sctp_var.h:54:9`!(inp, SCTP_PCB_FLAGS_NODELAYcxx . . $ `usrsctplib/netinet/sctp.h:571:9`!))
14379 sctp_log_nagle_eventcxx . . $ sctp_log_nagle_event(309e9a20a883d7fc).(stcb, SCTP_NAGLE_SKIPPEDcxx . . $ `usrsctplib/netinet/sctp_constants.h:182:9`!);
14380 }
14381 SCTP_STAT_INCRcxx . . $ `./netinet/sctp_uio.h:1111:9`!(sctps_naglesent);
14382 nagle_applies = 0;
14383 }
14384 if (SCTP_BASE_SYSCTLcxx . . $ `usrsctplib/netinet/sctp_os_userspace.h:579:9`!(sctp_logging_level) & SCTP_BLK_LOGGING_ENABLEcxx . . $ `usrsctplib/netinet/sctp.h:638:9`!) {
14385 sctp_misc_intscxx . . $ sctp_misc_ints(da1ccf5149f5690e).(SCTP_CWNDLOG_PRESENDcxx . . $ `usrsctplib/netinet/sctp_constants.h:186:9`!, queue_only_for_init, queue_only,
14386 nagle_applies, un_sent);
14387 sctp_misc_intscxx . . $ sctp_misc_ints(da1ccf5149f5690e).(SCTP_CWNDLOG_PRESENDcxx . . $ `usrsctplib/netinet/sctp_constants.h:186:9`!, stcb->asoccxx . . $ sctp_tcb#asoc..total_output_queue_sizecxx . . $ sctp_association#total_output_queue_size.,
14388 stcb->asoccxx . . $ sctp_tcb#asoc..total_flightcxx . . $ sctp_association#total_flight.,
14389 stcb->asoccxx . . $ sctp_tcb#asoc..chunks_on_out_queuecxx . . $ sctp_association#chunks_on_out_queue., stcb->asoccxx . . $ sctp_tcb#asoc..total_flight_countcxx . . $ sctp_association#total_flight_count.);
14390 }
14391 if (queue_only_for_init)
14392 queue_only_for_init = 0;
14393 if ((queue_only == 0) && (nagle_applies == 0)) {
14394 /*-
14395 * need to start chunk output
14396 * before blocking.. note that if
14397 * a lock is already applied, then
14398 * the input via the net is happening
14399 * and I don't need to start output :-D
14400 */
14401 #if defined(__FreeBSD__) && !defined(__Userspace__cxx . . $ `<built-in>:442:9`!)
14402 NET_EPOCH_ENTER(et);
14403 #endif
14404 if (hold_tcblock == 0) {
14405 if (SCTP_TCB_TRYLOCKcxx . . $ `usrsctplib/netinet/sctp_process_lock.h:480:9`!(stcb)) {
14406 hold_tcblock = 1;
14407 sctp_chunk_outputcxx . . $ sctp_chunk_output(777f7332f4f2f1ed).(inp,
14408 stcb,
14409 SCTP_OUTPUT_FROM_USR_SENDcxx . . $ `usrsctplib/netinet/sctp_constants.h:366:9`!, SCTP_SO_LOCKEDcxx . . $ `usrsctplib/netinet/sctp_constants.h:963:9`!);
14410 }
14411 } else {
14412 sctp_chunk_outputcxx . . $ sctp_chunk_output(777f7332f4f2f1ed).(inp,
14413 stcb,
14414 SCTP_OUTPUT_FROM_USR_SENDcxx . . $ `usrsctplib/netinet/sctp_constants.h:366:9`!, SCTP_SO_LOCKEDcxx . . $ `usrsctplib/netinet/sctp_constants.h:963:9`!);
14415 }
14416 #if defined(__FreeBSD__) && !defined(__Userspace__cxx . . $ `<built-in>:442:9`!)
14417 NET_EPOCH_EXIT(et);
14418 #endif
14419 }
14420 if (hold_tcblock == 1) {
14421 SCTP_TCB_UNLOCKcxx . . $ `usrsctplib/netinet/sctp_process_lock.h:476:9`!(stcb);
14422 hold_tcblock = 0;
14423 }
14424 SOCKBUF_LOCKcxx . . $ `usrsctplib/netinet/sctp_process_lock.h:516:9`!(&so->so_snd);
14425 /*-
14426 * This is a bit strange, but I think it will
14427 * work. The total_output_queue_size is locked and
14428 * protected by the TCB_LOCK, which we just released.
14429 * There is a race that can occur between releasing it
14430 * above, and me getting the socket lock, where sacks
14431 * come in but we have not put the SB_WAIT on the
14432 * so_snd buffer to get the wakeup. After the LOCK
14433 * is applied the sack_processing will also need to
14434 * LOCK the so->so_snd to do the actual sowwakeup(). So
14435 * once we have the socket buffer lock if we recheck the
14436 * size we KNOW we will get to sleep safely with the
14437 * wakeup flag in place.
14438 */
14439 inqueue_bytes = stcb->asoccxx . . $ sctp_tcb#asoc..total_output_queue_sizecxx . . $ sctp_association#total_output_queue_size. - (stcb->asoccxx . . $ sctp_tcb#asoc..chunks_on_out_queuecxx . . $ sctp_association#chunks_on_out_queue. * SCTP_DATA_CHUNK_OVERHEADcxx . . $ `usrsctplib/netinet/sctp_output.h:137:9`!(stcb));
14440 if (SCTP_SB_LIMIT_SNDcxx . . $ `usrsctplib/netinet/sctp_os_userspace.h:965:9`!(so) <= (inqueue_bytes +
14441 mincxx . . $ `usrsctplib/user_environment.h:66:9`!(SCTP_BASE_SYSCTLcxx . . $ `usrsctplib/netinet/sctp_os_userspace.h:579:9`!(sctp_add_more_threshold), SCTP_SB_LIMIT_SNDcxx . . $ `usrsctplib/netinet/sctp_os_userspace.h:965:9`!(so)))) {
14442 if (SCTP_BASE_SYSCTLcxx . . $ `usrsctplib/netinet/sctp_os_userspace.h:579:9`!(sctp_logging_level) & SCTP_BLK_LOGGING_ENABLEcxx . . $ `usrsctplib/netinet/sctp.h:638:9`!) {
14443 #if defined(__APPLE__) && !defined(__Userspace__cxx . . $ `<built-in>:442:9`!)
14444 #if defined(APPLE_LEOPARD)
14445 sctp_log_block(SCTP_BLOCK_LOG_INTO_BLK,
14446 asoc, uio->uio_resid);
14447 #else
14448 sctp_log_block(SCTP_BLOCK_LOG_INTO_BLK,
14449 asoc, uio_resid(uio));
14450 #endif
14451 #else
14452 sctp_log_blockcxx . . $ sctp_log_block(ca2f4465ee2724ed).(SCTP_BLOCK_LOG_INTO_BLKcxx . . $ `usrsctplib/netinet/sctp_constants.h:117:9`!,
14453 asoc, uio->uio_residcxx . . $ uio#uio_resid.);
14454 #endif
14455 }
14456 be.errorcxx . . $ sctp_block_entry#error. = 0;
14457 #if !(defined(_WIN32) && !defined(__Userspace__cxx . . $ `<built-in>:442:9`!))
14458 stcb->block_entrycxx . . $ sctp_tcb#block_entry. = &be;
14459 #endif
14460 #if defined(__APPLE__) && !defined(__Userspace__cxx . . $ `<built-in>:442:9`!)
14461 sbunlock(&so->so_snd, 1);
14462 #endif
14463 error = sbwaitcxx . . $ sbwait(ada175fcc3abaf35).(&so->so_sndcxx . . $ socket#so_snd.);
14464 stcb->block_entrycxx . . $ sctp_tcb#block_entry. = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!;
14465
14466 if (error || so->so_errorcxx . . $ socket#so_error. || be.errorcxx . . $ sctp_block_entry#error.) {
14467 if (error == 0) {
14468 if (so->so_errorcxx . . $ socket#so_error.)
14469 error = so->so_errorcxx . . $ socket#so_error.;
14470 if (be.errorcxx . . $ sctp_block_entry#error.) {
14471 error = be.errorcxx . . $ sctp_block_entry#error.;
14472 }
14473 }
14474 SOCKBUF_UNLOCKcxx . . $ `usrsctplib/netinet/sctp_process_lock.h:518:9`!(&so->so_snd);
14475 SCTP_TCB_SEND_LOCKcxx . . $ `usrsctplib/netinet/sctp_process_lock.h:403:9`!(stcb);
14476 if (((stcb->asoccxx . . $ sctp_tcb#asoc..statecxx . . $ sctp_association#state. & SCTP_STATE_ABOUT_TO_BE_FREEDcxx . . $ `usrsctplib/netinet/sctp_constants.h:470:9`!) == 0) &&
14477 ((stcb->asoccxx . . $ sctp_tcb#asoc..statecxx . . $ sctp_association#state. & SCTP_STATE_WAS_ABORTEDcxx . . $ `usrsctplib/netinet/sctp_constants.h:472:9`!) == 0) &&
14478 (sp != NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!)) {
14479 sp->processingcxx . . $ sctp_stream_queue_pending#processing. = 0;
14480 }
14481 SCTP_TCB_SEND_UNLOCKcxx . . $ `usrsctplib/netinet/sctp_process_lock.h:405:9`!(stcb);
14482 goto out_unlocked;
14483 }
14484
14485 #if defined(__APPLE__) && !defined(__Userspace__cxx . . $ `<built-in>:442:9`!)
14486 error = sblock(&so->so_snd, SBLOCKWAIT(flags));
14487 #endif
14488 if (SCTP_BASE_SYSCTLcxx . . $ `usrsctplib/netinet/sctp_os_userspace.h:579:9`!(sctp_logging_level) & SCTP_BLK_LOGGING_ENABLEcxx . . $ `usrsctplib/netinet/sctp.h:638:9`!) {
14489 sctp_log_blockcxx . . $ sctp_log_block(ca2f4465ee2724ed).(SCTP_BLOCK_LOG_OUTOF_BLKcxx . . $ `usrsctplib/netinet/sctp_constants.h:118:9`!,
14490 asoc, stcb->asoccxx . . $ sctp_tcb#asoc..total_output_queue_sizecxx . . $ sctp_association#total_output_queue_size.);
14491 }
14492 }
14493 SOCKBUF_UNLOCKcxx . . $ `usrsctplib/netinet/sctp_process_lock.h:518:9`!(&so->so_snd);
14494 SCTP_TCB_SEND_LOCKcxx . . $ `usrsctplib/netinet/sctp_process_lock.h:403:9`!(stcb);
14495 if ((stcb->asoccxx . . $ sctp_tcb#asoc..statecxx . . $ sctp_association#state. & SCTP_STATE_ABOUT_TO_BE_FREEDcxx . . $ `usrsctplib/netinet/sctp_constants.h:470:9`!) ||
14496 (stcb->asoccxx . . $ sctp_tcb#asoc..statecxx . . $ sctp_association#state. & SCTP_STATE_WAS_ABORTEDcxx . . $ `usrsctplib/netinet/sctp_constants.h:472:9`!)) {
14497 SCTP_TCB_SEND_UNLOCKcxx . . $ `usrsctplib/netinet/sctp_process_lock.h:405:9`!(stcb);
14498 goto out_unlocked;
14499 }
14500 SCTP_TCB_SEND_UNLOCKcxx . . $ `usrsctplib/netinet/sctp_process_lock.h:405:9`!(stcb);
14501 }
14502 SCTP_TCB_SEND_LOCKcxx . . $ `usrsctplib/netinet/sctp_process_lock.h:403:9`!(stcb);
14503 if ((stcb->asoccxx . . $ sctp_tcb#asoc..statecxx . . $ sctp_association#state. & SCTP_STATE_ABOUT_TO_BE_FREEDcxx . . $ `usrsctplib/netinet/sctp_constants.h:470:9`!) ||
14504 (stcb->asoccxx . . $ sctp_tcb#asoc..statecxx . . $ sctp_association#state. & SCTP_STATE_WAS_ABORTEDcxx . . $ `usrsctplib/netinet/sctp_constants.h:472:9`!)) {
14505 SCTP_TCB_SEND_UNLOCKcxx . . $ `usrsctplib/netinet/sctp_process_lock.h:405:9`!(stcb);
14506 goto out_unlocked;
14507 }
14508 if (sp) {
14509 if (sp->msg_is_completecxx . . $ sctp_stream_queue_pending#msg_is_complete. == 0) {
14510 strm->last_msg_incompletecxx . . $ sctp_stream_out#last_msg_incomplete. = 1;
14511 if (stcb->asoccxx . . $ sctp_tcb#asoc..idata_supportedcxx . . $ sctp_association#idata_supported. == 0) {
14512 asoc->stream_lockedcxx . . $ sctp_association#stream_locked. = 1;
14513 asoc->stream_locked_oncxx . . $ sctp_association#stream_locked_on. = srcv->sinfo_stream;
14514 }
14515 } else {
14516 sp->sender_all_donecxx . . $ sctp_stream_queue_pending#sender_all_done. = 1;
14517 strm->last_msg_incompletecxx . . $ sctp_stream_out#last_msg_incomplete. = 0;
14518 asoc->stream_lockedcxx . . $ sctp_association#stream_locked. = 0;
14519 }
14520 sp->processingcxx . . $ sctp_stream_queue_pending#processing. = 0;
14521 } else {
14522 SCTP_PRINTFcxx . . $ `usrsctplib/netinet/sctp_os_userspace.h:536:9`!("Huh no sp TSNH?\n");
14523 strm->last_msg_incompletecxx . . $ sctp_stream_out#last_msg_incomplete. = 0;
14524 asoc->stream_lockedcxx . . $ sctp_association#stream_locked. = 0;
14525 }
14526 SCTP_TCB_SEND_UNLOCKcxx . . $ `usrsctplib/netinet/sctp_process_lock.h:405:9`!(stcb);
14527 #if defined(__APPLE__) && !defined(__Userspace__cxx . . $ `<built-in>:442:9`!)
14528 #if defined(APPLE_LEOPARD)
14529 if (uio->uio_resid == 0) {
14530 #else
14531 if (uio_resid(uio) == 0) {
14532 #endif
14533 #else
14534 if (uio->uio_residcxx . . $ uio#uio_resid. == 0) {
14535 #endif
14536 got_all_of_the_send = 1;
14537 }
14538 } else {
14539 /* We send in a 0, since we do NOT have any locks */
14540 error = sctp_msg_appendcxx . . $ sctp_msg_append(fe525a3a5cc14699).(stcb, net, top, srcv, 0);
14541 top = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!;
14542 if (sinfo_flags & SCTP_EOFcxx . . $ `./netinet/sctp_uio.h:262:9`!) {
14543 got_all_of_the_send = 1;
14544 }
14545 }
14546 if (error) {
14547 goto out;
14548 }
14549 dataless_eof:
14550 /* EOF thing ? */
14551 if ((sinfo_flags & SCTP_EOFcxx . . $ `./netinet/sctp_uio.h:262:9`!) &&
14552 (got_all_of_the_send == 1)) {
14553 SCTP_STAT_INCRcxx . . $ `./netinet/sctp_uio.h:1111:9`!(sctps_sends_with_eof);
14554 error = 0;
14555 if (hold_tcblock == 0) {
14556 SCTP_TCB_LOCKcxx . . $ `usrsctplib/netinet/sctp_process_lock.h:473:9`!(stcb);
14557 hold_tcblock = 1;
14558 }
14559 if (TAILQ_EMPTYcxx . . $ `<external>/2546723208511035544/queue.h:457:9`!(&asoc->send_queue) &&
14560 TAILQ_EMPTYcxx . . $ `<external>/2546723208511035544/queue.h:457:9`!(&asoc->sent_queue) &&
14561 sctp_is_there_unsent_datacxx . . $ sctp_is_there_unsent_data(ac3aa47b47eaac09).(stcb, SCTP_SO_LOCKEDcxx . . $ `usrsctplib/netinet/sctp_constants.h:963:9`!) == 0) {
14562 if ((*asoc->ss_functionscxx . . $ sctp_association#ss_functions..sctp_ss_is_user_msgs_incompletecxx . . $ sctp_ss_functions#sctp_ss_is_user_msgs_incomplete.)(stcb, asoc)) {
14563 goto abort_anyway;
14564 }
14565 /* there is nothing queued to send, so I'm done... */
14566 if ((SCTP_GET_STATEcxx . . $ `usrsctplib/netinet/sctp_constants.h:476:9`!(stcb) != SCTP_STATE_SHUTDOWN_SENTcxx . . $ `usrsctplib/netinet/sctp_constants.h:465:9`!) &&
14567 (SCTP_GET_STATEcxx . . $ `usrsctplib/netinet/sctp_constants.h:476:9`!(stcb) != SCTP_STATE_SHUTDOWN_RECEIVEDcxx . . $ `usrsctplib/netinet/sctp_constants.h:466:9`!) &&
14568 (SCTP_GET_STATEcxx . . $ `usrsctplib/netinet/sctp_constants.h:476:9`!(stcb) != SCTP_STATE_SHUTDOWN_ACK_SENTcxx . . $ `usrsctplib/netinet/sctp_constants.h:467:9`!)) {
14569 struct sctp_netscxx . . $ sctp_nets# *netp;
14570
14571 /* only send SHUTDOWN the first time through */
14572 if (SCTP_GET_STATEcxx . . $ `usrsctplib/netinet/sctp_constants.h:476:9`!(stcb) == SCTP_STATE_OPENcxx . . $ `usrsctplib/netinet/sctp_constants.h:464:9`!) {
14573 SCTP_STAT_DECR_GAUGE32cxx . . $ `./netinet/sctp_uio.h:1131:9`!(sctps_currestab);
14574 }
14575 SCTP_SET_STATEcxx . . $ `usrsctplib/netinet/sctp_constants.h:478:9`!(stcb, SCTP_STATE_SHUTDOWN_SENTcxx . . $ `usrsctplib/netinet/sctp_constants.h:465:9`!);
14576 sctp_stop_timers_for_shutdowncxx . . $ sctp_stop_timers_for_shutdown(5e56bbb8005ef9b0).(stcb);
14577 if (stcb->asoccxx . . $ sctp_tcb#asoc..alternatecxx . . $ sctp_association#alternate.) {
14578 netp = stcb->asoccxx . . $ sctp_tcb#asoc..alternatecxx . . $ sctp_association#alternate.;
14579 } else {
14580 netp = stcb->asoccxx . . $ sctp_tcb#asoc..primary_destinationcxx . . $ sctp_association#primary_destination.;
14581 }
14582 sctp_send_shutdowncxx . . $ sctp_send_shutdown(2ed2c3ddd2bbab6a).(stcb, netp);
14583 sctp_timer_startcxx . . $ sctp_timer_start(73c9263bfa4b937d).(SCTP_TIMER_TYPE_SHUTDOWNcxx . . $ `usrsctplib/netinet/sctp_constants.h:540:9`!, stcb->sctp_epcxx . . $ sctp_tcb#sctp_ep., stcb,
14584 netp);
14585 sctp_timer_startcxx . . $ sctp_timer_start(73c9263bfa4b937d).(SCTP_TIMER_TYPE_SHUTDOWNGUARDcxx . . $ `usrsctplib/netinet/sctp_constants.h:547:9`!, stcb->sctp_epcxx . . $ sctp_tcb#sctp_ep., stcb,
14586 NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!);
14587 }
14588 } else {
14589 /*-
14590 * we still got (or just got) data to send, so set
14591 * SHUTDOWN_PENDING
14592 */
14593 /*-
14594 * XXX sockets draft says that SCTP_EOF should be
14595 * sent with no data. currently, we will allow user
14596 * data to be sent first and move to
14597 * SHUTDOWN-PENDING
14598 */
14599 if ((SCTP_GET_STATEcxx . . $ `usrsctplib/netinet/sctp_constants.h:476:9`!(stcb) != SCTP_STATE_SHUTDOWN_SENTcxx . . $ `usrsctplib/netinet/sctp_constants.h:465:9`!) &&
14600 (SCTP_GET_STATEcxx . . $ `usrsctplib/netinet/sctp_constants.h:476:9`!(stcb) != SCTP_STATE_SHUTDOWN_RECEIVEDcxx . . $ `usrsctplib/netinet/sctp_constants.h:466:9`!) &&
14601 (SCTP_GET_STATEcxx . . $ `usrsctplib/netinet/sctp_constants.h:476:9`!(stcb) != SCTP_STATE_SHUTDOWN_ACK_SENTcxx . . $ `usrsctplib/netinet/sctp_constants.h:467:9`!)) {
14602 if (hold_tcblock == 0) {
14603 SCTP_TCB_LOCKcxx . . $ `usrsctplib/netinet/sctp_process_lock.h:473:9`!(stcb);
14604 hold_tcblock = 1;
14605 }
14606 if ((*asoc->ss_functionscxx . . $ sctp_association#ss_functions..sctp_ss_is_user_msgs_incompletecxx . . $ sctp_ss_functions#sctp_ss_is_user_msgs_incomplete.)(stcb, asoc)) {
14607 SCTP_ADD_SUBSTATEcxx . . $ `usrsctplib/netinet/sctp_constants.h:482:9`!(stcb, SCTP_STATE_PARTIAL_MSG_LEFTcxx . . $ `usrsctplib/netinet/sctp_constants.h:471:9`!);
14608 }
14609 SCTP_ADD_SUBSTATEcxx . . $ `usrsctplib/netinet/sctp_constants.h:482:9`!(stcb, SCTP_STATE_SHUTDOWN_PENDINGcxx . . $ `usrsctplib/netinet/sctp_constants.h:468:9`!);
14610 if (TAILQ_EMPTYcxx . . $ `<external>/2546723208511035544/queue.h:457:9`!(&asoc->send_queue) &&
14611 TAILQ_EMPTYcxx . . $ `<external>/2546723208511035544/queue.h:457:9`!(&asoc->sent_queue) &&
14612 (asoc->statecxx . . $ sctp_association#state. & SCTP_STATE_PARTIAL_MSG_LEFTcxx . . $ `usrsctplib/netinet/sctp_constants.h:471:9`!)) {
14613 struct mbufcxx . . $ mbuf# *op_err;
14614 char msg[SCTP_DIAG_INFO_LENcxx . . $ `usrsctplib/netinet/sctp_constants.h:748:9`!];
14615
14616 abort_anyway:
14617 if (free_cnt_applied) {
14618 atomic_add_intcxx . . $ `usrsctplib/user_atomic.h:94:9`!(&stcb->asoc.refcnt, -1);
14619 free_cnt_applied = 0;
14620 }
14621 SCTP_SNPRINTFcxx . . $ `usrsctplib/netinet/sctp_os_userspace.h:808:9`!(msg, sizeof(msg),
14622 "%s:%d at %s", __FILE__, __LINE__, __func__);
14623 op_err = sctp_generate_causecxx . . $ sctp_generate_cause(b66a0ee9768f26bd).(SCTP_BASE_SYSCTLcxx . . $ `usrsctplib/netinet/sctp_os_userspace.h:579:9`!(sctp_diag_info_code),
14624 msg);
14625 #if defined(__FreeBSD__) && !defined(__Userspace__cxx . . $ `<built-in>:442:9`!)
14626 NET_EPOCH_ENTER(et);
14627 #endif
14628 sctp_abort_an_associationcxx . . $ sctp_abort_an_association(2bef2660eefb26cd).(stcb->sctp_epcxx . . $ sctp_tcb#sctp_ep., stcb,
14629 op_err, SCTP_SO_LOCKEDcxx . . $ `usrsctplib/netinet/sctp_constants.h:963:9`!);
14630 #if defined(__FreeBSD__) && !defined(__Userspace__cxx . . $ `<built-in>:442:9`!)
14631 NET_EPOCH_EXIT(et);
14632 #endif
14633 /* now relock the stcb so everything is sane */
14634 hold_tcblock = 0;
14635 stcb = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!;
14636 goto out;
14637 }
14638 sctp_timer_startcxx . . $ sctp_timer_start(73c9263bfa4b937d).(SCTP_TIMER_TYPE_SHUTDOWNGUARDcxx . . $ `usrsctplib/netinet/sctp_constants.h:547:9`!, stcb->sctp_epcxx . . $ sctp_tcb#sctp_ep., stcb,
14639 NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!);
14640 sctp_feature_offcxx . . $ `usrsctplib/netinet/sctp_var.h:52:9`!(inp, SCTP_PCB_FLAGS_NODELAYcxx . . $ `usrsctplib/netinet/sctp.h:571:9`!);
14641 }
14642 }
14643 }
14644 skip_out_eof:
14645 if (!TAILQ_EMPTYcxx . . $ `<external>/2546723208511035544/queue.h:457:9`!(&stcb->asoc.control_send_queue)) {
14646 some_on_control = 1;
14647 }
14648 if (queue_only_for_init) {
14649 if (hold_tcblock == 0) {
14650 SCTP_TCB_LOCKcxx . . $ `usrsctplib/netinet/sctp_process_lock.h:473:9`!(stcb);
14651 hold_tcblock = 1;
14652 }
14653 if (SCTP_GET_STATEcxx . . $ `usrsctplib/netinet/sctp_constants.h:476:9`!(stcb) == SCTP_STATE_OPENcxx . . $ `usrsctplib/netinet/sctp_constants.h:464:9`!) {
14654 /* a collision took us forward? */
14655 queue_only = 0;
14656 } else {
14657 #if defined(__FreeBSD__) && !defined(__Userspace__cxx . . $ `<built-in>:442:9`!)
14658 NET_EPOCH_ENTER(et);
14659 #endif
14660 sctp_send_initiatecxx . . $ sctp_send_initiate(a11f8a89c1538453).(inp, stcb, SCTP_SO_LOCKEDcxx . . $ `usrsctplib/netinet/sctp_constants.h:963:9`!);
14661 #if defined(__FreeBSD__) && !defined(__Userspace__cxx . . $ `<built-in>:442:9`!)
14662 NET_EPOCH_EXIT(et);
14663 #endif
14664 SCTP_SET_STATEcxx . . $ `usrsctplib/netinet/sctp_constants.h:478:9`!(stcb, SCTP_STATE_COOKIE_WAITcxx . . $ `usrsctplib/netinet/sctp_constants.h:462:9`!);
14665 queue_only = 1;
14666 }
14667 }
14668 if ((net->flight_sizecxx . . $ sctp_nets#flight_size. > net->cwndcxx . . $ sctp_nets#cwnd.) &&
14669 (stcb->asoccxx . . $ sctp_tcb#asoc..sctp_cmt_on_offcxx . . $ sctp_association#sctp_cmt_on_off. == 0)) {
14670 SCTP_STAT_INCRcxx . . $ `./netinet/sctp_uio.h:1111:9`!(sctps_send_cwnd_avoid);
14671 queue_only = 1;
14672 } else if (asoc->ifp_had_enobufcxx . . $ sctp_association#ifp_had_enobuf.) {
14673 SCTP_STAT_INCRcxx . . $ `./netinet/sctp_uio.h:1111:9`!(sctps_ifnomemqueued);
14674 if (net->flight_sizecxx . . $ sctp_nets#flight_size. > (2 * net->mtucxx . . $ sctp_nets#mtu.)) {
14675 queue_only = 1;
14676 }
14677 asoc->ifp_had_enobufcxx . . $ sctp_association#ifp_had_enobuf. = 0;
14678 }
14679 un_sent = stcb->asoccxx . . $ sctp_tcb#asoc..total_output_queue_sizecxx . . $ sctp_association#total_output_queue_size. - stcb->asoccxx . . $ sctp_tcb#asoc..total_flightcxx . . $ sctp_association#total_flight.;
14680 if ((sctp_is_feature_offcxx . . $ `usrsctplib/netinet/sctp_var.h:54:9`!(inp, SCTP_PCB_FLAGS_NODELAYcxx . . $ `usrsctplib/netinet/sctp.h:571:9`!)) &&
14681 (stcb->asoccxx . . $ sctp_tcb#asoc..total_flightcxx . . $ sctp_association#total_flight. > 0) &&
14682 (stcb->asoccxx . . $ sctp_tcb#asoc..stream_queue_cntcxx . . $ sctp_association#stream_queue_cnt. < SCTP_MAX_DATA_BUNDLINGcxx . . $ `usrsctplib/netinet/sctp_constants.h:880:9`!) &&
14683 (un_sent < (int)(stcb->asoccxx . . $ sctp_tcb#asoc..smallest_mtucxx . . $ sctp_association#smallest_mtu. - SCTP_MIN_OVERHEADcxx . . $ `usrsctplib/netinet/sctp_header.h:561:9`!))) {
14684 /*-
14685 * Ok, Nagle is set on and we have data outstanding.
14686 * Don't send anything and let SACKs drive out the
14687 * data unless wen have a "full" segment to send.
14688 */
14689 if (SCTP_BASE_SYSCTLcxx . . $ `usrsctplib/netinet/sctp_os_userspace.h:579:9`!(sctp_logging_level) & SCTP_NAGLE_LOGGING_ENABLEcxx . . $ `usrsctplib/netinet/sctp.h:647:9`!) {
14690 sctp_log_nagle_eventcxx . . $ sctp_log_nagle_event(309e9a20a883d7fc).(stcb, SCTP_NAGLE_APPLIEDcxx . . $ `usrsctplib/netinet/sctp_constants.h:181:9`!);
14691 }
14692 SCTP_STAT_INCRcxx . . $ `./netinet/sctp_uio.h:1111:9`!(sctps_naglequeued);
14693 nagle_applies = 1;
14694 } else {
14695 if (SCTP_BASE_SYSCTLcxx . . $ `usrsctplib/netinet/sctp_os_userspace.h:579:9`!(sctp_logging_level) & SCTP_NAGLE_LOGGING_ENABLEcxx . . $ `usrsctplib/netinet/sctp.h:647:9`!) {
14696 if (sctp_is_feature_offcxx . . $ `usrsctplib/netinet/sctp_var.h:54:9`!(inp, SCTP_PCB_FLAGS_NODELAYcxx . . $ `usrsctplib/netinet/sctp.h:571:9`!))
14697 sctp_log_nagle_eventcxx . . $ sctp_log_nagle_event(309e9a20a883d7fc).(stcb, SCTP_NAGLE_SKIPPEDcxx . . $ `usrsctplib/netinet/sctp_constants.h:182:9`!);
14698 }
14699 SCTP_STAT_INCRcxx . . $ `./netinet/sctp_uio.h:1111:9`!(sctps_naglesent);
14700 nagle_applies = 0;
14701 }
14702 if (SCTP_BASE_SYSCTLcxx . . $ `usrsctplib/netinet/sctp_os_userspace.h:579:9`!(sctp_logging_level) & SCTP_BLK_LOGGING_ENABLEcxx . . $ `usrsctplib/netinet/sctp.h:638:9`!) {
14703 sctp_misc_intscxx . . $ sctp_misc_ints(da1ccf5149f5690e).(SCTP_CWNDLOG_PRESENDcxx . . $ `usrsctplib/netinet/sctp_constants.h:186:9`!, queue_only_for_init, queue_only,
14704 nagle_applies, un_sent);
14705 sctp_misc_intscxx . . $ sctp_misc_ints(da1ccf5149f5690e).(SCTP_CWNDLOG_PRESENDcxx . . $ `usrsctplib/netinet/sctp_constants.h:186:9`!, stcb->asoccxx . . $ sctp_tcb#asoc..total_output_queue_sizecxx . . $ sctp_association#total_output_queue_size.,
14706 stcb->asoccxx . . $ sctp_tcb#asoc..total_flightcxx . . $ sctp_association#total_flight.,
14707 stcb->asoccxx . . $ sctp_tcb#asoc..chunks_on_out_queuecxx . . $ sctp_association#chunks_on_out_queue., stcb->asoccxx . . $ sctp_tcb#asoc..total_flight_countcxx . . $ sctp_association#total_flight_count.);
14708 }
14709 #if defined(__FreeBSD__) && !defined(__Userspace__cxx . . $ `<built-in>:442:9`!)
14710 NET_EPOCH_ENTER(et);
14711 #endif
14712 if ((queue_only == 0) && (nagle_applies == 0) && (stcb->asoccxx . . $ sctp_tcb#asoc..peers_rwndcxx . . $ sctp_association#peers_rwnd. && un_sent)) {
14713 /* we can attempt to send too. */
14714 if (hold_tcblock == 0) {
14715 /* If there is activity recv'ing sacks no need to send */
14716 if (SCTP_TCB_TRYLOCKcxx . . $ `usrsctplib/netinet/sctp_process_lock.h:480:9`!(stcb)) {
14717 sctp_chunk_outputcxx . . $ sctp_chunk_output(777f7332f4f2f1ed).(inp, stcb, SCTP_OUTPUT_FROM_USR_SENDcxx . . $ `usrsctplib/netinet/sctp_constants.h:366:9`!, SCTP_SO_LOCKEDcxx . . $ `usrsctplib/netinet/sctp_constants.h:963:9`!);
14718 hold_tcblock = 1;
14719 }
14720 } else {
14721 sctp_chunk_outputcxx . . $ sctp_chunk_output(777f7332f4f2f1ed).(inp, stcb, SCTP_OUTPUT_FROM_USR_SENDcxx . . $ `usrsctplib/netinet/sctp_constants.h:366:9`!, SCTP_SO_LOCKEDcxx . . $ `usrsctplib/netinet/sctp_constants.h:963:9`!);
14722 }
14723 } else if ((queue_only == 0) &&
14724 (stcb->asoccxx . . $ sctp_tcb#asoc..peers_rwndcxx . . $ sctp_association#peers_rwnd. == 0) &&
14725 (stcb->asoccxx . . $ sctp_tcb#asoc..total_flightcxx . . $ sctp_association#total_flight. == 0)) {
14726 /* We get to have a probe outstanding */
14727 if (hold_tcblock == 0) {
14728 hold_tcblock = 1;
14729 SCTP_TCB_LOCKcxx . . $ `usrsctplib/netinet/sctp_process_lock.h:473:9`!(stcb);
14730 }
14731 sctp_chunk_outputcxx . . $ sctp_chunk_output(777f7332f4f2f1ed).(inp, stcb, SCTP_OUTPUT_FROM_USR_SENDcxx . . $ `usrsctplib/netinet/sctp_constants.h:366:9`!, SCTP_SO_LOCKEDcxx . . $ `usrsctplib/netinet/sctp_constants.h:963:9`!);
14732 } else if (some_on_control) {
14733 int num_out, reason, frag_point;
14734
14735 /* Here we do control only */
14736 if (hold_tcblock == 0) {
14737 hold_tcblock = 1;
14738 SCTP_TCB_LOCKcxx . . $ `usrsctplib/netinet/sctp_process_lock.h:473:9`!(stcb);
14739 }
14740 frag_point = sctp_get_frag_pointcxx . . $ sctp_get_frag_point(527fbf6e26d2907d).(stcb, &stcb->asoccxx . . $ sctp_tcb#asoc.);
14741 (void)sctp_med_chunk_outputcxx . . $ sctp_med_chunk_output(ae2c5cc94a0e278d).(inp, stcb, &stcb->asoccxx . . $ sctp_tcb#asoc., &num_out,
14742 &reason, 1, 1, &now, &now_filled, frag_point, SCTP_SO_LOCKEDcxx . . $ `usrsctplib/netinet/sctp_constants.h:963:9`!);
14743 }
14744 #if defined(__FreeBSD__) && !defined(__Userspace__cxx . . $ `<built-in>:442:9`!)
14745 NET_EPOCH_EXIT(et);
14746 #endif
14747 SCTPDBGcxx . . $ `usrsctplib/netinet/sctp_os_userspace.h:591:9`!(SCTP_DEBUG_OUTPUT1cxx . . $ `usrsctplib/netinet/sctp_constants.h:643:9`!, "USR Send complete qo:%d prw:%d unsent:%d tf:%d cooq:%d toqs:%d err:%d\n",
14748 queue_only, stcb->asoc.peers_rwnd, un_sent,
14749 stcb->asoc.total_flight, stcb->asoc.chunks_on_out_queue,
14750 stcb->asoc.total_output_queue_size, error);
14751
14752 out:
14753 #if defined(__APPLE__) && !defined(__Userspace__cxx . . $ `<built-in>:442:9`!)
14754 sbunlock(&so->so_snd, 1);
14755 #endif
14756 out_unlocked:
14757
14758 if (local_soresv && stcb) {
14759 atomic_subtract_intcxx . . $ `usrsctplib/user_atomic.h:97:9`!(&stcb->asoc.sb_send_resv, sndlen);
14760 }
14761 if (create_lock_applied) {
14762 SCTP_ASOC_CREATE_UNLOCKcxx . . $ `usrsctplib/netinet/sctp_process_lock.h:437:9`!(inp);
14763 }
14764 if ((stcb) && hold_tcblock) {
14765 SCTP_TCB_UNLOCKcxx . . $ `usrsctplib/netinet/sctp_process_lock.h:476:9`!(stcb);
14766 }
14767 if (stcb && free_cnt_applied) {
14768 atomic_add_intcxx . . $ `usrsctplib/user_atomic.h:94:9`!(&stcb->asoc.refcnt, -1);
14769 }
14770 #ifdef INVARIANTS
14771 #if defined(__FreeBSD__) && !defined(__Userspace__)
14772 if (stcb) {
14773 if (mtx_owned(&stcb->tcb_mtx)) {
14774 panic("Leaving with tcb mtx owned?");
14775 }
14776 if (mtx_owned(&stcb->tcb_send_mtx)) {
14777 panic("Leaving with tcb send mtx owned?");
14778 }
14779 }
14780 #endif
14781 #endif
14782 if (top) {
14783 sctp_m_freemcxx . . $ `usrsctplib/netinet/sctputil.h:57:9`!(top);
14784 }
14785 if (control) {
14786 sctp_m_freemcxx . . $ `usrsctplib/netinet/sctputil.h:57:9`!(control);
14787 }
14788 return (error);
14789 }
14790
14791 /*
14792 * generate an AUTHentication chunk, if required
14793 */
14794 struct mbufcxx . . $ mbuf# *
14795 sctp_add_auth_chunkcxx . . $ sctp_add_auth_chunk(c0b2bf5d35b7e5c6).(struct mbufcxx . . $ mbuf# *m, struct mbufcxx . . $ mbuf# **m_end,
14796 struct sctp_auth_chunkcxx . . $ sctp_auth_chunk# **auth_ret, uint32_tcxx . . $ uint32_t# * offset,
14797 struct sctp_tcbcxx . . $ sctp_tcb# *stcb, uint8_tcxx . . $ uint8_t# chunk)
14798 {
14799 struct mbufcxx . . $ mbuf# *m_auth;
14800 struct sctp_auth_chunkcxx . . $ sctp_auth_chunk# *auth;
14801 int chunk_len;
14802 struct mbufcxx . . $ mbuf# *cn;
14803
14804 if ((m_end == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!) || (auth_ret == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!) || (offset == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!) ||
14805 (stcb == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!))
14806 return (m);
14807
14808 if (stcb->asoccxx . . $ sctp_tcb#asoc..auth_supportedcxx . . $ sctp_association#auth_supported. == 0) {
14809 return (m);
14810 }
14811 /* does the requested chunk require auth? */
14812 if (!sctp_auth_is_required_chunkcxx . . $ `usrsctplib/netinet/sctp_auth.h:105:9`!(chunk, stcb->asoc.peer_auth_chunks)) {
14813 return (m);
14814 }
14815 m_auth = sctp_get_mbuf_for_msgcxx . . $ sctp_get_mbuf_for_msg(c7c30fc329598377).(sizeof(*auth), 0, M_NOWAITcxx . . $ `usrsctplib/user_malloc.h:60:9`!, 1, MT_HEADERcxx . . $ `usrsctplib/user_mbuf.h:290:9`!);
14816 if (m_auth == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!) {
14817 /* no mbuf's */
14818 return (m);
14819 }
14820 /* reserve some space if this will be the first mbuf */
14821 if (m == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!)
14822 SCTP_BUF_RESV_UFcxx . . $ `usrsctplib/netinet/sctp_os_userspace.h:793:9`!(m_auth, SCTP_MIN_OVERHEADcxx . . $ `usrsctplib/netinet/sctp_header.h:561:9`!);
14823 /* fill in the AUTH chunk details */
14824 auth = mtodcxx . . $ `usrsctplib/user_mbuf.h:96:9`!(m_auth, struct sctp_auth_chunk *);
14825 memsetcxx . . $ memset(d1de1e4fb215f1c6).(auth, 0, sizeof(*auth));
14826 auth->chcxx . . $ sctp_auth_chunk#ch..chunk_typecxx . . $ sctp_chunkhdr#chunk_type. = SCTP_AUTHENTICATIONcxx . . $ `usrsctplib/netinet/sctp.h:465:9`!;
14827 auth->chcxx . . $ sctp_auth_chunk#ch..chunk_flagscxx . . $ sctp_chunkhdr#chunk_flags. = 0;
14828 chunk_len = sizeof(*auth) +
14829 sctp_get_hmac_digest_lencxx . . $ sctp_get_hmac_digest_len(909d59720f161188).(stcb->asoccxx . . $ sctp_tcb#asoc..peer_hmac_idcxx . . $ sctp_association#peer_hmac_id.);
14830 auth->chcxx . . $ sctp_auth_chunk#ch..chunk_lengthcxx . . $ sctp_chunkhdr#chunk_length. = htonscxx . . $ htons(a18c05e4017afb3d).(chunk_len);
14831 auth->hmac_idcxx . . $ sctp_auth_chunk#hmac_id. = htonscxx . . $ htons(a18c05e4017afb3d).(stcb->asoccxx . . $ sctp_tcb#asoc..peer_hmac_idcxx . . $ sctp_association#peer_hmac_id.);
14832 /* key id and hmac digest will be computed and filled in upon send */
14833
14834 /* save the offset where the auth was inserted into the chain */
14835 *offset = 0;
14836 for (cn = m; cn; cn = SCTP_BUF_NEXTcxx . . $ `usrsctplib/netinet/sctp_os_userspace.h:791:9`!(cn)) {
14837 *offset += SCTP_BUF_LENcxx . . $ `usrsctplib/netinet/sctp_os_userspace.h:790:9`!(cn);
14838 }
14839
14840 /* update length and return pointer to the auth chunk */
14841 SCTP_BUF_LENcxx . . $ `usrsctplib/netinet/sctp_os_userspace.h:790:9`!(m_auth) = chunk_len;
14842 m = sctp_copy_mbufchaincxx . . $ sctp_copy_mbufchain(161b07f3a70427c7).(m_auth, m, m_end, 1, chunk_len, 0);
14843 if (auth_ret != NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!)
14844 *auth_ret = auth;
14845
14846 return (m);
14847 }
14848
14849 #if (defined(__FreeBSD__) || defined(__APPLE__)) && !defined(__Userspace__cxx . . $ `<built-in>:442:9`!)
14850 #ifdef INET6
14851 int
14852 sctp_v6src_match_nexthop(struct sockaddr_in6 *src6, sctp_route_t *ro)
14853 {
14854 struct nd_prefix *pfx = NULL;
14855 struct nd_pfxrouter *pfxrtr = NULL;
14856 struct sockaddr_in6 gw6;
14857
14858 #if defined(__FreeBSD__)
14859 if (ro == NULL || ro->ro_nh == NULL || src6->sin6_family != AF_INET6)
14860 #else
14861 if (ro == NULL || ro->ro_rt == NULL || src6->sin6_family != AF_INET6)
14862 #endif
14863 return (0);
14864
14865 /* get prefix entry of address */
14866 #if defined(__FreeBSD__)
14867 ND6_RLOCK();
14868 #endif
14869 LIST_FOREACH(pfx, &MODULE_GLOBAL(nd_prefix), ndpr_entry) {
14870 if (pfx->ndpr_stateflags & NDPRF_DETACHED)
14871 continue;
14872 if (IN6_ARE_MASKED_ADDR_EQUAL(&pfx->ndpr_prefix.sin6_addr,
14873 &src6->sin6_addr, &pfx->ndpr_mask))
14874 break;
14875 }
14876 /* no prefix entry in the prefix list */
14877 if (pfx == NULL) {
14878 #if defined(__FreeBSD__)
14879 ND6_RUNLOCK();
14880 #endif
14881 SCTPDBG(SCTP_DEBUG_OUTPUT2, "No prefix entry for ");
14882 SCTPDBG_ADDR(SCTP_DEBUG_OUTPUT2, (struct sockaddr *)src6);
14883 return (0);
14884 }
14885
14886 SCTPDBG(SCTP_DEBUG_OUTPUT2, "v6src_match_nexthop(), Prefix entry is ");
14887 SCTPDBG_ADDR(SCTP_DEBUG_OUTPUT2, (struct sockaddr *)src6);
14888
14889 /* search installed gateway from prefix entry */
14890 LIST_FOREACH(pfxrtr, &pfx->ndpr_advrtrs, pfr_entry) {
14891 memset(&gw6, 0, sizeof(struct sockaddr_in6));
14892 gw6.sin6_family = AF_INET6;
14893 #ifdef HAVE_SIN6_LEN
14894 gw6.sin6_len = sizeof(struct sockaddr_in6);
14895 #endif
14896 memcpy(&gw6.sin6_addr, &pfxrtr->router->rtaddr,
14897 sizeof(struct in6_addr));
14898 SCTPDBG(SCTP_DEBUG_OUTPUT2, "prefix router is ");
14899 SCTPDBG_ADDR(SCTP_DEBUG_OUTPUT2, (struct sockaddr *)&gw6);
14900 SCTPDBG(SCTP_DEBUG_OUTPUT2, "installed router is ");
14901 #if defined(__FreeBSD__)
14902 SCTPDBG_ADDR(SCTP_DEBUG_OUTPUT2, &ro->ro_nh->gw_sa);
14903 #else
14904 SCTPDBG_ADDR(SCTP_DEBUG_OUTPUT2, ro->ro_rt->rt_gateway);
14905 #endif
14906 #if defined(__FreeBSD__)
14907 if (sctp_cmpaddr((struct sockaddr *)&gw6, &ro->ro_nh->gw_sa)) {
14908 ND6_RUNLOCK();
14909 #else
14910 if (sctp_cmpaddr((struct sockaddr *)&gw6, ro->ro_rt->rt_gateway)) {
14911 #endif
14912 SCTPDBG(SCTP_DEBUG_OUTPUT2, "pfxrouter is installed\n");
14913 return (1);
14914 }
14915 }
14916 #if defined(__FreeBSD__)
14917 ND6_RUNLOCK();
14918 #endif
14919 SCTPDBG(SCTP_DEBUG_OUTPUT2, "pfxrouter is not installed\n");
14920 return (0);
14921 }
14922 #endif
14923
14924 int
14925 sctp_v4src_match_nexthop(struct sctp_ifa *sifa, sctp_route_t *ro)
14926 {
14927 #ifdef INET
14928 struct sockaddr_in *sin, *mask;
14929 struct ifaddr *ifa;
14930 struct in_addr srcnetaddr, gwnetaddr;
14931
14932 #if defined(__FreeBSD__)
14933 if (ro == NULL || ro->ro_nh == NULL ||
14934 #else
14935 if (ro == NULL || ro->ro_rt == NULL ||
14936 #endif
14937 sifa->address.sa.sa_family != AF_INET) {
14938 return (0);
14939 }
14940 ifa = (struct ifaddr *)sifa->ifa;
14941 mask = (struct sockaddr_in *)(ifa->ifa_netmask);
14942 sin = &sifa->address.sin;
14943 srcnetaddr.s_addr = (sin->sin_addr.s_addr & mask->sin_addr.s_addr);
14944 SCTPDBG(SCTP_DEBUG_OUTPUT1, "match_nexthop4: src address is ");
14945 SCTPDBG_ADDR(SCTP_DEBUG_OUTPUT2, &sifa->address.sa);
14946 SCTPDBG(SCTP_DEBUG_OUTPUT1, "network address is %x\n", srcnetaddr.s_addr);
14947
14948 #if defined(__FreeBSD__)
14949 sin = &ro->ro_nh->gw4_sa;
14950 #else
14951 sin = (struct sockaddr_in *)ro->ro_rt->rt_gateway;
14952 #endif
14953 gwnetaddr.s_addr = (sin->sin_addr.s_addr & mask->sin_addr.s_addr);
14954 SCTPDBG(SCTP_DEBUG_OUTPUT1, "match_nexthop4: nexthop is ");
14955 #if defined(__FreeBSD__)
14956 SCTPDBG_ADDR(SCTP_DEBUG_OUTPUT2, &ro->ro_nh->gw_sa);
14957 #else
14958 SCTPDBG_ADDR(SCTP_DEBUG_OUTPUT2, ro->ro_rt->rt_gateway);
14959 #endif
14960 SCTPDBG(SCTP_DEBUG_OUTPUT1, "network address is %x\n", gwnetaddr.s_addr);
14961 if (srcnetaddr.s_addr == gwnetaddr.s_addr) {
14962 return (1);
14963 }
14964 #endif
14965 return (0);
14966 }
14967 #elif defined(__Userspace__cxx . . $ `<built-in>:442:9`!)
14968 /* TODO __Userspace__ versions of sctp_vXsrc_match_nexthop(). */
14969 int
14970 sctp_v6src_match_nexthopcxx . . $ sctp_v6src_match_nexthop(5fd08f6fe6ec8888).(struct sockaddr_in6cxx . . $ sockaddr_in6# *src6, sctp_route_tcxx . . $ sctp_route_t# *ro)
14971 {
14972 return (0);
14973 }
14974 int
14975 sctp_v4src_match_nexthopcxx . . $ sctp_v4src_match_nexthop(43a5fcdb6d536ef6).(struct sctp_ifacxx . . $ sctp_ifa# *sifa, sctp_route_tcxx . . $ sctp_route_t# *ro)
14976 {
14977 return (0);
14978 }
14979
14980 #endif