This patch fixes two bugs related to the setting of the I-Bit

for SCTP DATA and I-DATA chunks.
* For fragmented user messages, set the I-Bit only on the last
  fragment.
* When using explicit EOR mode, set the I-Bit on the last
  fragment, whenever SCTP_SACK_IMMEDIATELY was set in snd_flags
  for any of the send() calls.

Approved by:	re (hrs)
MFC after:	1 week
This commit is contained in:
Michael Tuexen 2016-06-30 06:06:35 +00:00
parent cadab29308
commit e75f31c1d0

View File

@ -7325,10 +7325,12 @@ sctp_move_to_outqueue(struct sctp_tcb *stcb,
/* All of it fits in the MTU */
if (sp->some_taken) {
rcv_flags |= SCTP_DATA_LAST_FRAG;
sp->put_last_out = 1;
} else {
rcv_flags |= SCTP_DATA_NOT_FRAG;
sp->put_last_out = 1;
}
sp->put_last_out = 1;
if (sp->sinfo_flags & SCTP_SACK_IMMEDIATELY) {
rcv_flags |= SCTP_DATA_SACK_IMMEDIATELY;
}
} else {
/* Not all of it fits, we fragment */
@ -7396,8 +7398,8 @@ sctp_move_to_outqueue(struct sctp_tcb *stcb,
if (sp->sinfo_flags & SCTP_UNORDERED) {
rcv_flags |= SCTP_DATA_UNORDERED;
}
if ((SCTP_BASE_SYSCTL(sctp_enable_sack_immediately) && ((sp->sinfo_flags & SCTP_EOF) == SCTP_EOF)) ||
((sp->sinfo_flags & SCTP_SACK_IMMEDIATELY) == SCTP_SACK_IMMEDIATELY)) {
if (SCTP_BASE_SYSCTL(sctp_enable_sack_immediately) &&
(sp->sinfo_flags & SCTP_EOF) == SCTP_EOF) {
rcv_flags |= SCTP_DATA_SACK_IMMEDIATELY;
}
/* clear out the chunk before setting up */
@ -13280,7 +13282,9 @@ sctp_lower_sosend(struct socket *so,
sctp_snd_sb_alloc(stcb, sndout);
atomic_add_int(&sp->length, sndout);
len += sndout;
if (srcv->sinfo_flags & SCTP_SACK_IMMEDIATELY) {
sp->sinfo_flags |= SCTP_SACK_IMMEDIATELY;
}
/* Did we reach EOR? */
if ((uio->uio_resid == 0) &&
((user_marks_eor == 0) ||