mirror of
https://github.com/opnsense/src.git
synced 2026-06-08 16:22:46 -04:00
Add consistency checks to ensure that fragments of a user message
have the same U-bit. MFC after: 3 days
This commit is contained in:
parent
4f52dde357
commit
eb67ee5fc6
1 changed files with 36 additions and 1 deletions
|
|
@ -828,7 +828,6 @@ sctp_queue_data_for_reasm(struct sctp_tcb *stcb, struct sctp_association *asoc,
|
|||
{
|
||||
struct mbuf *op_err;
|
||||
char msg[SCTP_DIAG_INFO_LEN];
|
||||
|
||||
uint32_t cum_ackp1, prev_tsn, post_tsn;
|
||||
struct sctp_tmit_chunk *at, *prev, *next;
|
||||
|
||||
|
|
@ -1017,6 +1016,24 @@ sctp_queue_data_for_reasm(struct sctp_tcb *stcb, struct sctp_association *asoc,
|
|||
*abort_flag = 1;
|
||||
return;
|
||||
}
|
||||
if ((chk->rec.data.rcv_flags & SCTP_DATA_UNORDERED) !=
|
||||
(prev->rec.data.rcv_flags & SCTP_DATA_UNORDERED)) {
|
||||
/*
|
||||
* Huh, need the same ordering here,
|
||||
* they must be the same.
|
||||
*/
|
||||
SCTPDBG(SCTP_DEBUG_INDATA1, "Prev check - Gak, Evil plot, U-bit not constant\n");
|
||||
snprintf(msg, sizeof(msg),
|
||||
"Expect U-bit=%d for TSN=%8.8x, got U-bit=%d",
|
||||
(prev->rec.data.rcv_flags & SCTP_DATA_UNORDERED) ? 1 : 0,
|
||||
chk->rec.data.TSN_seq,
|
||||
(chk->rec.data.rcv_flags & SCTP_DATA_UNORDERED) ? 1 : 0);
|
||||
op_err = sctp_generate_cause(SCTP_CAUSE_PROTOCOL_VIOLATION, msg);
|
||||
stcb->sctp_ep->last_abort_code = SCTP_FROM_SCTP_INDATA + SCTP_LOC_7;
|
||||
sctp_abort_an_association(stcb->sctp_ep, stcb, op_err, SCTP_SO_NOT_LOCKED);
|
||||
*abort_flag = 1;
|
||||
return;
|
||||
}
|
||||
if ((prev->rec.data.rcv_flags & SCTP_DATA_UNORDERED) == 0 &&
|
||||
chk->rec.data.stream_seq !=
|
||||
prev->rec.data.stream_seq) {
|
||||
|
|
@ -1127,6 +1144,24 @@ sctp_queue_data_for_reasm(struct sctp_tcb *stcb, struct sctp_association *asoc,
|
|||
*abort_flag = 1;
|
||||
return;
|
||||
}
|
||||
if ((chk->rec.data.rcv_flags & SCTP_DATA_UNORDERED) !=
|
||||
(next->rec.data.rcv_flags & SCTP_DATA_UNORDERED)) {
|
||||
/*
|
||||
* Huh, need the same ordering here,
|
||||
* they must be the same.
|
||||
*/
|
||||
SCTPDBG(SCTP_DEBUG_INDATA1, "Next check - Gak, Evil plot, U-bit not constant\n");
|
||||
snprintf(msg, sizeof(msg),
|
||||
"Expect U-bit=%d for TSN=%8.8x, got U-bit=%d",
|
||||
(next->rec.data.rcv_flags & SCTP_DATA_UNORDERED) ? 1 : 0,
|
||||
chk->rec.data.TSN_seq,
|
||||
(chk->rec.data.rcv_flags & SCTP_DATA_UNORDERED) ? 1 : 0);
|
||||
op_err = sctp_generate_cause(SCTP_CAUSE_PROTOCOL_VIOLATION, msg);
|
||||
stcb->sctp_ep->last_abort_code = SCTP_FROM_SCTP_INDATA + SCTP_LOC_12;
|
||||
sctp_abort_an_association(stcb->sctp_ep, stcb, op_err, SCTP_SO_NOT_LOCKED);
|
||||
*abort_flag = 1;
|
||||
return;
|
||||
}
|
||||
if ((next->rec.data.rcv_flags & SCTP_DATA_UNORDERED) == 0 &&
|
||||
chk->rec.data.stream_seq !=
|
||||
next->rec.data.stream_seq) {
|
||||
|
|
|
|||
Loading…
Reference in a new issue