MCPcopy Create free account
hub / github.com/F-Stack/f-stack / sctp_queue_data_for_reasm

Function sctp_queue_data_for_reasm

freebsd/netinet/sctp_indata.c:1364–1662  ·  view source on GitHub ↗

* Dump onto the re-assembly queue, in its proper place. After dumping on the * queue, see if anthing can be delivered. If so pull it off (or as much as * we can. If we run out of space then we must dump what we can and set the * appropriate flag to say we queued what we could. */

Source from the content-addressed store, hash-verified

1362 * appropriate flag to say we queued what we could.
1363 */
1364static void
1365sctp_queue_data_for_reasm(struct sctp_tcb *stcb, struct sctp_association *asoc,
1366 struct sctp_queued_to_read *control,
1367 struct sctp_tmit_chunk *chk,
1368 int created_control,
1369 int *abort_flag, uint32_t tsn)
1370{
1371 uint32_t next_fsn;
1372 struct sctp_tmit_chunk *at, *nat;
1373 struct sctp_stream_in *strm;
1374 int do_wakeup, unordered;
1375 uint32_t lenadded;
1376
1377 strm = &asoc->strmin[control->sinfo_stream];
1378 /*
1379 * For old un-ordered data chunks.
1380 */
1381 if ((control->sinfo_flags >> 8) & SCTP_DATA_UNORDERED) {
1382 unordered = 1;
1383 } else {
1384 unordered = 0;
1385 }
1386 /* Must be added to the stream-in queue */
1387 if (created_control) {
1388 if ((unordered == 0) || (asoc->idata_supported)) {
1389 sctp_ucount_incr(asoc->cnt_on_all_streams);
1390 }
1391 if (sctp_place_control_in_stream(strm, asoc, control)) {
1392 /* Duplicate SSN? */
1393 sctp_abort_in_reasm(stcb, control, chk,
1394 abort_flag,
1395 SCTP_FROM_SCTP_INDATA + SCTP_LOC_6);
1396 sctp_clean_up_control(stcb, control);
1397 return;
1398 }
1399 if ((tsn == (asoc->cumulative_tsn + 1) && (asoc->idata_supported == 0))) {
1400 /*
1401 * Ok we created this control and now lets validate
1402 * that its legal i.e. there is a B bit set, if not
1403 * and we have up to the cum-ack then its invalid.
1404 */
1405 if ((chk->rec.data.rcv_flags & SCTP_DATA_FIRST_FRAG) == 0) {
1406 sctp_abort_in_reasm(stcb, control, chk,
1407 abort_flag,
1408 SCTP_FROM_SCTP_INDATA + SCTP_LOC_7);
1409 return;
1410 }
1411 }
1412 }
1413 if ((asoc->idata_supported == 0) && (unordered == 1)) {
1414 sctp_inject_old_unordered_data(stcb, asoc, control, chk, abort_flag);
1415 return;
1416 }
1417 /*
1418 * Ok we must queue the chunk into the reasembly portion: o if its
1419 * the first it goes to the control mbuf. o if its not first but the
1420 * next in sequence it goes to the control, and each succeeding one
1421 * in order also goes. o if its not in order we place it on the list

Callers 1

Calls 9

sctp_abort_in_reasmFunction · 0.85
sctp_clean_up_controlFunction · 0.85
sctp_mark_non_revokableFunction · 0.85
sctp_setup_tail_pointerFunction · 0.85
sctp_add_chk_to_controlFunction · 0.85
sctp_add_to_readqFunction · 0.85

Tested by

no test coverage detected