Skip to content

Commit

Permalink
Improve the handling of fragmented, unordered, and unreliable
Browse files Browse the repository at this point in the history
user data using DATA chunks in the receive path.

This fixes pion/sctp#138

Thanks to Yutaka Takeda for reporting the issue.
  • Loading branch information
tuexen committed Sep 27, 2020
1 parent f57a2fe commit 014c58c
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions netinet/sctp_indata.c
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@

#if defined(__FreeBSD__) && !defined(__Userspace__)
#include <sys/cdefs.h>
__FBSDID("$FreeBSD: head/sys/netinet/sctp_indata.c 366114 2020-09-24 12:26:06Z tuexen $");
__FBSDID("$FreeBSD: head/sys/netinet/sctp_indata.c 366199 2020-09-27 13:32:02Z tuexen $");
#endif

#include <netinet/sctp_os.h>
Expand Down Expand Up @@ -5462,7 +5462,6 @@ sctp_flush_reassm_for_str_seq(struct sctp_tcb *stcb,
struct sctp_queued_to_read *control, int ordered, uint32_t cumtsn)
{
struct sctp_tmit_chunk *chk, *nchk;
int cnt_removed = 0;

/*
* For now large messages held on the stream reasm that are
Expand All @@ -5472,17 +5471,18 @@ sctp_flush_reassm_for_str_seq(struct sctp_tcb *stcb,
* delivery function... to see if it can be delivered... But
* for now we just dump everything on the queue.
*/
if (!asoc->idata_supported && !ordered && SCTP_TSN_GT(control->fsn_included, cumtsn)) {
if (!asoc->idata_supported && !ordered &&
control->first_frag_seen &&
SCTP_TSN_GT(control->fsn_included, cumtsn)) {
return;
}
TAILQ_FOREACH_SAFE(chk, &control->reasm, sctp_next, nchk) {
/* Purge hanging chunks */
if (!asoc->idata_supported && (ordered == 0)) {
if (!asoc->idata_supported && !ordered) {
if (SCTP_TSN_GT(chk->rec.data.tsn, cumtsn)) {
break;
}
}
cnt_removed++;
TAILQ_REMOVE(&control->reasm, chk, sctp_next);
if (asoc->size_on_reasm_queue >= chk->send_size) {
asoc->size_on_reasm_queue -= chk->send_size;
Expand Down

0 comments on commit 014c58c

Please sign in to comment.