summaryrefslogtreecommitdiffstats
path: root/sys/netinet
diff options
context:
space:
mode:
authortuexen <tuexen@FreeBSD.org>2016-12-18 13:04:29 +0000
committertuexen <tuexen@FreeBSD.org>2016-12-18 13:04:29 +0000
commit22aded0803f3b3a0310198e57e118b4221336e0e (patch)
treeed1597863cdbdca73c14cb1311366f0d7b17296d /sys/netinet
parent6f10afb8c856d41e9e13bde2903586d17acc45ff (diff)
downloadFreeBSD-src-22aded0803f3b3a0310198e57e118b4221336e0e.zip
FreeBSD-src-22aded0803f3b3a0310198e57e118b4221336e0e.tar.gz
MFC r309682:
Cleanup the names of SSN, SID, TSN, FSN, PPID and MID. This made a couple of bugs visible in handling SSN wrap-arounds when using DATA chunks. Now bulk transfer seems to work fine... This fixes the issue reported in https://github.com/sctplab/usrsctp/issues/111
Diffstat (limited to 'sys/netinet')
-rw-r--r--sys/netinet/sctp_cc_functions.c12
-rw-r--r--sys/netinet/sctp_constants.h5
-rw-r--r--sys/netinet/sctp_header.h20
-rw-r--r--sys/netinet/sctp_indata.c565
-rw-r--r--sys/netinet/sctp_indata.h11
-rw-r--r--sys/netinet/sctp_input.c42
-rw-r--r--sys/netinet/sctp_output.c135
-rw-r--r--sys/netinet/sctp_pcb.c18
-rw-r--r--sys/netinet/sctp_ss_functions.c4
-rw-r--r--sys/netinet/sctp_structs.h21
-rw-r--r--sys/netinet/sctp_timer.c34
-rw-r--r--sys/netinet/sctp_usrreq.c2
-rw-r--r--sys/netinet/sctp_var.h4
-rw-r--r--sys/netinet/sctputil.c67
14 files changed, 465 insertions, 475 deletions
diff --git a/sys/netinet/sctp_cc_functions.c b/sys/netinet/sctp_cc_functions.c
index b87ac05..f73570c 100644
--- a/sys/netinet/sctp_cc_functions.c
+++ b/sys/netinet/sctp_cc_functions.c
@@ -205,7 +205,7 @@ sctp_cwnd_update_after_fr(struct sctp_tcb *stcb,
/* Mark end of the window */
asoc->fast_recovery_tsn = asoc->sending_seq - 1;
} else {
- asoc->fast_recovery_tsn = lchk->rec.data.TSN_seq - 1;
+ asoc->fast_recovery_tsn = lchk->rec.data.tsn - 1;
}
/*
@@ -218,7 +218,7 @@ sctp_cwnd_update_after_fr(struct sctp_tcb *stcb,
/* Mark end of the window */
net->fast_recovery_tsn = asoc->sending_seq - 1;
} else {
- net->fast_recovery_tsn = lchk->rec.data.TSN_seq - 1;
+ net->fast_recovery_tsn = lchk->rec.data.tsn - 1;
}
sctp_timer_stop(SCTP_TIMER_TYPE_SEND,
@@ -1698,7 +1698,7 @@ sctp_hs_cwnd_update_after_fr(struct sctp_tcb *stcb,
/* Mark end of the window */
asoc->fast_recovery_tsn = asoc->sending_seq - 1;
} else {
- asoc->fast_recovery_tsn = lchk->rec.data.TSN_seq - 1;
+ asoc->fast_recovery_tsn = lchk->rec.data.tsn - 1;
}
/*
@@ -1711,7 +1711,7 @@ sctp_hs_cwnd_update_after_fr(struct sctp_tcb *stcb,
/* Mark end of the window */
net->fast_recovery_tsn = asoc->sending_seq - 1;
} else {
- net->fast_recovery_tsn = lchk->rec.data.TSN_seq - 1;
+ net->fast_recovery_tsn = lchk->rec.data.tsn - 1;
}
sctp_timer_stop(SCTP_TIMER_TYPE_SEND,
@@ -2228,7 +2228,7 @@ sctp_htcp_cwnd_update_after_fr(struct sctp_tcb *stcb,
/* Mark end of the window */
asoc->fast_recovery_tsn = asoc->sending_seq - 1;
} else {
- asoc->fast_recovery_tsn = lchk->rec.data.TSN_seq - 1;
+ asoc->fast_recovery_tsn = lchk->rec.data.tsn - 1;
}
/*
@@ -2241,7 +2241,7 @@ sctp_htcp_cwnd_update_after_fr(struct sctp_tcb *stcb,
/* Mark end of the window */
net->fast_recovery_tsn = asoc->sending_seq - 1;
} else {
- net->fast_recovery_tsn = lchk->rec.data.TSN_seq - 1;
+ net->fast_recovery_tsn = lchk->rec.data.tsn - 1;
}
sctp_timer_stop(SCTP_TIMER_TYPE_SEND,
diff --git a/sys/netinet/sctp_constants.h b/sys/netinet/sctp_constants.h
index ecde4fe..e779051 100644
--- a/sys/netinet/sctp_constants.h
+++ b/sys/netinet/sctp_constants.h
@@ -898,8 +898,9 @@ __FBSDID("$FreeBSD$");
#define SCTP_SSN_GE(a, b) SCTP_UINT16_GE(a, b)
#define SCTP_TSN_GT(a, b) SCTP_UINT32_GT(a, b)
#define SCTP_TSN_GE(a, b) SCTP_UINT32_GE(a, b)
-#define SCTP_MSGID_GT(o, a, b) ((o == 1) ? SCTP_UINT16_GT((uint16_t)a, (uint16_t)b) : SCTP_UINT32_GT(a, b))
-#define SCTP_MSGID_GE(o, a, b) ((o == 1) ? SCTP_UINT16_GE((uint16_t)a, (uint16_t)b) : SCTP_UINT32_GE(a, b))
+#define SCTP_MID_GT(i, a, b) (((i) == 1) ? SCTP_UINT32_GT(a, b) : SCTP_UINT16_GT((uint16_t)a, (uint16_t)b))
+#define SCTP_MID_GE(i, a, b) (((i) == 1) ? SCTP_UINT32_GE(a, b) : SCTP_UINT16_GE((uint16_t)a, (uint16_t)b))
+#define SCTP_MID_EQ(i, a, b) (((i) == 1) ? a == b : (uint16_t)a == (uint16_t)b)
/* Mapping array manipulation routines */
#define SCTP_IS_TSN_PRESENT(arry, gap) ((arry[(gap >> 3)] >> (gap & 0x07)) & 0x01)
diff --git a/sys/netinet/sctp_header.h b/sys/netinet/sctp_header.h
index f0eec81..b650d93 100644
--- a/sys/netinet/sctp_header.h
+++ b/sys/netinet/sctp_header.h
@@ -141,9 +141,9 @@ struct sctp_supported_chunk_types_param {
*/
struct sctp_data {
uint32_t tsn;
- uint16_t stream_id;
- uint16_t stream_sequence;
- uint32_t protocol_id;
+ uint16_t sid;
+ uint16_t ssn;
+ uint32_t ppid;
/* user data follows */
} SCTP_PACKED;
@@ -154,11 +154,11 @@ struct sctp_data_chunk {
struct sctp_idata {
uint32_t tsn;
- uint16_t stream_id;
+ uint16_t sid;
uint16_t reserved; /* Where does the SSN go? */
- uint32_t msg_id;
+ uint32_t mid;
union {
- uint32_t protocol_id;
+ uint32_t ppid;
uint32_t fsn; /* Fragment Sequence Number */
} ppid_fsn;
/* user data follows */
@@ -390,14 +390,14 @@ struct sctp_forward_tsn_chunk {
} SCTP_PACKED;
struct sctp_strseq {
- uint16_t stream;
- uint16_t sequence;
+ uint16_t sid;
+ uint16_t ssn;
} SCTP_PACKED;
struct sctp_strseq_mid {
- uint16_t stream;
+ uint16_t sid;
uint16_t flags;
- uint32_t msg_id;
+ uint32_t mid;
};
struct sctp_forward_tsn_msg {
diff --git a/sys/netinet/sctp_indata.c b/sys/netinet/sctp_indata.c
index e68ee4d..e36e7ad 100644
--- a/sys/netinet/sctp_indata.c
+++ b/sys/netinet/sctp_indata.c
@@ -130,8 +130,8 @@ struct sctp_queued_to_read *
sctp_build_readq_entry(struct sctp_tcb *stcb,
struct sctp_nets *net,
uint32_t tsn, uint32_t ppid,
- uint32_t context, uint16_t stream_no,
- uint32_t stream_seq, uint8_t flags,
+ uint32_t context, uint16_t sid,
+ uint32_t mid, uint8_t flags,
struct mbuf *dm)
{
struct sctp_queued_to_read *read_queue_e = NULL;
@@ -141,14 +141,14 @@ sctp_build_readq_entry(struct sctp_tcb *stcb,
goto failed_build;
}
memset(read_queue_e, 0, sizeof(struct sctp_queued_to_read));
- read_queue_e->sinfo_stream = stream_no;
- read_queue_e->sinfo_ssn = stream_seq;
+ read_queue_e->sinfo_stream = sid;
read_queue_e->sinfo_flags = (flags << 8);
read_queue_e->sinfo_ppid = ppid;
read_queue_e->sinfo_context = context;
read_queue_e->sinfo_tsn = tsn;
read_queue_e->sinfo_cumtsn = tsn;
read_queue_e->sinfo_assoc_id = sctp_get_associd(stcb);
+ read_queue_e->mid = mid;
read_queue_e->top_fsn = read_queue_e->fsn_included = 0xffffffff;
TAILQ_INIT(&read_queue_e->reasm);
read_queue_e->whoFrom = net;
@@ -366,7 +366,7 @@ sctp_place_control_in_stream(struct sctp_stream_in *strm,
return (0);
} else {
TAILQ_FOREACH(at, q, next_instrm) {
- if (SCTP_TSN_GT(at->msg_id, control->msg_id)) {
+ if (SCTP_MID_GT(asoc->idata_supported, at->mid, control->mid)) {
/*
* one in queue is bigger than the new one,
* insert before this one
@@ -378,7 +378,7 @@ sctp_place_control_in_stream(struct sctp_stream_in *strm,
control->on_strm_q = SCTP_ON_ORDERED;
}
break;
- } else if (at->msg_id == control->msg_id) {
+ } else if (SCTP_MID_EQ(asoc->idata_supported, at->mid, control->mid)) {
/*
* Gak, He sent me a duplicate msg id
* number?? return -1 to abort.
@@ -423,18 +423,18 @@ sctp_abort_in_reasm(struct sctp_tcb *stcb,
"Reass %x,CF:%x,TSN=%8.8x,SID=%4.4x,FSN=%8.8x,MID:%8.8x",
opspot,
control->fsn_included,
- chk->rec.data.TSN_seq,
- chk->rec.data.stream_number,
- chk->rec.data.fsn_num, chk->rec.data.stream_seq);
+ chk->rec.data.tsn,
+ chk->rec.data.sid,
+ chk->rec.data.fsn, chk->rec.data.mid);
} else {
snprintf(msg, sizeof(msg),
"Reass %x,CI:%x,TSN=%8.8x,SID=%4.4x,FSN=%4.4x,SSN:%4.4x",
opspot,
control->fsn_included,
- chk->rec.data.TSN_seq,
- chk->rec.data.stream_number,
- chk->rec.data.fsn_num,
- (uint16_t) chk->rec.data.stream_seq);
+ chk->rec.data.tsn,
+ chk->rec.data.sid,
+ chk->rec.data.fsn,
+ (uint16_t) chk->rec.data.mid);
}
oper = sctp_generate_cause(SCTP_CAUSE_PROTOCOL_VIOLATION, msg);
sctp_m_freem(chk->data);
@@ -502,19 +502,27 @@ sctp_queue_data_to_stream(struct sctp_tcb *stcb,
if (SCTP_BASE_SYSCTL(sctp_logging_level) & SCTP_STR_LOGGING_ENABLE) {
sctp_log_strm_del(control, NULL, SCTP_STR_LOG_FROM_INTO_STRD);
}
- if (SCTP_MSGID_GT((!asoc->idata_supported), strm->last_sequence_delivered, control->sinfo_ssn)) {
+ if (SCTP_MID_GT((asoc->idata_supported), strm->last_mid_delivered, control->mid)) {
/* The incoming sseq is behind where we last delivered? */
SCTPDBG(SCTP_DEBUG_INDATA1, "Duplicate S-SEQ: %u delivered: %u from peer, Abort association\n",
- control->sinfo_ssn, strm->last_sequence_delivered);
+ control->mid, strm->last_mid_delivered);
protocol_error:
/*
* throw it in the stream so it gets cleaned up in
* association destruction
*/
TAILQ_INSERT_HEAD(&strm->inqueue, control, next_instrm);
- snprintf(msg, sizeof(msg), "Delivered SSN=%4.4x, got TSN=%8.8x, SID=%4.4x, SSN=%4.4x",
- strm->last_sequence_delivered, control->sinfo_tsn,
- control->sinfo_stream, control->sinfo_ssn);
+ if (asoc->idata_supported) {
+ snprintf(msg, sizeof(msg), "Delivered MID=%8.8x, got TSN=%8.8x, SID=%4.4x, MID=%8.8x",
+ strm->last_mid_delivered, control->sinfo_tsn,
+ control->sinfo_stream, control->mid);
+ } else {
+ snprintf(msg, sizeof(msg), "Delivered SSN=%4.4x, got TSN=%8.8x, SID=%4.4x, SSN=%4.4x",
+ (uint16_t) strm->last_mid_delivered,
+ control->sinfo_tsn,
+ control->sinfo_stream,
+ (uint16_t) control->mid);
+ }
op_err = sctp_generate_cause(SCTP_CAUSE_PROTOCOL_VIOLATION, msg);
stcb->sctp_ep->last_abort_code = SCTP_FROM_SCTP_INDATA + SCTP_LOC_2;
sctp_abort_an_association(stcb->sctp_ep, stcb, op_err, SCTP_SO_NOT_LOCKED);
@@ -528,8 +536,8 @@ protocol_error:
queue_needed = 1;
asoc->size_on_all_streams += control->length;
sctp_ucount_incr(asoc->cnt_on_all_streams);
- nxt_todel = strm->last_sequence_delivered + 1;
- if (nxt_todel == control->sinfo_ssn) {
+ nxt_todel = strm->last_mid_delivered + 1;
+ if (SCTP_MID_EQ(asoc->idata_supported, nxt_todel, control->mid)) {
#if defined(__APPLE__) || defined(SCTP_SO_LOCK_TESTING)
struct socket *so;
@@ -552,7 +560,7 @@ protocol_error:
queue_needed = 0;
asoc->size_on_all_streams -= control->length;
sctp_ucount_decr(asoc->cnt_on_all_streams);
- strm->last_sequence_delivered++;
+ strm->last_mid_delivered++;
sctp_mark_non_revokable(asoc, control->sinfo_tsn);
sctp_add_to_readq(stcb->sctp_ep, stcb,
control,
@@ -560,8 +568,8 @@ protocol_error:
SCTP_READ_LOCK_NOT_HELD, SCTP_SO_LOCKED);
TAILQ_FOREACH_SAFE(control, &strm->inqueue, next_instrm, at) {
/* all delivered */
- nxt_todel = strm->last_sequence_delivered + 1;
- if ((nxt_todel == control->sinfo_ssn) &&
+ nxt_todel = strm->last_mid_delivered + 1;
+ if (SCTP_MID_EQ(asoc->idata_supported, nxt_todel, control->mid) &&
(((control->sinfo_flags >> 8) & SCTP_DATA_NOT_FRAG) == SCTP_DATA_NOT_FRAG)) {
asoc->size_on_all_streams -= control->length;
sctp_ucount_decr(asoc->cnt_on_all_streams);
@@ -574,7 +582,7 @@ protocol_error:
#endif
}
control->on_strm_q = 0;
- strm->last_sequence_delivered++;
+ strm->last_mid_delivered++;
/*
* We ignore the return of deliver_data here
* since we always can hold the chunk on the
@@ -592,7 +600,7 @@ protocol_error:
SCTP_READ_LOCK_NOT_HELD,
SCTP_SO_LOCKED);
continue;
- } else if (nxt_todel == control->sinfo_ssn) {
+ } else if (SCTP_MID_EQ(asoc->idata_supported, nxt_todel, control->mid)) {
*need_reasm = 1;
}
break;
@@ -608,8 +616,8 @@ protocol_error:
*/
if (sctp_place_control_in_stream(strm, asoc, control)) {
snprintf(msg, sizeof(msg),
- "Queue to str msg_id: %u duplicate",
- control->msg_id);
+ "Queue to str MID: %u duplicate",
+ control->mid);
sctp_clean_up_control(stcb, control);
op_err = sctp_generate_cause(SCTP_CAUSE_PROTOCOL_VIOLATION, msg);
stcb->sctp_ep->last_abort_code = SCTP_FROM_SCTP_INDATA + SCTP_LOC_3;
@@ -720,10 +728,10 @@ sctp_build_readq_entry_from_ctl(struct sctp_queued_to_read *nc, struct sctp_queu
{
memset(nc, 0, sizeof(struct sctp_queued_to_read));
nc->sinfo_stream = control->sinfo_stream;
- nc->sinfo_ssn = control->sinfo_ssn;
+ nc->mid = control->mid;
TAILQ_INIT(&nc->reasm);
nc->top_fsn = control->top_fsn;
- nc->msg_id = control->msg_id;
+ nc->mid = control->mid;
nc->sinfo_flags = control->sinfo_flags;
nc->sinfo_ppid = control->sinfo_ppid;
nc->sinfo_context = control->sinfo_context;
@@ -762,11 +770,11 @@ sctp_handle_old_unordered_data(struct sctp_tcb *stcb,
{
/*
* Special handling for the old un-ordered data chunk. All the
- * chunks/TSN's go to msg_id 0. So we have to do the old style
- * watching to see if we have it all. If you return one, no other
- * control entries on the un-ordered queue will be looked at. In
- * theory there should be no others entries in reality, unless the
- * guy is sending both unordered NDATA and unordered DATA...
+ * chunks/TSN's go to mid 0. So we have to do the old style watching
+ * to see if we have it all. If you return one, no other control
+ * entries on the un-ordered queue will be looked at. In theory
+ * there should be no others entries in reality, unless the guy is
+ * sending both unordered NDATA and unordered DATA...
*/
struct sctp_tmit_chunk *chk, *lchk, *tchk;
uint32_t fsn;
@@ -783,7 +791,7 @@ restart:
fsn = control->fsn_included + 1;
/* Now what can we add? */
TAILQ_FOREACH_SAFE(chk, &control->reasm, sctp_next, lchk) {
- if (chk->rec.data.fsn_num == fsn) {
+ if (chk->rec.data.fsn == fsn) {
/* Ok lets add it */
sctp_alloc_a_readq(stcb, nc);
if (nc == NULL) {
@@ -810,11 +818,11 @@ restart:
asoc->size_on_reasm_queue -= tchk->send_size;
sctp_ucount_decr(asoc->cnt_on_reasm_queue);
nc->first_frag_seen = 1;
- nc->fsn_included = tchk->rec.data.fsn_num;
+ nc->fsn_included = tchk->rec.data.fsn;
nc->data = tchk->data;
- nc->sinfo_ppid = tchk->rec.data.payloadtype;
- nc->sinfo_tsn = tchk->rec.data.TSN_seq;
- sctp_mark_non_revokable(asoc, tchk->rec.data.TSN_seq);
+ nc->sinfo_ppid = tchk->rec.data.ppid;
+ nc->sinfo_tsn = tchk->rec.data.tsn;
+ sctp_mark_non_revokable(asoc, tchk->rec.data.tsn);
tchk->data = NULL;
sctp_free_a_chunk(stcb, tchk, SCTP_SO_NOT_LOCKED);
sctp_setup_tail_pointer(nc);
@@ -900,7 +908,7 @@ sctp_inject_old_unordered_data(struct sctp_tcb *stcb,
/* Its the very first one. */
SCTPDBG(SCTP_DEBUG_XXX,
"chunk is a first fsn: %u becomes fsn_included\n",
- chk->rec.data.fsn_num);
+ chk->rec.data.fsn);
if (control->first_frag_seen) {
/*
* In old un-ordered we can reassembly on one
@@ -911,12 +919,12 @@ sctp_inject_old_unordered_data(struct sctp_tcb *stcb,
struct mbuf *tdata;
uint32_t tmp;
- if (SCTP_TSN_GT(chk->rec.data.fsn_num, control->fsn_included)) {
+ if (SCTP_TSN_GT(chk->rec.data.fsn, control->fsn_included)) {
/* Easy way the start of a new guy beyond
* the lowest */
goto place_chunk;
}
- if ((chk->rec.data.fsn_num == control->fsn_included) ||
+ if ((chk->rec.data.fsn == control->fsn_included) ||
(control->pdapi_started)) {
/*
* Ok this should not happen, if it does we
@@ -950,25 +958,25 @@ sctp_inject_old_unordered_data(struct sctp_tcb *stcb,
sctp_setup_tail_pointer(control);
/* Fix the FSN included */
tmp = control->fsn_included;
- control->fsn_included = chk->rec.data.fsn_num;
- chk->rec.data.fsn_num = tmp;
+ control->fsn_included = chk->rec.data.fsn;
+ chk->rec.data.fsn = tmp;
/* Fix the TSN included */
tmp = control->sinfo_tsn;
- control->sinfo_tsn = chk->rec.data.TSN_seq;
- chk->rec.data.TSN_seq = tmp;
+ control->sinfo_tsn = chk->rec.data.tsn;
+ chk->rec.data.tsn = tmp;
/* Fix the PPID included */
tmp = control->sinfo_ppid;
- control->sinfo_ppid = chk->rec.data.payloadtype;
- chk->rec.data.payloadtype = tmp;
+ control->sinfo_ppid = chk->rec.data.ppid;
+ chk->rec.data.ppid = tmp;
/* Fix tail pointer */
goto place_chunk;
}
control->first_frag_seen = 1;
- control->top_fsn = control->fsn_included = chk->rec.data.fsn_num;
- control->sinfo_tsn = chk->rec.data.TSN_seq;
- control->sinfo_ppid = chk->rec.data.payloadtype;
+ control->top_fsn = control->fsn_included = chk->rec.data.fsn;
+ control->sinfo_tsn = chk->rec.data.tsn;
+ control->sinfo_ppid = chk->rec.data.ppid;
control->data = chk->data;
- sctp_mark_non_revokable(asoc, chk->rec.data.TSN_seq);
+ sctp_mark_non_revokable(asoc, chk->rec.data.tsn);
chk->data = NULL;
sctp_free_a_chunk(stcb, chk, SCTP_SO_NOT_LOCKED);
sctp_setup_tail_pointer(control);
@@ -977,7 +985,7 @@ sctp_inject_old_unordered_data(struct sctp_tcb *stcb,
place_chunk:
inserted = 0;
TAILQ_FOREACH(at, &control->reasm, sctp_next) {
- if (SCTP_TSN_GT(at->rec.data.fsn_num, chk->rec.data.fsn_num)) {
+ if (SCTP_TSN_GT(at->rec.data.fsn, chk->rec.data.fsn)) {
/*
* This one in queue is bigger than the new one,
* insert the new one before at.
@@ -987,7 +995,7 @@ place_chunk:
inserted = 1;
TAILQ_INSERT_BEFORE(at, chk, sctp_next);
break;
- } else if (at->rec.data.fsn_num == chk->rec.data.fsn_num) {
+ } else if (at->rec.data.fsn == chk->rec.data.fsn) {
/*
* They sent a duplicate fsn number. This really
* should not happen since the FSN is a TSN and it
@@ -1003,7 +1011,7 @@ place_chunk:
/* Its at the end */
asoc->size_on_reasm_queue += chk->send_size;
sctp_ucount_incr(asoc->cnt_on_reasm_queue);
- control->top_fsn = chk->rec.data.fsn_num;
+ control->top_fsn = chk->rec.data.fsn;
TAILQ_INSERT_TAIL(&control->reasm, chk, sctp_next);
}
}
@@ -1044,7 +1052,7 @@ sctp_deliver_reasm_check(struct sctp_tcb *stcb, struct sctp_association *asoc,
}
while (control) {
SCTPDBG(SCTP_DEBUG_XXX, "Looking at control: %p e(%d) ssn: %u top_fsn: %u inc_fsn: %u -uo\n",
- control, control->end_added, control->sinfo_ssn, control->top_fsn, control->fsn_included);
+ control, control->end_added, control->mid, control->top_fsn, control->fsn_included);
nctl = TAILQ_NEXT(control, next_instrm);
if (control->end_added) {
/* We just put the last bit on */
@@ -1089,7 +1097,7 @@ done_un:
if (control == NULL) {
return (ret);
}
- if (strm->last_sequence_delivered == control->sinfo_ssn) {
+ if (SCTP_MID_EQ(asoc->idata_supported, strm->last_mid_delivered, control->mid)) {
/*
* Ok the guy at the top was being partially delivered
* completed, so we remove it. Note the pd_api flag was
@@ -1099,9 +1107,9 @@ done_un:
nctl = TAILQ_NEXT(control, next_instrm);
SCTPDBG(SCTP_DEBUG_XXX,
"Looking at control: %p e(%d) ssn: %u top_fsn: %u inc_fsn: %u (lastdel: %u)- o\n",
- control, control->end_added, control->sinfo_ssn,
+ control, control->end_added, control->mid,
control->top_fsn, control->fsn_included,
- strm->last_sequence_delivered);
+ strm->last_mid_delivered);
if (control->end_added) {
if (control->on_strm_q) {
#ifdef INVARIANTS
@@ -1133,14 +1141,14 @@ done_un:
return (0);
}
deliver_more:
- next_to_del = strm->last_sequence_delivered + 1;
+ next_to_del = strm->last_mid_delivered + 1;
if (control) {
SCTPDBG(SCTP_DEBUG_XXX,
"Looking at control: %p e(%d) ssn: %u top_fsn: %u inc_fsn: %u (nxtdel: %u)- o\n",
- control, control->end_added, control->sinfo_ssn, control->top_fsn, control->fsn_included,
+ control, control->end_added, control->mid, control->top_fsn, control->fsn_included,
next_to_del);
nctl = TAILQ_NEXT(control, next_instrm);
- if ((control->sinfo_ssn == next_to_del) &&
+ if (SCTP_MID_EQ(asoc->idata_supported, control->mid, next_to_del) &&
(control->first_frag_seen)) {
int done;
@@ -1180,7 +1188,7 @@ deliver_more:
&stcb->sctp_socket->so_rcv, control->end_added,
inp_read_lock_held, SCTP_SO_NOT_LOCKED);
}
- strm->last_sequence_delivered = next_to_del;
+ strm->last_mid_delivered = next_to_del;
if (done) {
control = nctl;
goto deliver_more;
@@ -1221,10 +1229,10 @@ sctp_add_chk_to_control(struct sctp_queued_to_read *control,
} else {
sctp_add_to_tail_pointer(control, chk->data);
}
- control->fsn_included = chk->rec.data.fsn_num;
+ control->fsn_included = chk->rec.data.fsn;
asoc->size_on_reasm_queue -= chk->send_size;
sctp_ucount_decr(asoc->cnt_on_reasm_queue);
- sctp_mark_non_revokable(asoc, chk->rec.data.TSN_seq);
+ sctp_mark_non_revokable(asoc, chk->rec.data.tsn);
chk->data = NULL;
if (chk->rec.data.rcv_flags & SCTP_DATA_FIRST_FRAG) {
control->first_frag_seen = 1;
@@ -1325,7 +1333,7 @@ sctp_queue_data_for_reasm(struct sctp_tcb *stcb, struct sctp_association *asoc,
/* Its the very first one. */
SCTPDBG(SCTP_DEBUG_XXX,
"chunk is a first fsn: %u becomes fsn_included\n",
- chk->rec.data.fsn_num);
+ chk->rec.data.fsn);
if (control->first_frag_seen) {
/*
* Error on senders part, they either sent us two
@@ -1339,9 +1347,9 @@ sctp_queue_data_for_reasm(struct sctp_tcb *stcb, struct sctp_association *asoc,
return;
}
control->first_frag_seen = 1;
- control->fsn_included = chk->rec.data.fsn_num;
+ control->fsn_included = chk->rec.data.fsn;
control->data = chk->data;
- sctp_mark_non_revokable(asoc, chk->rec.data.TSN_seq);
+ sctp_mark_non_revokable(asoc, chk->rec.data.tsn);
chk->data = NULL;
sctp_free_a_chunk(stcb, chk, SCTP_SO_NOT_LOCKED);
sctp_setup_tail_pointer(control);
@@ -1351,16 +1359,16 @@ sctp_queue_data_for_reasm(struct sctp_tcb *stcb, struct sctp_association *asoc,
if (control->last_frag_seen == 0) {
/* Still willing to raise highest FSN seen */
- if (SCTP_TSN_GT(chk->rec.data.fsn_num, control->top_fsn)) {
+ if (SCTP_TSN_GT(chk->rec.data.fsn, control->top_fsn)) {
SCTPDBG(SCTP_DEBUG_XXX,
"We have a new top_fsn: %u\n",
- chk->rec.data.fsn_num);
- control->top_fsn = chk->rec.data.fsn_num;
+ chk->rec.data.fsn);
+ control->top_fsn = chk->rec.data.fsn;
}
if (chk->rec.data.rcv_flags & SCTP_DATA_LAST_FRAG) {
SCTPDBG(SCTP_DEBUG_XXX,
"The last fsn is now in place fsn: %u\n",
- chk->rec.data.fsn_num);
+ chk->rec.data.fsn);
control->last_frag_seen = 1;
}
if (asoc->idata_supported || control->first_frag_seen) {
@@ -1370,7 +1378,7 @@ sctp_queue_data_for_reasm(struct sctp_tcb *stcb, struct sctp_association *asoc,
* DATA we have to receive the first before
* we know the first FSN (which is the TSN).
*/
- if (SCTP_TSN_GE(control->fsn_included, chk->rec.data.fsn_num)) {
+ if (SCTP_TSN_GE(control->fsn_included, chk->rec.data.fsn)) {
/* We have already delivered up to
* this so its a dup */
sctp_abort_in_reasm(stcb, control, chk,
@@ -1384,7 +1392,7 @@ sctp_queue_data_for_reasm(struct sctp_tcb *stcb, struct sctp_association *asoc,
/* Second last? huh? */
SCTPDBG(SCTP_DEBUG_XXX,
"Duplicate last fsn: %u (top: %u) -- abort\n",
- chk->rec.data.fsn_num, control->top_fsn);
+ chk->rec.data.fsn, control->top_fsn);
sctp_abort_in_reasm(stcb, control,
chk, abort_flag,
SCTP_FROM_SCTP_INDATA + SCTP_LOC_10);
@@ -1398,12 +1406,12 @@ sctp_queue_data_for_reasm(struct sctp_tcb *stcb, struct sctp_association *asoc,
* we know the first FSN (which is the TSN).
*/
- if (SCTP_TSN_GE(control->fsn_included, chk->rec.data.fsn_num)) {
+ if (SCTP_TSN_GE(control->fsn_included, chk->rec.data.fsn)) {
/* We have already delivered up to
* this so its a dup */
SCTPDBG(SCTP_DEBUG_XXX,
"New fsn: %u is already seen in included_fsn: %u -- abort\n",
- chk->rec.data.fsn_num, control->fsn_included);
+ chk->rec.data.fsn, control->fsn_included);
sctp_abort_in_reasm(stcb, control, chk,
abort_flag,
SCTP_FROM_SCTP_INDATA + SCTP_LOC_11);
@@ -1412,10 +1420,10 @@ sctp_queue_data_for_reasm(struct sctp_tcb *stcb, struct sctp_association *asoc,
}
/* validate not beyond top FSN if we have seen last
* one */
- if (SCTP_TSN_GT(chk->rec.data.fsn_num, control->top_fsn)) {
+ if (SCTP_TSN_GT(chk->rec.data.fsn, control->top_fsn)) {
SCTPDBG(SCTP_DEBUG_XXX,
"New fsn: %u is beyond or at top_fsn: %u -- abort\n",
- chk->rec.data.fsn_num,
+ chk->rec.data.fsn,
control->top_fsn);
sctp_abort_in_reasm(stcb, control, chk,
abort_flag,
@@ -1429,22 +1437,22 @@ sctp_queue_data_for_reasm(struct sctp_tcb *stcb, struct sctp_association *asoc,
*/
SCTPDBG(SCTP_DEBUG_XXX,
"chunk is a not first fsn: %u needs to be inserted\n",
- chk->rec.data.fsn_num);
+ chk->rec.data.fsn);
TAILQ_FOREACH(at, &control->reasm, sctp_next) {
- if (SCTP_TSN_GT(at->rec.data.fsn_num, chk->rec.data.fsn_num)) {
+ if (SCTP_TSN_GT(at->rec.data.fsn, chk->rec.data.fsn)) {
/*
* This one in queue is bigger than the new
* one, insert the new one before at.
*/
SCTPDBG(SCTP_DEBUG_XXX,
"Insert it before fsn: %u\n",
- at->rec.data.fsn_num);
+ at->rec.data.fsn);
asoc->size_on_reasm_queue += chk->send_size;
sctp_ucount_incr(asoc->cnt_on_reasm_queue);
TAILQ_INSERT_BEFORE(at, chk, sctp_next);
inserted = 1;
break;
- } else if (at->rec.data.fsn_num == chk->rec.data.fsn_num) {
+ } else if (at->rec.data.fsn == chk->rec.data.fsn) {
/* Gak, He sent me a duplicate str seq
* number */
/*
@@ -1457,7 +1465,7 @@ sctp_queue_data_for_reasm(struct sctp_tcb *stcb, struct sctp_association *asoc,
*/
SCTPDBG(SCTP_DEBUG_XXX,
"Duplicate to fsn: %u -- abort\n",
- at->rec.data.fsn_num);
+ at->rec.data.fsn);
sctp_abort_in_reasm(stcb, control,
chk, abort_flag,
SCTP_FROM_SCTP_INDATA + SCTP_LOC_13);
@@ -1467,7 +1475,7 @@ sctp_queue_data_for_reasm(struct sctp_tcb *stcb, struct sctp_association *asoc,
if (inserted == 0) {
/* Goes on the end */
SCTPDBG(SCTP_DEBUG_XXX, "Inserting at tail of list fsn: %u\n",
- chk->rec.data.fsn_num);
+ chk->rec.data.fsn);
asoc->size_on_reasm_queue += chk->send_size;
sctp_ucount_incr(asoc->cnt_on_reasm_queue);
TAILQ_INSERT_TAIL(&control->reasm, chk, sctp_next);
@@ -1485,12 +1493,12 @@ sctp_queue_data_for_reasm(struct sctp_tcb *stcb, struct sctp_association *asoc,
if (control->first_frag_seen) {
next_fsn = control->fsn_included + 1;
TAILQ_FOREACH_SAFE(at, &control->reasm, sctp_next, nat) {
- if (at->rec.data.fsn_num == next_fsn) {
+ if (at->rec.data.fsn == next_fsn) {
/* We can add this one now to the control */
SCTPDBG(SCTP_DEBUG_XXX,
"Adding more to control: %p at: %p fsn: %u next_fsn: %u included: %u\n",
control, at,
- at->rec.data.fsn_num,
+ at->rec.data.fsn,
next_fsn, control->fsn_included);
TAILQ_REMOVE(&control->reasm, at, sctp_next);
sctp_add_chk_to_control(control, strm, stcb, asoc, at, SCTP_READ_LOCK_NOT_HELD);
@@ -1524,25 +1532,25 @@ sctp_queue_data_for_reasm(struct sctp_tcb *stcb, struct sctp_association *asoc,
}
static struct sctp_queued_to_read *
-sctp_find_reasm_entry(struct sctp_stream_in *strm, uint32_t msg_id, int ordered, int old)
+sctp_find_reasm_entry(struct sctp_stream_in *strm, uint32_t mid, int ordered, int idata_supported)
{
struct sctp_queued_to_read *control;
if (ordered) {
TAILQ_FOREACH(control, &strm->inqueue, next_instrm) {
- if (control->msg_id == msg_id) {
+ if (SCTP_MID_EQ(idata_supported, control->mid, mid)) {
break;
}
}
} else {
- if (old) {
- control = TAILQ_FIRST(&strm->uno_inqueue);
- return (control);
- }
- TAILQ_FOREACH(control, &strm->uno_inqueue, next_instrm) {
- if (control->msg_id == msg_id) {
- break;
+ if (idata_supported) {
+ TAILQ_FOREACH(control, &strm->uno_inqueue, next_instrm) {
+ if (SCTP_MID_EQ(idata_supported, control->mid, mid)) {
+ break;
+ }
}
+ } else {
+ control = TAILQ_FIRST(&strm->uno_inqueue);
}
}
return (control);
@@ -1559,22 +1567,21 @@ sctp_process_a_data_chunk(struct sctp_tcb *stcb, struct sctp_association *asoc,
struct sctp_data_chunk *ch;
struct sctp_idata_chunk *nch, chunk_buf;
struct sctp_tmit_chunk *chk;
- uint32_t tsn, fsn, gap, msg_id;
+ uint32_t tsn, fsn, gap, mid;
struct mbuf *dmbuf;
int the_len;
int need_reasm_check = 0;
- uint16_t strmno;
+ uint16_t sid;
struct mbuf *op_err;
char msg[SCTP_DIAG_INFO_LEN];
struct sctp_queued_to_read *control = NULL;
- uint32_t protocol_id;
+ uint32_t ppid;
uint8_t chunk_flags;
struct sctp_stream_reset_list *liste;
struct sctp_stream_in *strm;
int ordered;
size_t clen;
int created_control = 0;
- uint8_t old_data;
chk = NULL;
if (chtype == SCTP_IDATA) {
@@ -1583,23 +1590,21 @@ sctp_process_a_data_chunk(struct sctp_tcb *stcb, struct sctp_association *asoc,
ch = (struct sctp_data_chunk *)nch;
clen = sizeof(struct sctp_idata_chunk);
tsn = ntohl(ch->dp.tsn);
- msg_id = ntohl(nch->dp.msg_id);
- protocol_id = nch->dp.ppid_fsn.protocol_id;
+ mid = ntohl(nch->dp.mid);
+ ppid = nch->dp.ppid_fsn.ppid;
if (ch->ch.chunk_flags & SCTP_DATA_FIRST_FRAG)
fsn = 0;
else
fsn = ntohl(nch->dp.ppid_fsn.fsn);
- old_data = 0;
} else {
ch = (struct sctp_data_chunk *)sctp_m_getptr(*m, offset,
sizeof(struct sctp_data_chunk), (uint8_t *) & chunk_buf);
tsn = ntohl(ch->dp.tsn);
- protocol_id = ch->dp.protocol_id;
+ ppid = ch->dp.ppid;
clen = sizeof(struct sctp_data_chunk);
fsn = tsn;
- msg_id = (uint32_t) (ntohs(ch->dp.stream_sequence));
+ mid = (uint32_t) (ntohs(ch->dp.ssn));
nch = NULL;
- old_data = 1;
}
chunk_flags = ch->ch.chunk_flags;
if ((size_t)chk_length == clen) {
@@ -1685,9 +1690,9 @@ sctp_process_a_data_chunk(struct sctp_tcb *stcb, struct sctp_association *asoc,
*/
/* Is the stream valid? */
- strmno = ntohs(ch->dp.stream_id);
+ sid = ntohs(ch->dp.sid);
- if (strmno >= asoc->streamincnt) {
+ if (sid >= asoc->streamincnt) {
struct sctp_error_invalid_stream *cause;
op_err = sctp_get_mbuf_for_msg(sizeof(struct sctp_error_invalid_stream),
@@ -1704,7 +1709,7 @@ sctp_process_a_data_chunk(struct sctp_tcb *stcb, struct sctp_association *asoc,
SCTP_BUF_LEN(op_err) = sizeof(struct sctp_error_invalid_stream);
cause->cause.code = htons(SCTP_CAUSE_INVALID_STREAM);
cause->cause.length = htons(sizeof(struct sctp_error_invalid_stream));
- cause->stream_id = ch->dp.stream_id;
+ cause->stream_id = ch->dp.sid;
cause->reserved = htons(0);
sctp_queue_op_err(stcb, op_err);
}
@@ -1720,7 +1725,7 @@ sctp_process_a_data_chunk(struct sctp_tcb *stcb, struct sctp_association *asoc,
}
return (0);
}
- strm = &asoc->strmin[strmno];
+ strm = &asoc->strmin[sid];
/*
* If its a fragmented message, lets see if we can find the control
* on the reassembly queues.
@@ -1734,18 +1739,18 @@ sctp_process_a_data_chunk(struct sctp_tcb *stcb, struct sctp_association *asoc,
* wrap around. Ignore is for now.
*/
snprintf(msg, sizeof(msg), "FSN zero for MID=%8.8x, but flags=%2.2x",
- msg_id, chunk_flags);
+ mid, chunk_flags);
goto err_out;
}
- control = sctp_find_reasm_entry(strm, msg_id, ordered, old_data);
+ control = sctp_find_reasm_entry(strm, mid, ordered, asoc->idata_supported);
SCTPDBG(SCTP_DEBUG_XXX, "chunk_flags:0x%x look for control on queues %p\n",
chunk_flags, control);
if ((chunk_flags & SCTP_DATA_NOT_FRAG) != SCTP_DATA_NOT_FRAG) {
/* See if we can find the re-assembly entity */
if (control != NULL) {
/* We found something, does it belong? */
- if (ordered && (msg_id != control->sinfo_ssn)) {
- snprintf(msg, sizeof(msg), "Reassembly problem (MID=%8.8x)", msg_id);
+ if (ordered && (mid != control->mid)) {
+ snprintf(msg, sizeof(msg), "Reassembly problem (MID=%8.8x)", mid);
err_out:
op_err = sctp_generate_cause(SCTP_CAUSE_PROTOCOL_VIOLATION, msg);
stcb->sctp_ep->last_abort_code = SCTP_FROM_SCTP_INDATA + SCTP_LOC_15;
@@ -1775,10 +1780,10 @@ sctp_process_a_data_chunk(struct sctp_tcb *stcb, struct sctp_association *asoc,
* ordered) or in the same Stream for unordered.
*/
if (control != NULL) {
- if (ordered || (old_data == 0)) {
- SCTPDBG(SCTP_DEBUG_XXX, "chunk_flags: 0x%x dup detected on msg_id: %u\n",
- chunk_flags, msg_id);
- snprintf(msg, sizeof(msg), "Duplicate MID=%8.8x detected.", msg_id);
+ if (ordered || asoc->idata_supported) {
+ SCTPDBG(SCTP_DEBUG_XXX, "chunk_flags: 0x%x dup detected on MID: %u\n",
+ chunk_flags, mid);
+ snprintf(msg, sizeof(msg), "Duplicate MID=%8.8x detected.", mid);
goto err_out;
} else {
if ((tsn == control->fsn_included + 1) &&
@@ -1855,8 +1860,8 @@ sctp_process_a_data_chunk(struct sctp_tcb *stcb, struct sctp_association *asoc,
asoc->tsn_in_wrapped = 1;
}
asoc->in_tsnlog[asoc->tsn_in_at].tsn = tsn;
- asoc->in_tsnlog[asoc->tsn_in_at].strm = strmno;
- asoc->in_tsnlog[asoc->tsn_in_at].seq = msg_id;
+ asoc->in_tsnlog[asoc->tsn_in_at].strm = sid;
+ asoc->in_tsnlog[asoc->tsn_in_at].seq = mid;
asoc->in_tsnlog[asoc->tsn_in_at].sz = chk_length;
asoc->in_tsnlog[asoc->tsn_in_at].flgs = chunk_flags;
asoc->in_tsnlog[asoc->tsn_in_at].stcb = (void *)stcb;
@@ -1874,14 +1879,24 @@ sctp_process_a_data_chunk(struct sctp_tcb *stcb, struct sctp_association *asoc,
if ((chunk_flags & SCTP_DATA_FIRST_FRAG) &&
(TAILQ_EMPTY(&asoc->resetHead)) &&
(chunk_flags & SCTP_DATA_UNORDERED) == 0 &&
- SCTP_MSGID_GE(old_data, asoc->strmin[strmno].last_sequence_delivered, msg_id)) {
+ SCTP_MID_GE(asoc->idata_supported, asoc->strmin[sid].last_mid_delivered, mid)) {
/* The incoming sseq is behind where we last delivered? */
SCTPDBG(SCTP_DEBUG_INDATA1, "EVIL/Broken-Dup S-SEQ: %u delivered: %u from peer, Abort!\n",
- msg_id, asoc->strmin[strmno].last_sequence_delivered);
+ mid, asoc->strmin[sid].last_mid_delivered);
- snprintf(msg, sizeof(msg), "Delivered SSN=%4.4x, got TSN=%8.8x, SID=%4.4x, SSN=%4.4x",
- asoc->strmin[strmno].last_sequence_delivered,
- tsn, strmno, msg_id);
+ if (asoc->idata_supported) {
+ snprintf(msg, sizeof(msg), "Delivered MID=%8.8x, got TSN=%8.8x, SID=%4.4x, MID=%8.8x",
+ asoc->strmin[sid].last_mid_delivered,
+ tsn,
+ sid,
+ mid);
+ } else {
+ snprintf(msg, sizeof(msg), "Delivered SSN=%4.4x, got TSN=%8.8x, SID=%4.4x, SSN=%4.4x",
+ (uint16_t) asoc->strmin[sid].last_mid_delivered,
+ tsn,
+ sid,
+ (uint16_t) mid);
+ }
op_err = sctp_generate_cause(SCTP_CAUSE_PROTOCOL_VIOLATION, msg);
stcb->sctp_ep->last_abort_code = SCTP_FROM_SCTP_INDATA + SCTP_LOC_16;
sctp_abort_an_association(stcb->sctp_ep, stcb, op_err, SCTP_SO_NOT_LOCKED);
@@ -1954,10 +1969,10 @@ sctp_process_a_data_chunk(struct sctp_tcb *stcb, struct sctp_association *asoc,
if (control == NULL) {
sctp_alloc_a_readq(stcb, control);
sctp_build_readq_entry_mac(control, stcb, asoc->context, net, tsn,
- protocol_id,
- strmno, msg_id,
+ ppid,
+ sid,
chunk_flags,
- NULL, fsn, msg_id);
+ NULL, fsn, mid);
if (control == NULL) {
SCTP_STAT_INCR(sctps_nomem);
return (0);
@@ -1970,13 +1985,13 @@ sctp_process_a_data_chunk(struct sctp_tcb *stcb, struct sctp_association *asoc,
}
created_control = 1;
}
- SCTPDBG(SCTP_DEBUG_XXX, "chunk_flags: 0x%x ordered: %d msgid: %u control: %p\n",
- chunk_flags, ordered, msg_id, control);
+ SCTPDBG(SCTP_DEBUG_XXX, "chunk_flags: 0x%x ordered: %d MID: %u control: %p\n",
+ chunk_flags, ordered, mid, control);
if ((chunk_flags & SCTP_DATA_NOT_FRAG) == SCTP_DATA_NOT_FRAG &&
TAILQ_EMPTY(&asoc->resetHead) &&
((ordered == 0) ||
- ((uint16_t) (asoc->strmin[strmno].last_sequence_delivered + 1) == msg_id &&
- TAILQ_EMPTY(&asoc->strmin[strmno].inqueue)))) {
+ (SCTP_MID_EQ(asoc->idata_supported, asoc->strmin[sid].last_mid_delivered + 1, mid) &&
+ TAILQ_EMPTY(&asoc->strmin[sid].inqueue)))) {
/* Candidate for express delivery */
/*
* Its not fragmented, No PD-API is up, Nothing in the
@@ -1989,8 +2004,8 @@ sctp_process_a_data_chunk(struct sctp_tcb *stcb, struct sctp_association *asoc,
if (SCTP_TSN_GT(tsn, asoc->highest_tsn_inside_nr_map)) {
asoc->highest_tsn_inside_nr_map = tsn;
}
- SCTPDBG(SCTP_DEBUG_XXX, "Injecting control: %p to be read (msg_id: %u)\n",
- control, msg_id);
+ SCTPDBG(SCTP_DEBUG_XXX, "Injecting control: %p to be read (MID: %u)\n",
+ control, mid);
sctp_add_to_readq(stcb->sctp_ep, stcb,
control, &stcb->sctp_socket->so_rcv,
@@ -1998,11 +2013,11 @@ sctp_process_a_data_chunk(struct sctp_tcb *stcb, struct sctp_association *asoc,
if ((chunk_flags & SCTP_DATA_UNORDERED) == 0) {
/* for ordered, bump what we delivered */
- strm->last_sequence_delivered++;
+ strm->last_mid_delivered++;
}
SCTP_STAT_INCR(sctps_recvexpress);
if (SCTP_BASE_SYSCTL(sctp_logging_level) & SCTP_STR_LOGGING_ENABLE) {
- sctp_log_strm_del_alt(stcb, tsn, msg_id, strmno,
+ sctp_log_strm_del_alt(stcb, tsn, mid, sid,
SCTP_STR_LOG_FROM_EXPRS_DEL);
}
control = NULL;
@@ -2020,21 +2035,21 @@ sctp_process_a_data_chunk(struct sctp_tcb *stcb, struct sctp_association *asoc,
}
return (0);
}
- chk->rec.data.TSN_seq = tsn;
+ chk->rec.data.tsn = tsn;
chk->no_fr_allowed = 0;
- chk->rec.data.fsn_num = fsn;
- chk->rec.data.stream_seq = msg_id;
- chk->rec.data.stream_number = strmno;
- chk->rec.data.payloadtype = protocol_id;
+ chk->rec.data.fsn = fsn;
+ chk->rec.data.mid = mid;
+ chk->rec.data.sid = sid;
+ chk->rec.data.ppid = ppid;
chk->rec.data.context = stcb->asoc.context;
chk->rec.data.doing_fast_retransmit = 0;
chk->rec.data.rcv_flags = chunk_flags;
chk->asoc = asoc;
chk->send_size = the_len;
chk->whoTo = net;
- SCTPDBG(SCTP_DEBUG_XXX, "Building ck: %p for control: %p to be read (msg_id: %u)\n",
+ SCTPDBG(SCTP_DEBUG_XXX, "Building ck: %p for control: %p to be read (MID: %u)\n",
chk,
- control, msg_id);
+ control, mid);
atomic_add_int(&net->ref_count, 1);
chk->data = dmbuf;
}
@@ -2097,8 +2112,8 @@ sctp_process_a_data_chunk(struct sctp_tcb *stcb, struct sctp_association *asoc,
}
if (chunk_flags & SCTP_DATA_UNORDERED) {
/* queue directly into socket buffer */
- SCTPDBG(SCTP_DEBUG_XXX, "Unordered data to be read control: %p msg_id: %u\n",
- control, msg_id);
+ SCTPDBG(SCTP_DEBUG_XXX, "Unordered data to be read control: %p MID: %u\n",
+ control, mid);
sctp_mark_non_revokable(asoc, control->sinfo_tsn);
sctp_add_to_readq(stcb->sctp_ep, stcb,
control,
@@ -2106,8 +2121,8 @@ sctp_process_a_data_chunk(struct sctp_tcb *stcb, struct sctp_association *asoc,
SCTP_READ_LOCK_NOT_HELD, SCTP_SO_NOT_LOCKED);
} else {
- SCTPDBG(SCTP_DEBUG_XXX, "Queue control: %p for reordering msg_id: %u\n", control,
- msg_id);
+ SCTPDBG(SCTP_DEBUG_XXX, "Queue control: %p for reordering MID: %u\n", control,
+ mid);
sctp_queue_data_to_stream(stcb, strm, asoc, control, abort_flag, &need_reasm_check);
if (*abort_flag) {
if (last_chunk) {
@@ -2121,8 +2136,8 @@ sctp_process_a_data_chunk(struct sctp_tcb *stcb, struct sctp_association *asoc,
/* If we reach here its a reassembly */
need_reasm_check = 1;
SCTPDBG(SCTP_DEBUG_XXX,
- "Queue data to stream for reasm control: %p msg_id: %u\n",
- control, msg_id);
+ "Queue data to stream for reasm control: %p MID: %u\n",
+ control, mid);
sctp_queue_data_for_reasm(stcb, asoc, strm, control, chk, created_control, abort_flag, tsn);
if (*abort_flag) {
/*
@@ -2151,7 +2166,7 @@ finish_express_del:
SCTP_STAT_INCR(sctps_recvdata);
/* Set it present please */
if (SCTP_BASE_SYSCTL(sctp_logging_level) & SCTP_STR_LOGGING_ENABLE) {
- sctp_log_strm_del_alt(stcb, tsn, msg_id, strmno, SCTP_STR_LOG_FROM_MARK_TSN);
+ sctp_log_strm_del_alt(stcb, tsn, mid, sid, SCTP_STR_LOG_FROM_MARK_TSN);
}
if (SCTP_BASE_SYSCTL(sctp_logging_level) & SCTP_MAP_LOGGING_ENABLE) {
sctp_log_map(asoc->mapping_array_base_tsn, asoc->cumulative_tsn,
@@ -2813,16 +2828,16 @@ sctp_process_segment_range(struct sctp_tcb *stcb, struct sctp_tmit_chunk **p_tp1
if ((tp1->sent < SCTP_DATAGRAM_RESEND) &&
(tp1->whoTo->find_pseudo_cumack == 1) &&
(tp1->snd_count == 1)) {
- tp1->whoTo->pseudo_cumack = tp1->rec.data.TSN_seq;
+ tp1->whoTo->pseudo_cumack = tp1->rec.data.tsn;
tp1->whoTo->find_pseudo_cumack = 0;
}
if ((tp1->sent < SCTP_DATAGRAM_RESEND) &&
(tp1->whoTo->find_rtx_pseudo_cumack == 1) &&
(tp1->snd_count > 1)) {
- tp1->whoTo->rtx_pseudo_cumack = tp1->rec.data.TSN_seq;
+ tp1->whoTo->rtx_pseudo_cumack = tp1->rec.data.tsn;
tp1->whoTo->find_rtx_pseudo_cumack = 0;
}
- if (tp1->rec.data.TSN_seq == theTSN) {
+ if (tp1->rec.data.tsn == theTSN) {
if (tp1->sent != SCTP_DATAGRAM_UNSENT) {
/*-
* must be held until
@@ -2836,9 +2851,9 @@ sctp_process_segment_range(struct sctp_tcb *stcb, struct sctp_tmit_chunk **p_tp1
* via previous Gap Ack Blocks...
* i.e. ACKED or RESEND.
*/
- if (SCTP_TSN_GT(tp1->rec.data.TSN_seq,
+ if (SCTP_TSN_GT(tp1->rec.data.tsn,
*biggest_newly_acked_tsn)) {
- *biggest_newly_acked_tsn = tp1->rec.data.TSN_seq;
+ *biggest_newly_acked_tsn = tp1->rec.data.tsn;
}
/*-
* CMT: SFR algo (and HTNA) - set
@@ -2850,10 +2865,10 @@ sctp_process_segment_range(struct sctp_tcb *stcb, struct sctp_tmit_chunk **p_tp1
if (tp1->rec.data.chunk_was_revoked == 0)
tp1->whoTo->saw_newack = 1;
- if (SCTP_TSN_GT(tp1->rec.data.TSN_seq,
+ if (SCTP_TSN_GT(tp1->rec.data.tsn,
tp1->whoTo->this_sack_highest_newack)) {
tp1->whoTo->this_sack_highest_newack =
- tp1->rec.data.TSN_seq;
+ tp1->rec.data.tsn;
}
/*-
* CMT DAC algo: also update
@@ -2863,12 +2878,12 @@ sctp_process_segment_range(struct sctp_tcb *stcb, struct sctp_tmit_chunk **p_tp1
if (SCTP_BASE_SYSCTL(sctp_logging_level) & SCTP_SACK_LOGGING_ENABLE) {
sctp_log_sack(*this_sack_lowest_newack,
last_tsn,
- tp1->rec.data.TSN_seq,
+ tp1->rec.data.tsn,
0,
0,
SCTP_LOG_TSN_ACKED);
}
- *this_sack_lowest_newack = tp1->rec.data.TSN_seq;
+ *this_sack_lowest_newack = tp1->rec.data.tsn;
}
/*-
* CMT: CUCv2 algorithm. If (rtx-)pseudo-cumack for corresp
@@ -2878,16 +2893,16 @@ sctp_process_segment_range(struct sctp_tcb *stcb, struct sctp_tmit_chunk **p_tp1
* Separate pseudo_cumack trackers for first transmissions and
* retransmissions.
*/
- if (tp1->rec.data.TSN_seq == tp1->whoTo->pseudo_cumack) {
+ if (tp1->rec.data.tsn == tp1->whoTo->pseudo_cumack) {
if (tp1->rec.data.chunk_was_revoked == 0) {
tp1->whoTo->new_pseudo_cumack = 1;
}
tp1->whoTo->find_pseudo_cumack = 1;
}
if (SCTP_BASE_SYSCTL(sctp_logging_level) & SCTP_CWND_LOGGING_ENABLE) {
- sctp_log_cwnd(stcb, tp1->whoTo, tp1->rec.data.TSN_seq, SCTP_CWND_LOG_FROM_SACK);
+ sctp_log_cwnd(stcb, tp1->whoTo, tp1->rec.data.tsn, SCTP_CWND_LOG_FROM_SACK);
}
- if (tp1->rec.data.TSN_seq == tp1->whoTo->rtx_pseudo_cumack) {
+ if (tp1->rec.data.tsn == tp1->whoTo->rtx_pseudo_cumack) {
if (tp1->rec.data.chunk_was_revoked == 0) {
tp1->whoTo->new_pseudo_cumack = 1;
}
@@ -2896,7 +2911,7 @@ sctp_process_segment_range(struct sctp_tcb *stcb, struct sctp_tmit_chunk **p_tp1
if (SCTP_BASE_SYSCTL(sctp_logging_level) & SCTP_SACK_LOGGING_ENABLE) {
sctp_log_sack(*biggest_newly_acked_tsn,
last_tsn,
- tp1->rec.data.TSN_seq,
+ tp1->rec.data.tsn,
frag_strt,
frag_end,
SCTP_LOG_TSN_ACKED);
@@ -2906,7 +2921,7 @@ sctp_process_segment_range(struct sctp_tcb *stcb, struct sctp_tmit_chunk **p_tp1
tp1->whoTo->flight_size,
tp1->book_size,
(uint32_t) (uintptr_t) tp1->whoTo,
- tp1->rec.data.TSN_seq);
+ tp1->rec.data.tsn);
}
sctp_flight_size_decrease(tp1);
if (stcb->asoc.cc_functions.sctp_cwnd_update_tsn_acknowledged) {
@@ -2944,10 +2959,10 @@ sctp_process_segment_range(struct sctp_tcb *stcb, struct sctp_tmit_chunk **p_tp1
}
}
if (tp1->sent <= SCTP_DATAGRAM_RESEND) {
- if (SCTP_TSN_GT(tp1->rec.data.TSN_seq,
+ if (SCTP_TSN_GT(tp1->rec.data.tsn,
stcb->asoc.this_sack_highest_gap)) {
stcb->asoc.this_sack_highest_gap =
- tp1->rec.data.TSN_seq;
+ tp1->rec.data.tsn;
}
if (tp1->sent == SCTP_DATAGRAM_RESEND) {
sctp_ucount_decr(stcb->asoc.sent_queue_retran_cnt);
@@ -2973,16 +2988,16 @@ sctp_process_segment_range(struct sctp_tcb *stcb, struct sctp_tmit_chunk **p_tp1
/* NR Sack code here */
if (nr_sacking &&
(tp1->sent != SCTP_DATAGRAM_NR_ACKED)) {
- if (stcb->asoc.strmout[tp1->rec.data.stream_number].chunks_on_queues > 0) {
- stcb->asoc.strmout[tp1->rec.data.stream_number].chunks_on_queues--;
+ if (stcb->asoc.strmout[tp1->rec.data.sid].chunks_on_queues > 0) {
+ stcb->asoc.strmout[tp1->rec.data.sid].chunks_on_queues--;
#ifdef INVARIANTS
} else {
- panic("No chunks on the queues for sid %u.", tp1->rec.data.stream_number);
+ panic("No chunks on the queues for sid %u.", tp1->rec.data.sid);
#endif
}
- if ((stcb->asoc.strmout[tp1->rec.data.stream_number].chunks_on_queues == 0) &&
- (stcb->asoc.strmout[tp1->rec.data.stream_number].state == SCTP_STREAM_RESET_PENDING) &&
- TAILQ_EMPTY(&stcb->asoc.strmout[tp1->rec.data.stream_number].outqueue)) {
+ if ((stcb->asoc.strmout[tp1->rec.data.sid].chunks_on_queues == 0) &&
+ (stcb->asoc.strmout[tp1->rec.data.sid].state == SCTP_STREAM_RESET_PENDING) &&
+ TAILQ_EMPTY(&stcb->asoc.strmout[tp1->rec.data.sid].outqueue)) {
stcb->asoc.trigger_reset = 1;
}
tp1->sent = SCTP_DATAGRAM_NR_ACKED;
@@ -2997,7 +3012,7 @@ sctp_process_segment_range(struct sctp_tcb *stcb, struct sctp_tmit_chunk **p_tp1
}
}
break;
- } /* if (tp1->TSN_seq == theTSN) */ if (SCTP_TSN_GT(tp1->rec.data.TSN_seq, theTSN)) {
+ } /* if (tp1->tsn == theTSN) */ if (SCTP_TSN_GT(tp1->rec.data.tsn, theTSN)) {
break;
}
tp1 = TAILQ_NEXT(tp1, sctp_next);
@@ -3089,14 +3104,14 @@ sctp_check_for_revoked(struct sctp_tcb *stcb,
struct sctp_tmit_chunk *tp1;
TAILQ_FOREACH(tp1, &asoc->sent_queue, sctp_next) {
- if (SCTP_TSN_GT(tp1->rec.data.TSN_seq, cumack)) {
+ if (SCTP_TSN_GT(tp1->rec.data.tsn, cumack)) {
/*
* ok this guy is either ACK or MARKED. If it is
* ACKED it has been previously acked but not this
* time i.e. revoked. If it is MARKED it was ACK'ed
* again.
*/
- if (SCTP_TSN_GT(tp1->rec.data.TSN_seq, biggest_tsn_acked)) {
+ if (SCTP_TSN_GT(tp1->rec.data.tsn, biggest_tsn_acked)) {
break;
}
if (tp1->sent == SCTP_DATAGRAM_ACKED) {
@@ -3112,7 +3127,7 @@ sctp_check_for_revoked(struct sctp_tcb *stcb,
tp1->whoTo->flight_size,
tp1->book_size,
(uint32_t) (uintptr_t) tp1->whoTo,
- tp1->rec.data.TSN_seq);
+ tp1->rec.data.tsn);
}
sctp_flight_size_increase(tp1);
sctp_total_flight_increase(stcb, tp1);
@@ -3124,7 +3139,7 @@ sctp_check_for_revoked(struct sctp_tcb *stcb,
if (SCTP_BASE_SYSCTL(sctp_logging_level) & SCTP_SACK_LOGGING_ENABLE) {
sctp_log_sack(asoc->last_acked_seq,
cumack,
- tp1->rec.data.TSN_seq,
+ tp1->rec.data.tsn,
0,
0,
SCTP_LOG_TSN_REVOKED);
@@ -3160,7 +3175,7 @@ sctp_strike_gap_ack_chunks(struct sctp_tcb *stcb, struct sctp_association *asoc,
if (tp1 == NULL) {
sending_seq = asoc->sending_seq;
} else {
- sending_seq = tp1->rec.data.TSN_seq;
+ sending_seq = tp1->rec.data.tsn;
}
/* CMT DAC algo: finding out if SACK is a mixed SACK */
@@ -3183,11 +3198,11 @@ sctp_strike_gap_ack_chunks(struct sctp_tcb *stcb, struct sctp_association *asoc,
if (SCTP_BASE_SYSCTL(sctp_logging_level) & SCTP_FR_LOGGING_ENABLE) {
if (tp1->sent < SCTP_DATAGRAM_RESEND)
sctp_log_fr(biggest_tsn_newly_acked,
- tp1->rec.data.TSN_seq,
+ tp1->rec.data.tsn,
tp1->sent,
SCTP_FR_LOG_CHECK_STRIKE);
}
- if (SCTP_TSN_GT(tp1->rec.data.TSN_seq, biggest_tsn_acked) ||
+ if (SCTP_TSN_GT(tp1->rec.data.tsn, biggest_tsn_acked) ||
tp1->sent == SCTP_DATAGRAM_UNSENT) {
/* done */
break;
@@ -3205,7 +3220,7 @@ sctp_strike_gap_ack_chunks(struct sctp_tcb *stcb, struct sctp_association *asoc,
}
}
}
- if (SCTP_TSN_GT(tp1->rec.data.TSN_seq, asoc->this_sack_highest_gap)) {
+ if (SCTP_TSN_GT(tp1->rec.data.tsn, asoc->this_sack_highest_gap)) {
/* we are beyond the tsn in the sack */
break;
}
@@ -3229,7 +3244,7 @@ sctp_strike_gap_ack_chunks(struct sctp_tcb *stcb, struct sctp_association *asoc,
* FR using this SACK.
*/
continue;
- } else if (tp1->whoTo && SCTP_TSN_GT(tp1->rec.data.TSN_seq,
+ } else if (tp1->whoTo && SCTP_TSN_GT(tp1->rec.data.tsn,
tp1->whoTo->this_sack_highest_newack)) {
/*
* CMT: New acks were receieved for data sent to
@@ -3259,7 +3274,7 @@ sctp_strike_gap_ack_chunks(struct sctp_tcb *stcb, struct sctp_association *asoc,
*/
if (SCTP_BASE_SYSCTL(sctp_logging_level) & SCTP_FR_LOGGING_ENABLE) {
sctp_log_fr(biggest_tsn_newly_acked,
- tp1->rec.data.TSN_seq,
+ tp1->rec.data.tsn,
tp1->sent,
SCTP_FR_LOG_STRIKE_CHUNK);
}
@@ -3281,10 +3296,10 @@ sctp_strike_gap_ack_chunks(struct sctp_tcb *stcb, struct sctp_association *asoc,
* received after this missing TSN.
*/
if ((tp1->sent < SCTP_DATAGRAM_RESEND) && (num_dests_sacked == 1) &&
- SCTP_TSN_GT(this_sack_lowest_newack, tp1->rec.data.TSN_seq)) {
+ SCTP_TSN_GT(this_sack_lowest_newack, tp1->rec.data.tsn)) {
if (SCTP_BASE_SYSCTL(sctp_logging_level) & SCTP_FR_LOGGING_ENABLE) {
sctp_log_fr(16 + num_dests_sacked,
- tp1->rec.data.TSN_seq,
+ tp1->rec.data.tsn,
tp1->sent,
SCTP_FR_LOG_STRIKE_CHUNK);
}
@@ -3322,7 +3337,7 @@ sctp_strike_gap_ack_chunks(struct sctp_tcb *stcb, struct sctp_association *asoc,
*/
if (SCTP_BASE_SYSCTL(sctp_logging_level) & SCTP_FR_LOGGING_ENABLE) {
sctp_log_fr(biggest_tsn_newly_acked,
- tp1->rec.data.TSN_seq,
+ tp1->rec.data.tsn,
tp1->sent,
SCTP_FR_LOG_STRIKE_CHUNK);
}
@@ -3354,10 +3369,10 @@ sctp_strike_gap_ack_chunks(struct sctp_tcb *stcb, struct sctp_association *asoc,
if ((tp1->sent < SCTP_DATAGRAM_RESEND) &&
(num_dests_sacked == 1) &&
SCTP_TSN_GT(this_sack_lowest_newack,
- tp1->rec.data.TSN_seq)) {
+ tp1->rec.data.tsn)) {
if (SCTP_BASE_SYSCTL(sctp_logging_level) & SCTP_FR_LOGGING_ENABLE) {
sctp_log_fr(32 + num_dests_sacked,
- tp1->rec.data.TSN_seq,
+ tp1->rec.data.tsn,
tp1->sent,
SCTP_FR_LOG_STRIKE_CHUNK);
}
@@ -3372,7 +3387,7 @@ sctp_strike_gap_ack_chunks(struct sctp_tcb *stcb, struct sctp_association *asoc,
* JRI: TODO: remove code for HTNA algo. CMT's SFR
* algo covers HTNA.
*/
- } else if (SCTP_TSN_GT(tp1->rec.data.TSN_seq,
+ } else if (SCTP_TSN_GT(tp1->rec.data.tsn,
biggest_tsn_newly_acked)) {
/*
* We don't strike these: This is the HTNA
@@ -3384,7 +3399,7 @@ sctp_strike_gap_ack_chunks(struct sctp_tcb *stcb, struct sctp_association *asoc,
/* Strike the TSN */
if (SCTP_BASE_SYSCTL(sctp_logging_level) & SCTP_FR_LOGGING_ENABLE) {
sctp_log_fr(biggest_tsn_newly_acked,
- tp1->rec.data.TSN_seq,
+ tp1->rec.data.tsn,
tp1->sent,
SCTP_FR_LOG_STRIKE_CHUNK);
}
@@ -3406,10 +3421,10 @@ sctp_strike_gap_ack_chunks(struct sctp_tcb *stcb, struct sctp_association *asoc,
* received after this missing TSN.
*/
if ((tp1->sent < SCTP_DATAGRAM_RESEND) && (num_dests_sacked == 1) &&
- SCTP_TSN_GT(this_sack_lowest_newack, tp1->rec.data.TSN_seq)) {
+ SCTP_TSN_GT(this_sack_lowest_newack, tp1->rec.data.tsn)) {
if (SCTP_BASE_SYSCTL(sctp_logging_level) & SCTP_FR_LOGGING_ENABLE) {
sctp_log_fr(48 + num_dests_sacked,
- tp1->rec.data.TSN_seq,
+ tp1->rec.data.tsn,
tp1->sent,
SCTP_FR_LOG_STRIKE_CHUNK);
}
@@ -3426,7 +3441,7 @@ sctp_strike_gap_ack_chunks(struct sctp_tcb *stcb, struct sctp_association *asoc,
(tp1->whoTo ? (tp1->whoTo->flight_size) : 0),
tp1->book_size,
(uint32_t) (uintptr_t) tp1->whoTo,
- tp1->rec.data.TSN_seq);
+ tp1->rec.data.tsn);
}
if (tp1->whoTo) {
tp1->whoTo->net_ack++;
@@ -3464,7 +3479,7 @@ sctp_strike_gap_ack_chunks(struct sctp_tcb *stcb, struct sctp_association *asoc,
/* SCTP_PRINTF("OK, we are now ready to FR this
* guy\n"); */
if (SCTP_BASE_SYSCTL(sctp_logging_level) & SCTP_FR_LOGGING_ENABLE) {
- sctp_log_fr(tp1->rec.data.TSN_seq, tp1->snd_count,
+ sctp_log_fr(tp1->rec.data.tsn, tp1->snd_count,
0, SCTP_FR_MARKED);
}
if (strike_flag) {
@@ -3527,7 +3542,7 @@ sctp_strike_gap_ack_chunks(struct sctp_tcb *stcb, struct sctp_association *asoc,
/* mark the sending seq for possible subsequent FR's */
/*
* SCTP_PRINTF("Marking TSN for FR new value %x\n",
- * (uint32_t)tpi->rec.data.TSN_seq);
+ * (uint32_t)tpi->rec.data.tsn);
*/
if (TAILQ_EMPTY(&asoc->send_queue)) {
/*
@@ -3550,7 +3565,7 @@ sctp_strike_gap_ack_chunks(struct sctp_tcb *stcb, struct sctp_association *asoc,
ttt = TAILQ_FIRST(&asoc->send_queue);
tp1->rec.data.fast_retran_tsn =
- ttt->rec.data.TSN_seq;
+ ttt->rec.data.tsn;
}
if (tp1->do_rtt) {
@@ -3598,7 +3613,7 @@ sctp_try_advance_peer_ack_point(struct sctp_tcb *stcb,
(tp1->sent == SCTP_DATAGRAM_NR_ACKED)) {
sctp_misc_ints(SCTP_FWD_TSN_CHECK,
asoc->advanced_peer_ack_point,
- tp1->rec.data.TSN_seq, 0, 0);
+ tp1->rec.data.tsn, 0, 0);
}
}
if (!PR_SCTP_ENABLED(tp1->flags)) {
@@ -3646,10 +3661,10 @@ sctp_try_advance_peer_ack_point(struct sctp_tcb *stcb,
if ((tp1->sent == SCTP_FORWARD_TSN_SKIP) ||
(tp1->sent == SCTP_DATAGRAM_NR_ACKED)) {
/* advance PeerAckPoint goes forward */
- if (SCTP_TSN_GT(tp1->rec.data.TSN_seq, asoc->advanced_peer_ack_point)) {
- asoc->advanced_peer_ack_point = tp1->rec.data.TSN_seq;
+ if (SCTP_TSN_GT(tp1->rec.data.tsn, asoc->advanced_peer_ack_point)) {
+ asoc->advanced_peer_ack_point = tp1->rec.data.tsn;
a_adv = tp1;
- } else if (tp1->rec.data.TSN_seq == asoc->advanced_peer_ack_point) {
+ } else if (tp1->rec.data.tsn == asoc->advanced_peer_ack_point) {
/* No update but we do save the chk */
a_adv = tp1;
}
@@ -3685,7 +3700,7 @@ sctp_fs_audit(struct sctp_association *asoc)
TAILQ_FOREACH(chk, &asoc->sent_queue, sctp_next) {
if (chk->sent < SCTP_DATAGRAM_RESEND) {
SCTP_PRINTF("Chk TSN: %u size: %d inflight cnt: %d\n",
- chk->rec.data.TSN_seq,
+ chk->rec.data.tsn,
chk->send_size,
chk->snd_count);
inflight++;
@@ -3728,7 +3743,7 @@ sctp_window_probe_recovery(struct sctp_tcb *stcb,
tp1->whoTo ? tp1->whoTo->flight_size : 0,
tp1->book_size,
(uint32_t) (uintptr_t) tp1->whoTo,
- tp1->rec.data.TSN_seq);
+ tp1->rec.data.tsn);
return;
}
/* First setup this by shrinking flight */
@@ -3747,7 +3762,7 @@ sctp_window_probe_recovery(struct sctp_tcb *stcb,
tp1->whoTo->flight_size,
tp1->book_size,
(uint32_t) (uintptr_t) tp1->whoTo,
- tp1->rec.data.TSN_seq);
+ tp1->rec.data.tsn);
}
}
@@ -3818,7 +3833,7 @@ sctp_express_handle_sack(struct sctp_tcb *stcb, uint32_t cumack,
if (!TAILQ_EMPTY(&asoc->sent_queue)) {
tp1 = TAILQ_LAST(&asoc->sent_queue,
sctpchunk_listhead);
- send_s = tp1->rec.data.TSN_seq + 1;
+ send_s = tp1->rec.data.tsn + 1;
} else {
send_s = asoc->sending_seq;
}
@@ -3847,7 +3862,7 @@ sctp_express_handle_sack(struct sctp_tcb *stcb, uint32_t cumack,
if (SCTP_TSN_GT(cumack, asoc->last_acked_seq)) {
/* process the new consecutive TSN first */
TAILQ_FOREACH_SAFE(tp1, &asoc->sent_queue, sctp_next, tp2) {
- if (SCTP_TSN_GE(cumack, tp1->rec.data.TSN_seq)) {
+ if (SCTP_TSN_GE(cumack, tp1->rec.data.tsn)) {
if (tp1->sent == SCTP_DATAGRAM_UNSENT) {
SCTP_PRINTF("Warning, an unsent is now acked?\n");
}
@@ -3863,7 +3878,7 @@ sctp_express_handle_sack(struct sctp_tcb *stcb, uint32_t cumack,
tp1->whoTo->flight_size,
tp1->book_size,
(uint32_t) (uintptr_t) tp1->whoTo,
- tp1->rec.data.TSN_seq);
+ tp1->rec.data.tsn);
}
sctp_flight_size_decrease(tp1);
if (stcb->asoc.cc_functions.sctp_cwnd_update_tsn_acknowledged) {
@@ -3921,7 +3936,7 @@ sctp_express_handle_sack(struct sctp_tcb *stcb, uint32_t cumack,
if (SCTP_BASE_SYSCTL(sctp_logging_level) & SCTP_CWND_LOGGING_ENABLE) {
/* sa_ignore NO_NULL_CHK */
- sctp_log_cwnd(stcb, tp1->whoTo, tp1->rec.data.TSN_seq, SCTP_CWND_LOG_FROM_SACK);
+ sctp_log_cwnd(stcb, tp1->whoTo, tp1->rec.data.tsn, SCTP_CWND_LOG_FROM_SACK);
}
}
if (tp1->sent == SCTP_DATAGRAM_RESEND) {
@@ -3933,17 +3948,17 @@ sctp_express_handle_sack(struct sctp_tcb *stcb, uint32_t cumack,
tp1->rec.data.chunk_was_revoked = 0;
}
if (tp1->sent != SCTP_DATAGRAM_NR_ACKED) {
- if (asoc->strmout[tp1->rec.data.stream_number].chunks_on_queues > 0) {
- asoc->strmout[tp1->rec.data.stream_number].chunks_on_queues--;
+ if (asoc->strmout[tp1->rec.data.sid].chunks_on_queues > 0) {
+ asoc->strmout[tp1->rec.data.sid].chunks_on_queues--;
#ifdef INVARIANTS
} else {
- panic("No chunks on the queues for sid %u.", tp1->rec.data.stream_number);
+ panic("No chunks on the queues for sid %u.", tp1->rec.data.sid);
#endif
}
}
- if ((asoc->strmout[tp1->rec.data.stream_number].chunks_on_queues == 0) &&
- (asoc->strmout[tp1->rec.data.stream_number].state == SCTP_STREAM_RESET_PENDING) &&
- TAILQ_EMPTY(&asoc->strmout[tp1->rec.data.stream_number].outqueue)) {
+ if ((asoc->strmout[tp1->rec.data.sid].chunks_on_queues == 0) &&
+ (asoc->strmout[tp1->rec.data.sid].state == SCTP_STREAM_RESET_PENDING) &&
+ TAILQ_EMPTY(&asoc->strmout[tp1->rec.data.sid].outqueue)) {
asoc->trigger_reset = 1;
}
TAILQ_REMOVE(&asoc->sent_queue, tp1, sctp_next);
@@ -3956,7 +3971,7 @@ sctp_express_handle_sack(struct sctp_tcb *stcb, uint32_t cumack,
if (SCTP_BASE_SYSCTL(sctp_logging_level) & SCTP_SACK_LOGGING_ENABLE) {
sctp_log_sack(asoc->last_acked_seq,
cumack,
- tp1->rec.data.TSN_seq,
+ tp1->rec.data.tsn,
0,
0,
SCTP_LOG_FREE_SENT);
@@ -4356,7 +4371,7 @@ sctp_handle_sack(struct mbuf *m, int offset_seg, int offset_dup,
if (!TAILQ_EMPTY(&asoc->sent_queue)) {
tp1 = TAILQ_LAST(&asoc->sent_queue,
sctpchunk_listhead);
- send_s = tp1->rec.data.TSN_seq + 1;
+ send_s = tp1->rec.data.tsn + 1;
} else {
tp1 = NULL;
send_s = asoc->sending_seq;
@@ -4373,7 +4388,7 @@ sctp_handle_sack(struct mbuf *m, int offset_seg, int offset_dup,
cum_ack, send_s);
if (tp1) {
SCTP_PRINTF("Got send_s from tsn:%x + 1 of tp1: %p\n",
- tp1->rec.data.TSN_seq, (void *)tp1);
+ tp1->rec.data.tsn, (void *)tp1);
}
hopeless_peer:
*abort_now = 1;
@@ -4448,7 +4463,7 @@ hopeless_peer:
}
/* process the new consecutive TSN first */
TAILQ_FOREACH(tp1, &asoc->sent_queue, sctp_next) {
- if (SCTP_TSN_GE(last_tsn, tp1->rec.data.TSN_seq)) {
+ if (SCTP_TSN_GE(last_tsn, tp1->rec.data.tsn)) {
if (tp1->sent != SCTP_DATAGRAM_UNSENT) {
accum_moved = 1;
if (tp1->sent < SCTP_DATAGRAM_ACKED) {
@@ -4477,7 +4492,7 @@ hopeless_peer:
tp1->whoTo->flight_size,
tp1->book_size,
(uint32_t) (uintptr_t) tp1->whoTo,
- tp1->rec.data.TSN_seq);
+ tp1->rec.data.tsn);
}
sctp_flight_size_decrease(tp1);
sctp_total_flight_decrease(stcb, tp1);
@@ -4489,7 +4504,7 @@ hopeless_peer:
tp1->whoTo->net_ack += tp1->send_size;
/* CMT SFR and DAC algos */
- this_sack_lowest_newack = tp1->rec.data.TSN_seq;
+ this_sack_lowest_newack = tp1->rec.data.tsn;
tp1->whoTo->saw_newack = 1;
if (tp1->snd_count < 2) {
@@ -4537,13 +4552,13 @@ hopeless_peer:
if (SCTP_BASE_SYSCTL(sctp_logging_level) & SCTP_SACK_LOGGING_ENABLE) {
sctp_log_sack(asoc->last_acked_seq,
cum_ack,
- tp1->rec.data.TSN_seq,
+ tp1->rec.data.tsn,
0,
0,
SCTP_LOG_TSN_ACKED);
}
if (SCTP_BASE_SYSCTL(sctp_logging_level) & SCTP_CWND_LOGGING_ENABLE) {
- sctp_log_cwnd(stcb, tp1->whoTo, tp1->rec.data.TSN_seq, SCTP_CWND_LOG_FROM_SACK);
+ sctp_log_cwnd(stcb, tp1->whoTo, tp1->rec.data.tsn, SCTP_CWND_LOG_FROM_SACK);
}
}
if (tp1->sent == SCTP_DATAGRAM_RESEND) {
@@ -4632,21 +4647,21 @@ hopeless_peer:
asoc->last_acked_seq = cum_ack;
TAILQ_FOREACH_SAFE(tp1, &asoc->sent_queue, sctp_next, tp2) {
- if (SCTP_TSN_GT(tp1->rec.data.TSN_seq, cum_ack)) {
+ if (SCTP_TSN_GT(tp1->rec.data.tsn, cum_ack)) {
break;
}
if (tp1->sent != SCTP_DATAGRAM_NR_ACKED) {
- if (asoc->strmout[tp1->rec.data.stream_number].chunks_on_queues > 0) {
- asoc->strmout[tp1->rec.data.stream_number].chunks_on_queues--;
+ if (asoc->strmout[tp1->rec.data.sid].chunks_on_queues > 0) {
+ asoc->strmout[tp1->rec.data.sid].chunks_on_queues--;
#ifdef INVARIANTS
} else {
- panic("No chunks on the queues for sid %u.", tp1->rec.data.stream_number);
+ panic("No chunks on the queues for sid %u.", tp1->rec.data.sid);
#endif
}
}
- if ((asoc->strmout[tp1->rec.data.stream_number].chunks_on_queues == 0) &&
- (asoc->strmout[tp1->rec.data.stream_number].state == SCTP_STREAM_RESET_PENDING) &&
- TAILQ_EMPTY(&asoc->strmout[tp1->rec.data.stream_number].outqueue)) {
+ if ((asoc->strmout[tp1->rec.data.sid].chunks_on_queues == 0) &&
+ (asoc->strmout[tp1->rec.data.sid].state == SCTP_STREAM_RESET_PENDING) &&
+ TAILQ_EMPTY(&asoc->strmout[tp1->rec.data.sid].outqueue)) {
asoc->trigger_reset = 1;
}
TAILQ_REMOVE(&asoc->sent_queue, tp1, sctp_next);
@@ -4667,7 +4682,7 @@ hopeless_peer:
if (SCTP_BASE_SYSCTL(sctp_logging_level) & SCTP_SACK_LOGGING_ENABLE) {
sctp_log_sack(asoc->last_acked_seq,
cum_ack,
- tp1->rec.data.TSN_seq,
+ tp1->rec.data.tsn,
0,
0,
SCTP_LOG_FREE_SENT);
@@ -4748,7 +4763,7 @@ hopeless_peer:
tp1->whoTo->flight_size,
tp1->book_size,
(uint32_t) (uintptr_t) tp1->whoTo,
- tp1->rec.data.TSN_seq);
+ tp1->rec.data.tsn);
}
sctp_flight_size_increase(tp1);
sctp_total_flight_increase(stcb, tp1);
@@ -5113,22 +5128,17 @@ sctp_kick_prsctp_reorder_queue(struct sctp_tcb *stcb,
{
struct sctp_queued_to_read *ctl, *nctl;
struct sctp_association *asoc;
- uint32_t tt;
- int need_reasm_check = 0, old;
+ uint32_t mid;
+ int need_reasm_check = 0;
asoc = &stcb->asoc;
- tt = strmin->last_sequence_delivered;
- if (asoc->idata_supported) {
- old = 0;
- } else {
- old = 1;
- }
+ mid = strmin->last_mid_delivered;
/*
* First deliver anything prior to and including the stream no that
* came in.
*/
TAILQ_FOREACH_SAFE(ctl, &strmin->inqueue, next_instrm, nctl) {
- if (SCTP_MSGID_GE(old, tt, ctl->sinfo_ssn)) {
+ if (SCTP_MID_GE(asoc->idata_supported, mid, ctl->mid)) {
/* this is deliverable now */
if (((ctl->sinfo_flags >> 8) & SCTP_DATA_NOT_FRAG) == SCTP_DATA_NOT_FRAG) {
if (ctl->on_strm_q) {
@@ -5161,7 +5171,7 @@ sctp_kick_prsctp_reorder_queue(struct sctp_tcb *stcb,
if (ctl->first_frag_seen) {
/* Make it so this is next to
* deliver, we restore later */
- strmin->last_sequence_delivered = ctl->sinfo_ssn - 1;
+ strmin->last_mid_delivered = ctl->mid - 1;
need_reasm_check = 1;
break;
}
@@ -5175,9 +5185,9 @@ sctp_kick_prsctp_reorder_queue(struct sctp_tcb *stcb,
int ret;
ret = sctp_deliver_reasm_check(stcb, &stcb->asoc, strmin, SCTP_READ_LOCK_HELD);
- if (SCTP_MSGID_GT(old, tt, strmin->last_sequence_delivered)) {
+ if (SCTP_MID_GT(asoc->idata_supported, mid, strmin->last_mid_delivered)) {
/* Restore the next to deliver unless we are ahead */
- strmin->last_sequence_delivered = tt;
+ strmin->last_mid_delivered = mid;
}
if (ret == 0) {
/* Left the front Partial one on */
@@ -5189,9 +5199,9 @@ sctp_kick_prsctp_reorder_queue(struct sctp_tcb *stcb,
* now we must deliver things in queue the normal way if any are
* now ready.
*/
- tt = strmin->last_sequence_delivered + 1;
+ mid = strmin->last_mid_delivered + 1;
TAILQ_FOREACH_SAFE(ctl, &strmin->inqueue, next_instrm, nctl) {
- if (tt == ctl->sinfo_ssn) {
+ if (SCTP_MID_EQ(asoc->idata_supported, mid, ctl->mid)) {
if (((ctl->sinfo_flags >> 8) & SCTP_DATA_NOT_FRAG) == SCTP_DATA_NOT_FRAG) {
/* this is deliverable now */
if (ctl->on_strm_q) {
@@ -5211,7 +5221,7 @@ sctp_kick_prsctp_reorder_queue(struct sctp_tcb *stcb,
asoc->size_on_all_streams -= ctl->length;
sctp_ucount_decr(asoc->cnt_on_all_streams);
/* deliver it to at least the delivery-q */
- strmin->last_sequence_delivered = ctl->sinfo_ssn;
+ strmin->last_mid_delivered = ctl->mid;
if (stcb->sctp_socket) {
sctp_mark_non_revokable(asoc, ctl->sinfo_tsn);
sctp_add_to_readq(stcb->sctp_ep, stcb,
@@ -5220,13 +5230,13 @@ sctp_kick_prsctp_reorder_queue(struct sctp_tcb *stcb,
SCTP_READ_LOCK_HELD, SCTP_SO_NOT_LOCKED);
}
- tt = strmin->last_sequence_delivered + 1;
+ mid = strmin->last_mid_delivered + 1;
} else {
/* Its a fragmented message */
if (ctl->first_frag_seen) {
/* Make it so this is next to
* deliver */
- strmin->last_sequence_delivered = ctl->sinfo_ssn - 1;
+ strmin->last_mid_delivered = ctl->mid - 1;
need_reasm_check = 1;
break;
}
@@ -5245,7 +5255,7 @@ sctp_kick_prsctp_reorder_queue(struct sctp_tcb *stcb,
static void
sctp_flush_reassm_for_str_seq(struct sctp_tcb *stcb,
struct sctp_association *asoc,
- uint16_t stream, uint32_t seq, int ordered, int old, uint32_t cumtsn)
+ uint16_t stream, uint32_t mid, int ordered, uint32_t cumtsn)
{
struct sctp_queued_to_read *control;
struct sctp_stream_in *strm;
@@ -5261,18 +5271,18 @@ sctp_flush_reassm_for_str_seq(struct sctp_tcb *stcb,
* queue.
*/
strm = &asoc->strmin[stream];
- control = sctp_find_reasm_entry(strm, (uint32_t) seq, ordered, old);
+ control = sctp_find_reasm_entry(strm, mid, ordered, asoc->idata_supported);
if (control == NULL) {
/* Not found */
return;
}
- if (old && !ordered && SCTP_TSN_GT(control->fsn_included, cumtsn)) {
+ if (!asoc->idata_supported && !ordered && SCTP_TSN_GT(control->fsn_included, cumtsn)) {
return;
}
TAILQ_FOREACH_SAFE(chk, &control->reasm, sctp_next, nchk) {
/* Purge hanging chunks */
- if (old && (ordered == 0)) {
- if (SCTP_TSN_GT(chk->rec.data.TSN_seq, cumtsn)) {
+ if (!asoc->idata_supported && (ordered == 0)) {
+ if (SCTP_TSN_GT(chk->rec.data.tsn, cumtsn)) {
break;
}
}
@@ -5424,7 +5434,7 @@ sctp_handle_forward_tsn(struct sctp_tcb *stcb,
/* Flush all the un-ordered data based on cum-tsn */
SCTP_INP_READ_LOCK(stcb->sctp_ep);
for (sid = 0; sid < asoc->streamincnt; sid++) {
- sctp_flush_reassm_for_str_seq(stcb, asoc, sid, 0, 0, 1, new_cum_tsn);
+ sctp_flush_reassm_for_str_seq(stcb, asoc, sid, 0, 0, new_cum_tsn);
}
SCTP_INP_READ_UNLOCK(stcb->sctp_ep);
}
@@ -5436,10 +5446,9 @@ sctp_handle_forward_tsn(struct sctp_tcb *stcb,
if (m && fwd_sz) {
/* New method. */
unsigned int num_str;
- uint32_t sequence;
- uint16_t stream;
+ uint32_t mid, cur_mid;
+ uint16_t sid;
uint16_t ordered, flags;
- int old;
struct sctp_strseq *stseq, strseqbuf;
struct sctp_strseq_mid *stseq_m, strseqbuf_m;
@@ -5448,10 +5457,8 @@ sctp_handle_forward_tsn(struct sctp_tcb *stcb,
SCTP_INP_READ_LOCK(stcb->sctp_ep);
if (asoc->idata_supported) {
num_str = fwd_sz / sizeof(struct sctp_strseq_mid);
- old = 0;
} else {
num_str = fwd_sz / sizeof(struct sctp_strseq);
- old = 1;
}
for (i = 0; i < num_str; i++) {
if (asoc->idata_supported) {
@@ -5462,8 +5469,8 @@ sctp_handle_forward_tsn(struct sctp_tcb *stcb,
if (stseq_m == NULL) {
break;
}
- stream = ntohs(stseq_m->stream);
- sequence = ntohl(stseq_m->msg_id);
+ sid = ntohs(stseq_m->sid);
+ mid = ntohl(stseq_m->mid);
flags = ntohs(stseq_m->flags);
if (flags & PR_SCTP_UNORDERED_FLAG) {
ordered = 0;
@@ -5478,8 +5485,8 @@ sctp_handle_forward_tsn(struct sctp_tcb *stcb,
if (stseq == NULL) {
break;
}
- stream = ntohs(stseq->stream);
- sequence = (uint32_t) ntohs(stseq->sequence);
+ sid = ntohs(stseq->sid);
+ mid = (uint32_t) ntohs(stseq->ssn);
ordered = 1;
}
/* Convert */
@@ -5491,12 +5498,12 @@ sctp_handle_forward_tsn(struct sctp_tcb *stcb,
* queue where its not all delivered. If we find it
* we transmute the read entry into a PDI_ABORTED.
*/
- if (stream >= asoc->streamincnt) {
+ if (sid >= asoc->streamincnt) {
/* screwed up streams, stop! */
break;
}
- if ((asoc->str_of_pdapi == stream) &&
- (asoc->ssn_of_pdapi == sequence)) {
+ if ((asoc->str_of_pdapi == sid) &&
+ (asoc->ssn_of_pdapi == mid)) {
/*
* If this is the one we were partially
* delivering now then we no longer are.
@@ -5505,24 +5512,14 @@ sctp_handle_forward_tsn(struct sctp_tcb *stcb,
*/
asoc->fragmented_delivery_inprogress = 0;
}
- strm = &asoc->strmin[stream];
- if (asoc->idata_supported == 0) {
- uint16_t strm_at;
-
- for (strm_at = strm->last_sequence_delivered; SCTP_MSGID_GE(1, sequence, strm_at); strm_at++) {
- sctp_flush_reassm_for_str_seq(stcb, asoc, stream, strm_at, ordered, old, new_cum_tsn);
- }
- } else {
- uint32_t strm_at;
-
- for (strm_at = strm->last_sequence_delivered; SCTP_MSGID_GE(0, sequence, strm_at); strm_at++) {
- sctp_flush_reassm_for_str_seq(stcb, asoc, stream, strm_at, ordered, old, new_cum_tsn);
- }
+ strm = &asoc->strmin[sid];
+ for (cur_mid = strm->last_mid_delivered; SCTP_MID_GE(asoc->idata_supported, mid, cur_mid); cur_mid++) {
+ sctp_flush_reassm_for_str_seq(stcb, asoc, sid, cur_mid, ordered, new_cum_tsn);
}
TAILQ_FOREACH(ctl, &stcb->sctp_ep->read_queue, next) {
- if ((ctl->sinfo_stream == stream) &&
- (ctl->sinfo_ssn == sequence)) {
- str_seq = (stream << 16) | (0x0000ffff & sequence);
+ if ((ctl->sinfo_stream == sid) &&
+ (SCTP_MID_EQ(asoc->idata_supported, ctl->mid, mid))) {
+ str_seq = (sid << 16) | (0x0000ffff & mid);
ctl->pdapi_aborted = 1;
sv = stcb->asoc.control_pdapi;
ctl->end_added = 1;
@@ -5545,15 +5542,15 @@ sctp_handle_forward_tsn(struct sctp_tcb *stcb,
SCTP_SO_NOT_LOCKED);
stcb->asoc.control_pdapi = sv;
break;
- } else if ((ctl->sinfo_stream == stream) &&
- SCTP_MSGID_GT(old, ctl->sinfo_ssn, sequence)) {
+ } else if ((ctl->sinfo_stream == sid) &&
+ SCTP_MID_GT(asoc->idata_supported, ctl->mid, mid)) {
/* We are past our victim SSN */
break;
}
}
- if (SCTP_MSGID_GT(old, sequence, strm->last_sequence_delivered)) {
+ if (SCTP_MID_GT(asoc->idata_supported, mid, strm->last_mid_delivered)) {
/* Update the sequence number */
- strm->last_sequence_delivered = sequence;
+ strm->last_mid_delivered = mid;
}
/* now kick the stream the new way */
/* sa_ignore NO_NULL_CHK */
diff --git a/sys/netinet/sctp_indata.h b/sys/netinet/sctp_indata.h
index 162ca90..e277ae8 100644
--- a/sys/netinet/sctp_indata.h
+++ b/sys/netinet/sctp_indata.h
@@ -42,20 +42,19 @@ struct sctp_queued_to_read *
sctp_build_readq_entry(struct sctp_tcb *stcb,
struct sctp_nets *net,
uint32_t tsn, uint32_t ppid,
- uint32_t context, uint16_t stream_no,
- uint32_t stream_seq, uint8_t flags,
+ uint32_t context, uint16_t sid,
+ uint32_t mid, uint8_t flags,
struct mbuf *dm);
-#define sctp_build_readq_entry_mac(_ctl, in_it, context, net, tsn, ppid, stream_no, stream_seq, flags, dm, tfsn, msgid) do { \
+#define sctp_build_readq_entry_mac(_ctl, in_it, context, net, tsn, ppid, sid, flags, dm, tfsn, mid) do { \
if (_ctl) { \
atomic_add_int(&((net)->ref_count), 1); \
memset(_ctl, 0, sizeof(struct sctp_queued_to_read)); \
- (_ctl)->sinfo_stream = stream_no; \
- (_ctl)->sinfo_ssn = stream_seq; \
+ (_ctl)->sinfo_stream = sid; \
TAILQ_INIT(&_ctl->reasm); \
(_ctl)->top_fsn = tfsn; \
- (_ctl)->msg_id = msgid; \
+ (_ctl)->mid = mid; \
(_ctl)->sinfo_flags = (flags << 8); \
(_ctl)->sinfo_ppid = ppid; \
(_ctl)->sinfo_context = context; \
diff --git a/sys/netinet/sctp_input.c b/sys/netinet/sctp_input.c
index 5f547bc..9032f6c 100644
--- a/sys/netinet/sctp_input.c
+++ b/sys/netinet/sctp_input.c
@@ -318,14 +318,14 @@ sctp_process_init(struct sctp_init_chunk *cp, struct sctp_tcb *stcb)
/* abandon the upper streams */
newcnt = ntohs(init->num_inbound_streams);
TAILQ_FOREACH_SAFE(chk, &asoc->send_queue, sctp_next, nchk) {
- if (chk->rec.data.stream_number >= newcnt) {
+ if (chk->rec.data.sid >= newcnt) {
TAILQ_REMOVE(&asoc->send_queue, chk, sctp_next);
asoc->send_queue_cnt--;
- if (asoc->strmout[chk->rec.data.stream_number].chunks_on_queues > 0) {
- asoc->strmout[chk->rec.data.stream_number].chunks_on_queues--;
+ if (asoc->strmout[chk->rec.data.sid].chunks_on_queues > 0) {
+ asoc->strmout[chk->rec.data.sid].chunks_on_queues--;
#ifdef INVARIANTS
} else {
- panic("No chunks on the queues for sid %u.", chk->rec.data.stream_number);
+ panic("No chunks on the queues for sid %u.", chk->rec.data.sid);
#endif
}
if (chk->data != NULL) {
@@ -410,8 +410,8 @@ sctp_process_init(struct sctp_init_chunk *cp, struct sctp_tcb *stcb)
return (-1);
}
for (i = 0; i < asoc->streamincnt; i++) {
- asoc->strmin[i].stream_no = i;
- asoc->strmin[i].last_sequence_delivered = 0xffffffff;
+ asoc->strmin[i].sid = i;
+ asoc->strmin[i].last_mid_delivered = 0xffffffff;
TAILQ_INIT(&asoc->strmin[i].inqueue);
TAILQ_INIT(&asoc->strmin[i].uno_inqueue);
asoc->strmin[i].pd_api_started = 0;
@@ -1955,7 +1955,7 @@ sctp_process_cookie_existing(struct mbuf *m, int iphlen, int offset,
asoc->strmout[i].abandoned_sent[0] = 0;
asoc->strmout[i].abandoned_unsent[0] = 0;
#endif
- stcb->asoc.strmout[i].stream_no = i;
+ stcb->asoc.strmout[i].sid = i;
stcb->asoc.strmout[i].next_mid_ordered = 0;
stcb->asoc.strmout[i].next_mid_unordered = 0;
stcb->asoc.strmout[i].last_msg_incomplete = 0;
@@ -3027,18 +3027,18 @@ sctp_handle_ecn_echo(struct sctp_ecne_chunk *cp,
if (lchk == NULL) {
window_data_tsn = stcb->asoc.sending_seq - 1;
} else {
- window_data_tsn = lchk->rec.data.TSN_seq;
+ window_data_tsn = lchk->rec.data.tsn;
}
/* Find where it was sent to if possible. */
net = NULL;
TAILQ_FOREACH(lchk, &stcb->asoc.sent_queue, sctp_next) {
- if (lchk->rec.data.TSN_seq == tsn) {
+ if (lchk->rec.data.tsn == tsn) {
net = lchk->whoTo;
net->ecn_prev_cwnd = lchk->rec.data.cwnd_at_send;
break;
}
- if (SCTP_TSN_GT(lchk->rec.data.TSN_seq, tsn)) {
+ if (SCTP_TSN_GT(lchk->rec.data.tsn, tsn)) {
break;
}
}
@@ -3228,11 +3228,11 @@ process_chunk_drop(struct sctp_tcb *stcb, struct sctp_chunk_desc *desc,
tsn = ntohl(desc->tsn_ifany);
TAILQ_FOREACH(tp1, &stcb->asoc.sent_queue, sctp_next) {
- if (tp1->rec.data.TSN_seq == tsn) {
+ if (tp1->rec.data.tsn == tsn) {
/* found it */
break;
}
- if (SCTP_TSN_GT(tp1->rec.data.TSN_seq, tsn)) {
+ if (SCTP_TSN_GT(tp1->rec.data.tsn, tsn)) {
/* not found */
tp1 = NULL;
break;
@@ -3245,7 +3245,7 @@ process_chunk_drop(struct sctp_tcb *stcb, struct sctp_chunk_desc *desc,
*/
SCTP_STAT_INCR(sctps_pdrpdnfnd);
TAILQ_FOREACH(tp1, &stcb->asoc.sent_queue, sctp_next) {
- if (tp1->rec.data.TSN_seq == tsn) {
+ if (tp1->rec.data.tsn == tsn) {
/* found it */
break;
}
@@ -3311,7 +3311,7 @@ process_chunk_drop(struct sctp_tcb *stcb, struct sctp_chunk_desc *desc,
if (TAILQ_EMPTY(&stcb->asoc.send_queue)) {
tp1->rec.data.fast_retran_tsn = stcb->asoc.sending_seq;
} else {
- tp1->rec.data.fast_retran_tsn = (TAILQ_FIRST(&stcb->asoc.send_queue))->rec.data.TSN_seq;
+ tp1->rec.data.fast_retran_tsn = (TAILQ_FIRST(&stcb->asoc.send_queue))->rec.data.tsn;
}
/* restart the timer */
@@ -3327,7 +3327,7 @@ process_chunk_drop(struct sctp_tcb *stcb, struct sctp_chunk_desc *desc,
tp1->whoTo->flight_size,
tp1->book_size,
(uint32_t) (uintptr_t) stcb,
- tp1->rec.data.TSN_seq);
+ tp1->rec.data.tsn);
}
if (tp1->sent < SCTP_DATAGRAM_RESEND) {
sctp_flight_size_decrease(tp1);
@@ -3471,12 +3471,12 @@ sctp_reset_in_stream(struct sctp_tcb *stcb, uint32_t number_entries, uint16_t *
if (temp >= stcb->asoc.streamincnt) {
continue;
}
- stcb->asoc.strmin[temp].last_sequence_delivered = 0xffffffff;
+ stcb->asoc.strmin[temp].last_mid_delivered = 0xffffffff;
}
} else {
list = NULL;
for (i = 0; i < stcb->asoc.streamincnt; i++) {
- stcb->asoc.strmin[i].last_sequence_delivered = 0xffffffff;
+ stcb->asoc.strmin[i].last_mid_delivered = 0xffffffff;
}
}
sctp_ulp_notify(SCTP_NOTIFY_STR_RESET_RECV, stcb, number_entries, (void *)list, SCTP_SO_NOT_LOCKED);
@@ -4018,8 +4018,8 @@ sctp_handle_str_reset_add_strm(struct sctp_tcb *stcb, struct sctp_tmit_chunk *ch
for (i = 0; i < stcb->asoc.streamincnt; i++) {
TAILQ_INIT(&stcb->asoc.strmin[i].inqueue);
TAILQ_INIT(&stcb->asoc.strmin[i].uno_inqueue);
- stcb->asoc.strmin[i].stream_no = i;
- stcb->asoc.strmin[i].last_sequence_delivered = oldstrm[i].last_sequence_delivered;
+ stcb->asoc.strmin[i].sid = i;
+ stcb->asoc.strmin[i].last_mid_delivered = oldstrm[i].last_mid_delivered;
stcb->asoc.strmin[i].delivery_started = oldstrm[i].delivery_started;
stcb->asoc.strmin[i].pd_api_started = oldstrm[i].pd_api_started;
/* now anything on those queues? */
@@ -4036,8 +4036,8 @@ sctp_handle_str_reset_add_strm(struct sctp_tcb *stcb, struct sctp_tmit_chunk *ch
for (i = stcb->asoc.streamincnt; i < num_stream; i++) {
TAILQ_INIT(&stcb->asoc.strmin[i].inqueue);
TAILQ_INIT(&stcb->asoc.strmin[i].uno_inqueue);
- stcb->asoc.strmin[i].stream_no = i;
- stcb->asoc.strmin[i].last_sequence_delivered = 0xffffffff;
+ stcb->asoc.strmin[i].sid = i;
+ stcb->asoc.strmin[i].last_mid_delivered = 0xffffffff;
stcb->asoc.strmin[i].pd_api_started = 0;
stcb->asoc.strmin[i].delivery_started = 0;
}
diff --git a/sys/netinet/sctp_output.c b/sys/netinet/sctp_output.c
index a841468..9220462 100644
--- a/sys/netinet/sctp_output.c
+++ b/sys/netinet/sctp_output.c
@@ -3638,7 +3638,7 @@ sctp_process_cmsgs_for_init(struct sctp_tcb *stcb, struct mbuf *control, int *er
stcb->asoc.strmout[i].abandoned_sent[0] = 0;
stcb->asoc.strmout[i].abandoned_unsent[0] = 0;
#endif
- stcb->asoc.strmout[i].stream_no = i;
+ stcb->asoc.strmout[i].sid = i;
stcb->asoc.strmout[i].last_msg_incomplete = 0;
stcb->asoc.strmout[i].state = SCTP_STREAM_OPENING;
stcb->asoc.ss_functions.sctp_ss_init_stream(stcb, &stcb->asoc.strmout[i], NULL);
@@ -6348,7 +6348,7 @@ sctp_msg_append(struct sctp_tcb *stcb,
sp->net = NULL;
}
(void)SCTP_GETTIME_TIMEVAL(&sp->ts);
- sp->stream = srcv->sinfo_stream;
+ sp->sid = srcv->sinfo_stream;
sp->msg_is_complete = 1;
sp->sender_all_done = 1;
sp->some_taken = 0;
@@ -6931,14 +6931,14 @@ sctp_clean_up_datalist(struct sctp_tcb *stcb,
/* record time */
data_list[i]->sent_rcv_time = net->last_sent_time;
data_list[i]->rec.data.cwnd_at_send = net->cwnd;
- data_list[i]->rec.data.fast_retran_tsn = data_list[i]->rec.data.TSN_seq;
+ data_list[i]->rec.data.fast_retran_tsn = data_list[i]->rec.data.tsn;
if (data_list[i]->whoTo == NULL) {
data_list[i]->whoTo = net;
atomic_add_int(&net->ref_count, 1);
}
/* on to the sent queue */
tp1 = TAILQ_LAST(&asoc->sent_queue, sctpchunk_listhead);
- if ((tp1) && SCTP_TSN_GT(tp1->rec.data.TSN_seq, data_list[i]->rec.data.TSN_seq)) {
+ if ((tp1) && SCTP_TSN_GT(tp1->rec.data.tsn, data_list[i]->rec.data.tsn)) {
struct sctp_tmit_chunk *tpp;
/* need to move back */
@@ -6949,7 +6949,7 @@ sctp_clean_up_datalist(struct sctp_tcb *stcb,
goto all_done;
}
tp1 = tpp;
- if (SCTP_TSN_GT(tp1->rec.data.TSN_seq, data_list[i]->rec.data.TSN_seq)) {
+ if (SCTP_TSN_GT(tp1->rec.data.tsn, data_list[i]->rec.data.tsn)) {
goto back_up_more;
}
TAILQ_INSERT_AFTER(&asoc->sent_queue, tp1, data_list[i], sctp_next);
@@ -6978,7 +6978,7 @@ all_done:
data_list[i]->whoTo->flight_size,
data_list[i]->book_size,
(uint32_t) (uintptr_t) data_list[i]->whoTo,
- data_list[i]->rec.data.TSN_seq);
+ data_list[i]->rec.data.tsn);
}
sctp_flight_size_increase(data_list[i]);
sctp_total_flight_increase(stcb, data_list[i]);
@@ -7146,7 +7146,7 @@ one_more_time:
(stcb->asoc.idata_supported == 0) &&
(strq->last_msg_incomplete)) {
SCTP_PRINTF("Huh? Stream:%d lm_in_c=%d but queue is NULL\n",
- strq->stream_no,
+ strq->sid,
strq->last_msg_incomplete);
strq->last_msg_incomplete = 0;
}
@@ -7493,28 +7493,28 @@ dont_do_it:
if (stcb->asoc.idata_supported == 0) {
if (rcv_flags & SCTP_DATA_UNORDERED) {
/* Just use 0. The receiver ignores the values. */
- chk->rec.data.stream_seq = 0;
+ chk->rec.data.mid = 0;
} else {
- chk->rec.data.stream_seq = strq->next_mid_ordered;
+ chk->rec.data.mid = strq->next_mid_ordered;
if (rcv_flags & SCTP_DATA_LAST_FRAG) {
strq->next_mid_ordered++;
}
}
} else {
if (rcv_flags & SCTP_DATA_UNORDERED) {
- chk->rec.data.stream_seq = strq->next_mid_unordered;
+ chk->rec.data.mid = strq->next_mid_unordered;
if (rcv_flags & SCTP_DATA_LAST_FRAG) {
strq->next_mid_unordered++;
}
} else {
- chk->rec.data.stream_seq = strq->next_mid_ordered;
+ chk->rec.data.mid = strq->next_mid_ordered;
if (rcv_flags & SCTP_DATA_LAST_FRAG) {
strq->next_mid_ordered++;
}
}
}
- chk->rec.data.stream_number = sp->stream;
- chk->rec.data.payloadtype = sp->ppid;
+ chk->rec.data.sid = sp->sid;
+ chk->rec.data.ppid = sp->ppid;
chk->rec.data.context = sp->context;
chk->rec.data.doing_fast_retransmit = 0;
@@ -7532,12 +7532,12 @@ dont_do_it:
sctp_auth_key_acquire(stcb, chk->auth_keyid);
chk->holds_key_ref = 1;
}
- chk->rec.data.TSN_seq = atomic_fetchadd_int(&asoc->sending_seq, 1);
+ chk->rec.data.tsn = atomic_fetchadd_int(&asoc->sending_seq, 1);
if (SCTP_BASE_SYSCTL(sctp_logging_level) & SCTP_LOG_AT_SEND_2_OUTQ) {
sctp_misc_ints(SCTP_STRMOUT_LOG_SEND,
(uint32_t) (uintptr_t) stcb, sp->length,
- (uint32_t) ((chk->rec.data.stream_number << 16) | chk->rec.data.stream_seq),
- chk->rec.data.TSN_seq);
+ (uint32_t) ((chk->rec.data.sid << 16) | (0x0000ffff & chk->rec.data.mid)),
+ chk->rec.data.tsn);
}
if (stcb->asoc.idata_supported == 0) {
dchkh = mtod(chk->data, struct sctp_data_chunk *);
@@ -7555,9 +7555,9 @@ dont_do_it:
asoc->tsn_out_at = 0;
asoc->tsn_out_wrapped = 1;
}
- asoc->out_tsnlog[asoc->tsn_out_at].tsn = chk->rec.data.TSN_seq;
- asoc->out_tsnlog[asoc->tsn_out_at].strm = chk->rec.data.stream_number;
- asoc->out_tsnlog[asoc->tsn_out_at].seq = chk->rec.data.stream_seq;
+ asoc->out_tsnlog[asoc->tsn_out_at].tsn = chk->rec.data.tsn;
+ asoc->out_tsnlog[asoc->tsn_out_at].strm = chk->rec.data.sid;
+ asoc->out_tsnlog[asoc->tsn_out_at].seq = chk->rec.data.mid;
asoc->out_tsnlog[asoc->tsn_out_at].sz = chk->send_size;
asoc->out_tsnlog[asoc->tsn_out_at].flgs = chk->rec.data.rcv_flags;
asoc->out_tsnlog[asoc->tsn_out_at].stcb = (void *)stcb;
@@ -7568,20 +7568,20 @@ dont_do_it:
if (stcb->asoc.idata_supported == 0) {
dchkh->ch.chunk_type = SCTP_DATA;
dchkh->ch.chunk_flags = chk->rec.data.rcv_flags;
- dchkh->dp.tsn = htonl(chk->rec.data.TSN_seq);
- dchkh->dp.stream_id = htons((strq->stream_no & 0x0000ffff));
- dchkh->dp.stream_sequence = htons((uint16_t) chk->rec.data.stream_seq);
- dchkh->dp.protocol_id = chk->rec.data.payloadtype;
+ dchkh->dp.tsn = htonl(chk->rec.data.tsn);
+ dchkh->dp.sid = htons(strq->sid);
+ dchkh->dp.ssn = htons((uint16_t) chk->rec.data.mid);
+ dchkh->dp.ppid = chk->rec.data.ppid;
dchkh->ch.chunk_length = htons(chk->send_size);
} else {
ndchkh->ch.chunk_type = SCTP_IDATA;
ndchkh->ch.chunk_flags = chk->rec.data.rcv_flags;
- ndchkh->dp.tsn = htonl(chk->rec.data.TSN_seq);
- ndchkh->dp.stream_id = htons(strq->stream_no);
+ ndchkh->dp.tsn = htonl(chk->rec.data.tsn);
+ ndchkh->dp.sid = htons(strq->sid);
ndchkh->dp.reserved = htons(0);
- ndchkh->dp.msg_id = htonl(chk->rec.data.stream_seq);
+ ndchkh->dp.mid = htonl(chk->rec.data.mid);
if (sp->fsn == 0)
- ndchkh->dp.ppid_fsn.protocol_id = chk->rec.data.payloadtype;
+ ndchkh->dp.ppid_fsn.ppid = chk->rec.data.ppid;
else
ndchkh->dp.ppid_fsn.fsn = htonl(sp->fsn);
sp->fsn++;
@@ -8817,7 +8817,7 @@ again_one_more_time:
}
if (bundle_at) {
/* setup for a RTO measurement */
- tsns_sent = data_list[0]->rec.data.TSN_seq;
+ tsns_sent = data_list[0]->rec.data.tsn;
/* fill time if not already filled */
if (*now_filled == 0) {
(void)SCTP_GETTIME_TIMEVAL(&asoc->time_last_sent);
@@ -9498,7 +9498,7 @@ sctp_chunk_retransmission(struct sctp_inpcb *inp,
}
if (chk->data == NULL) {
SCTP_PRINTF("TSN:%x chk->snd_count:%d chk->sent:%d can't retran - no data\n",
- chk->rec.data.TSN_seq, chk->snd_count, chk->sent);
+ chk->rec.data.tsn, chk->snd_count, chk->sent);
continue;
}
if ((SCTP_BASE_SYSCTL(sctp_max_retran_chunk)) &&
@@ -9507,7 +9507,7 @@ sctp_chunk_retransmission(struct sctp_inpcb *inp,
char msg[SCTP_DIAG_INFO_LEN];
snprintf(msg, sizeof(msg), "TSN %8.8x retransmitted %d times, giving up",
- chk->rec.data.TSN_seq, chk->snd_count);
+ chk->rec.data.tsn, chk->snd_count);
op_err = sctp_generate_cause(SCTP_BASE_SYSCTL(sctp_diag_info_code),
msg);
atomic_add_int(&stcb->asoc.refcnt, 1);
@@ -9541,7 +9541,7 @@ sctp_chunk_retransmission(struct sctp_inpcb *inp,
uint32_t tsn;
tsn = asoc->last_acked_seq + 1;
- if (tsn == chk->rec.data.TSN_seq) {
+ if (tsn == chk->rec.data.tsn) {
/*
* we make a special exception for this
* case. The peer has no rwnd but is missing
@@ -9751,7 +9751,7 @@ one_chunk_around:
sctp_audit_log(0xC4, bundle_at);
#endif
if (bundle_at) {
- tsns_sent = data_list[0]->rec.data.TSN_seq;
+ tsns_sent = data_list[0]->rec.data.tsn;
}
for (i = 0; i < bundle_at; i++) {
SCTP_STAT_INCR(sctps_sendretransdata);
@@ -9801,7 +9801,7 @@ one_chunk_around:
data_list[i]->whoTo->flight_size,
data_list[i]->book_size,
(uint32_t) (uintptr_t) data_list[i]->whoTo,
- data_list[i]->rec.data.TSN_seq);
+ data_list[i]->rec.data.tsn);
}
sctp_flight_size_increase(data_list[i]);
sctp_total_flight_increase(stcb, data_list[i]);
@@ -10196,13 +10196,7 @@ send_forward_tsn(struct sctp_tcb *stcb,
unsigned int cnt_of_space, i, ovh;
unsigned int space_needed;
unsigned int cnt_of_skipped = 0;
- int old;
- if (asoc->idata_supported) {
- old = 0;
- } else {
- old = 1;
- }
SCTP_TCB_LOCK_ASSERT(stcb);
TAILQ_FOREACH(chk, &asoc->control_send_queue, sctp_next) {
if (chk->rec.chunk_id.id == SCTP_FORWARD_CUM_TSN) {
@@ -10256,18 +10250,18 @@ sctp_fill_in_rest:
/* no more to look at */
break;
}
- if (old && (at->rec.data.rcv_flags & SCTP_DATA_UNORDERED)) {
+ if (!asoc->idata_supported && (at->rec.data.rcv_flags & SCTP_DATA_UNORDERED)) {
/* We don't report these */
continue;
}
cnt_of_skipped++;
}
- if (old) {
+ if (asoc->idata_supported) {
space_needed = (sizeof(struct sctp_forward_tsn_chunk) +
- (cnt_of_skipped * sizeof(struct sctp_strseq)));
+ (cnt_of_skipped * sizeof(struct sctp_strseq_mid)));
} else {
space_needed = (sizeof(struct sctp_forward_tsn_chunk) +
- (cnt_of_skipped * sizeof(struct sctp_strseq_mid)));
+ (cnt_of_skipped * sizeof(struct sctp_strseq)));
}
cnt_of_space = (unsigned int)M_TRAILINGSPACE(chk->data);
@@ -10296,12 +10290,11 @@ sctp_fill_in_rest:
0xff, 0xff, cnt_of_space,
space_needed);
}
- if (old) {
- cnt_of_skipped = cnt_of_space - sizeof(struct sctp_forward_tsn_chunk);
- cnt_of_skipped /= sizeof(struct sctp_strseq);
- } else {
- cnt_of_skipped = cnt_of_space - sizeof(struct sctp_forward_tsn_chunk);
+ cnt_of_skipped = cnt_of_space - sizeof(struct sctp_forward_tsn_chunk);
+ if (asoc->idata_supported) {
cnt_of_skipped /= sizeof(struct sctp_strseq_mid);
+ } else {
+ cnt_of_skipped /= sizeof(struct sctp_strseq);
}
/*-
* Go through and find the TSN that will be the one
@@ -10319,7 +10312,7 @@ sctp_fill_in_rest:
}
if (at && SCTP_BASE_SYSCTL(sctp_logging_level) & SCTP_LOG_TRY_ADVANCE) {
sctp_misc_ints(SCTP_FWD_TSN_CHECK,
- 0xff, cnt_of_skipped, at->rec.data.TSN_seq,
+ 0xff, cnt_of_skipped, at->rec.data.tsn,
asoc->advanced_peer_ack_point);
}
last = at;
@@ -10328,14 +10321,14 @@ sctp_fill_in_rest:
* peer ack point
*/
if (last) {
- advance_peer_ack_point = last->rec.data.TSN_seq;
+ advance_peer_ack_point = last->rec.data.tsn;
}
- if (old) {
+ if (asoc->idata_supported) {
space_needed = sizeof(struct sctp_forward_tsn_chunk) +
- cnt_of_skipped * sizeof(struct sctp_strseq);
+ cnt_of_skipped * sizeof(struct sctp_strseq_mid);
} else {
space_needed = sizeof(struct sctp_forward_tsn_chunk) +
- cnt_of_skipped * sizeof(struct sctp_strseq_mid);
+ cnt_of_skipped * sizeof(struct sctp_strseq);
}
}
chk->send_size = space_needed;
@@ -10343,10 +10336,10 @@ sctp_fill_in_rest:
fwdtsn = mtod(chk->data, struct sctp_forward_tsn_chunk *);
fwdtsn->ch.chunk_length = htons(chk->send_size);
fwdtsn->ch.chunk_flags = 0;
- if (old) {
- fwdtsn->ch.chunk_type = SCTP_FORWARD_CUM_TSN;
- } else {
+ if (asoc->idata_supported) {
fwdtsn->ch.chunk_type = SCTP_IFORWARD_CUM_TSN;
+ } else {
+ fwdtsn->ch.chunk_type = SCTP_FORWARD_CUM_TSN;
}
fwdtsn->new_cumulative_tsn = htonl(advance_peer_ack_point);
SCTP_BUF_LEN(chk->data) = chk->send_size;
@@ -10355,10 +10348,10 @@ sctp_fill_in_rest:
* Move pointer to after the fwdtsn and transfer to the
* strseq pointer.
*/
- if (old) {
- strseq = (struct sctp_strseq *)fwdtsn;
- } else {
+ if (asoc->idata_supported) {
strseq_m = (struct sctp_strseq_mid *)fwdtsn;
+ } else {
+ strseq = (struct sctp_strseq *)fwdtsn;
}
/*-
* Now populate the strseq list. This is done blindly
@@ -10377,26 +10370,26 @@ sctp_fill_in_rest:
if (i >= cnt_of_skipped) {
break;
}
- if (old && (at->rec.data.rcv_flags & SCTP_DATA_UNORDERED)) {
+ if (!asoc->idata_supported && (at->rec.data.rcv_flags & SCTP_DATA_UNORDERED)) {
/* We don't report these */
continue;
}
- if (at->rec.data.TSN_seq == advance_peer_ack_point) {
+ if (at->rec.data.tsn == advance_peer_ack_point) {
at->rec.data.fwd_tsn_cnt = 0;
}
- if (old) {
- strseq->stream = htons(at->rec.data.stream_number);
- strseq->sequence = htons((uint16_t) at->rec.data.stream_seq);
- strseq++;
- } else {
- strseq_m->stream = htons(at->rec.data.stream_number);
+ if (asoc->idata_supported) {
+ strseq_m->sid = htons(at->rec.data.sid);
if (at->rec.data.rcv_flags & SCTP_DATA_UNORDERED) {
strseq_m->flags = htons(PR_SCTP_UNORDERED_FLAG);
} else {
strseq_m->flags = 0;
}
- strseq_m->msg_id = htonl(at->rec.data.stream_seq);
+ strseq_m->mid = htonl(at->rec.data.mid);
strseq_m++;
+ } else {
+ strseq->sid = htons(at->rec.data.sid);
+ strseq->ssn = htons((uint16_t) at->rec.data.mid);
+ strseq++;
}
i++;
}
@@ -12122,7 +12115,7 @@ sctp_send_str_reset_req(struct sctp_tcb *stcb,
stcb->asoc.strmout[i].next_mid_ordered = oldstream[i].next_mid_ordered;
stcb->asoc.strmout[i].next_mid_unordered = oldstream[i].next_mid_unordered;
stcb->asoc.strmout[i].last_msg_incomplete = oldstream[i].last_msg_incomplete;
- stcb->asoc.strmout[i].stream_no = i;
+ stcb->asoc.strmout[i].sid = i;
stcb->asoc.strmout[i].state = oldstream[i].state;
/* FIX ME FIX ME */
/* This should be a SS_COPY operation FIX ME STREAM
@@ -12151,7 +12144,7 @@ sctp_send_str_reset_req(struct sctp_tcb *stcb,
#endif
stcb->asoc.strmout[i].next_mid_ordered = 0;
stcb->asoc.strmout[i].next_mid_unordered = 0;
- stcb->asoc.strmout[i].stream_no = i;
+ stcb->asoc.strmout[i].sid = i;
stcb->asoc.strmout[i].last_msg_incomplete = 0;
stcb->asoc.ss_functions.sctp_ss_init_stream(stcb, &stcb->asoc.strmout[i], NULL);
stcb->asoc.strmout[i].state = SCTP_STREAM_CLOSED;
@@ -12310,7 +12303,7 @@ sctp_copy_it_in(struct sctp_tcb *stcb,
sp->fsn = 0;
(void)SCTP_GETTIME_TIMEVAL(&sp->ts);
- sp->stream = srcv->sinfo_stream;
+ sp->sid = srcv->sinfo_stream;
sp->length = (uint32_t) min(uio->uio_resid, max_send_len);
if ((sp->length == (uint32_t) uio->uio_resid) &&
((user_marks_eor == 0) ||
diff --git a/sys/netinet/sctp_pcb.c b/sys/netinet/sctp_pcb.c
index bce3e74..413a753 100644
--- a/sys/netinet/sctp_pcb.c
+++ b/sys/netinet/sctp_pcb.c
@@ -4778,7 +4778,7 @@ sctp_free_assoc(struct sctp_inpcb *inp, struct sctp_tcb *stcb, int from_inpcbfre
uint32_t strseq;
stcb->asoc.control_pdapi = sq;
- strseq = (sq->sinfo_stream << 16) | sq->sinfo_ssn;
+ strseq = (sq->sinfo_stream << 16) | (sq->mid & 0x0000ffff);
sctp_ulp_notify(SCTP_NOTIFY_PARTIAL_DELVIERY_INDICATION,
stcb,
SCTP_PARTIAL_DELIVERY_ABORTED,
@@ -4999,11 +4999,11 @@ sctp_free_assoc(struct sctp_inpcb *inp, struct sctp_tcb *stcb, int from_inpcbfre
}
/* pending send queue SHOULD be empty */
TAILQ_FOREACH_SAFE(chk, &asoc->send_queue, sctp_next, nchk) {
- if (asoc->strmout[chk->rec.data.stream_number].chunks_on_queues > 0) {
- asoc->strmout[chk->rec.data.stream_number].chunks_on_queues--;
+ if (asoc->strmout[chk->rec.data.sid].chunks_on_queues > 0) {
+ asoc->strmout[chk->rec.data.sid].chunks_on_queues--;
#ifdef INVARIANTS
} else {
- panic("No chunks on the queues for sid %u.", chk->rec.data.stream_number);
+ panic("No chunks on the queues for sid %u.", chk->rec.data.sid);
#endif
}
TAILQ_REMOVE(&asoc->send_queue, chk, sctp_next);
@@ -5031,11 +5031,11 @@ sctp_free_assoc(struct sctp_inpcb *inp, struct sctp_tcb *stcb, int from_inpcbfre
/* sent queue SHOULD be empty */
TAILQ_FOREACH_SAFE(chk, &asoc->sent_queue, sctp_next, nchk) {
if (chk->sent != SCTP_DATAGRAM_NR_ACKED) {
- if (asoc->strmout[chk->rec.data.stream_number].chunks_on_queues > 0) {
- asoc->strmout[chk->rec.data.stream_number].chunks_on_queues--;
+ if (asoc->strmout[chk->rec.data.sid].chunks_on_queues > 0) {
+ asoc->strmout[chk->rec.data.sid].chunks_on_queues--;
#ifdef INVARIANTS
} else {
- panic("No chunks on the queues for sid %u.", chk->rec.data.stream_number);
+ panic("No chunks on the queues for sid %u.", chk->rec.data.sid);
#endif
}
}
@@ -6841,7 +6841,7 @@ sctp_drain_mbufs(struct sctp_tcb *stcb)
/* Now its reasm? */
TAILQ_FOREACH_SAFE(chk, &ctl->reasm, sctp_next, nchk) {
cnt++;
- SCTP_CALC_TSN_TO_GAP(gap, chk->rec.data.TSN_seq, asoc->mapping_array_base_tsn);
+ SCTP_CALC_TSN_TO_GAP(gap, chk->rec.data.tsn, asoc->mapping_array_base_tsn);
asoc->size_on_reasm_queue = sctp_sbspace_sub(asoc->size_on_reasm_queue, chk->send_size);
sctp_ucount_decr(asoc->cnt_on_reasm_queue);
SCTP_UNSET_TSN_PRESENT(asoc->mapping_array, gap);
@@ -6883,7 +6883,7 @@ sctp_drain_mbufs(struct sctp_tcb *stcb)
/* Now its reasm? */
TAILQ_FOREACH_SAFE(chk, &ctl->reasm, sctp_next, nchk) {
cnt++;
- SCTP_CALC_TSN_TO_GAP(gap, chk->rec.data.TSN_seq, asoc->mapping_array_base_tsn);
+ SCTP_CALC_TSN_TO_GAP(gap, chk->rec.data.tsn, asoc->mapping_array_base_tsn);
asoc->size_on_reasm_queue = sctp_sbspace_sub(asoc->size_on_reasm_queue, chk->send_size);
sctp_ucount_decr(asoc->cnt_on_reasm_queue);
SCTP_UNSET_TSN_PRESENT(asoc->mapping_array, gap);
diff --git a/sys/netinet/sctp_ss_functions.c b/sys/netinet/sctp_ss_functions.c
index 05ff11e..36f1b53 100644
--- a/sys/netinet/sctp_ss_functions.c
+++ b/sys/netinet/sctp_ss_functions.c
@@ -292,7 +292,7 @@ sctp_ss_rr_add(struct sctp_tcb *stcb, struct sctp_association *asoc,
TAILQ_INSERT_HEAD(&asoc->ss_data.out.wheel, strq, ss_params.rr.next_spoke);
} else {
strqt = TAILQ_FIRST(&asoc->ss_data.out.wheel);
- while (strqt != NULL && (strqt->stream_no < strq->stream_no)) {
+ while (strqt != NULL && (strqt->sid < strq->sid)) {
strqt = TAILQ_NEXT(strqt, ss_params.rr.next_spoke);
}
if (strqt != NULL) {
@@ -857,7 +857,7 @@ sctp_ss_fcfs_select(struct sctp_tcb *stcb SCTP_UNUSED, struct sctp_nets *net,
sp = TAILQ_FIRST(&asoc->ss_data.out.list);
default_again:
if (sp != NULL) {
- strq = &asoc->strmout[sp->stream];
+ strq = &asoc->strmout[sp->sid];
} else {
strq = NULL;
}
diff --git a/sys/netinet/sctp_structs.h b/sys/netinet/sctp_structs.h
index 6fd2d81..22a3c73 100644
--- a/sys/netinet/sctp_structs.h
+++ b/sys/netinet/sctp_structs.h
@@ -388,10 +388,10 @@ struct sctp_nets {
struct sctp_data_chunkrec {
- uint32_t TSN_seq; /* the TSN of this transmit */
- uint32_t stream_seq; /* the stream sequence number of this transmit */
- uint16_t stream_number; /* the stream number of this guy */
- uint32_t payloadtype;
+ uint32_t tsn; /* the TSN of this transmit */
+ uint32_t mid; /* the message identifier of this transmit */
+ uint16_t sid; /* the stream number of this guy */
+ uint32_t ppid;
uint32_t context; /* from send */
uint32_t cwnd_at_send;
/*
@@ -400,7 +400,7 @@ struct sctp_data_chunkrec {
*/
uint32_t fast_retran_tsn; /* sending_seq at the time of FR */
struct timeval timetodrop; /* time we drop it from queue */
- uint32_t fsn_num; /* Fragment Sequence Number */
+ uint32_t fsn; /* Fragment Sequence Number */
uint8_t doing_fast_retransmit;
uint8_t rcv_flags; /* flags pulled from data chunk on inbound for
* outbound holds sending flags for PR-SCTP. */
@@ -454,7 +454,6 @@ struct sctp_tmit_chunk {
struct sctp_queued_to_read { /* sinfo structure Pluse more */
uint16_t sinfo_stream; /* off the wire */
- uint32_t sinfo_ssn; /* off the wire */
uint16_t sinfo_flags; /* SCTP_UNORDERED from wire use SCTP_EOF for
* EOR */
uint32_t sinfo_ppid; /* off the wire */
@@ -464,7 +463,7 @@ struct sctp_queued_to_read { /* sinfo structure Pluse more */
uint32_t sinfo_cumtsn; /* Use this in reassembly as last TSN */
sctp_assoc_t sinfo_assoc_id; /* our assoc id */
/* Non sinfo stuff */
- uint32_t msg_id; /* Fragment Index */
+ uint32_t mid; /* Fragment Index */
uint32_t length; /* length of data */
uint32_t held_length; /* length held in sb */
uint32_t top_fsn; /* Highest FSN in queue */
@@ -526,7 +525,7 @@ struct sctp_stream_queue_pending {
uint32_t ppid;
uint32_t context;
uint16_t sinfo_flags;
- uint16_t stream;
+ uint16_t sid;
uint16_t act_flags;
uint16_t auth_keyid;
uint8_t holds_key_ref;
@@ -545,8 +544,8 @@ TAILQ_HEAD(sctpwheelunrel_listhead, sctp_stream_in);
struct sctp_stream_in {
struct sctp_readhead inqueue;
struct sctp_readhead uno_inqueue;
- uint32_t last_sequence_delivered; /* used for re-order */
- uint16_t stream_no;
+ uint32_t last_mid_delivered; /* used for re-order */
+ uint16_t sid;
uint8_t delivery_started;
uint8_t pd_api_started;
};
@@ -629,7 +628,7 @@ struct sctp_stream_out {
*/
uint32_t next_mid_ordered;
uint32_t next_mid_unordered;
- uint16_t stream_no;
+ uint16_t sid;
uint8_t last_msg_incomplete;
uint8_t state;
};
diff --git a/sys/netinet/sctp_timer.c b/sys/netinet/sctp_timer.c
index 3baa66e..de1862e 100644
--- a/sys/netinet/sctp_timer.c
+++ b/sys/netinet/sctp_timer.c
@@ -429,17 +429,17 @@ sctp_recover_sent_list(struct sctp_tcb *stcb)
asoc = &stcb->asoc;
TAILQ_FOREACH_SAFE(chk, &asoc->sent_queue, sctp_next, nchk) {
- if (SCTP_TSN_GE(asoc->last_acked_seq, chk->rec.data.TSN_seq)) {
+ if (SCTP_TSN_GE(asoc->last_acked_seq, chk->rec.data.tsn)) {
SCTP_PRINTF("Found chk:%p tsn:%x <= last_acked_seq:%x\n",
- (void *)chk, chk->rec.data.TSN_seq, asoc->last_acked_seq);
+ (void *)chk, chk->rec.data.tsn, asoc->last_acked_seq);
if (chk->sent != SCTP_DATAGRAM_NR_ACKED) {
- if (asoc->strmout[chk->rec.data.stream_number].chunks_on_queues > 0) {
- asoc->strmout[chk->rec.data.stream_number].chunks_on_queues--;
+ if (asoc->strmout[chk->rec.data.sid].chunks_on_queues > 0) {
+ asoc->strmout[chk->rec.data.sid].chunks_on_queues--;
}
}
- if ((asoc->strmout[chk->rec.data.stream_number].chunks_on_queues == 0) &&
- (asoc->strmout[chk->rec.data.stream_number].state == SCTP_STREAM_RESET_PENDING) &&
- TAILQ_EMPTY(&asoc->strmout[chk->rec.data.stream_number].outqueue)) {
+ if ((asoc->strmout[chk->rec.data.sid].chunks_on_queues == 0) &&
+ (asoc->strmout[chk->rec.data.sid].state == SCTP_STREAM_RESET_PENDING) &&
+ TAILQ_EMPTY(&asoc->strmout[chk->rec.data.sid].outqueue)) {
asoc->trigger_reset = 1;
}
TAILQ_REMOVE(&asoc->sent_queue, chk, sctp_next);
@@ -462,7 +462,7 @@ sctp_recover_sent_list(struct sctp_tcb *stcb)
}
SCTP_PRINTF("after recover order is as follows\n");
TAILQ_FOREACH(chk, &asoc->sent_queue, sctp_next) {
- SCTP_PRINTF("chk:%p TSN:%x\n", (void *)chk, chk->rec.data.TSN_seq);
+ SCTP_PRINTF("chk:%p TSN:%x\n", (void *)chk, chk->rec.data.tsn);
}
}
#endif
@@ -546,10 +546,10 @@ sctp_mark_all_for_resend(struct sctp_tcb *stcb,
start_again:
#endif
TAILQ_FOREACH_SAFE(chk, &stcb->asoc.sent_queue, sctp_next, nchk) {
- if (SCTP_TSN_GE(stcb->asoc.last_acked_seq, chk->rec.data.TSN_seq)) {
+ if (SCTP_TSN_GE(stcb->asoc.last_acked_seq, chk->rec.data.tsn)) {
/* Strange case our list got out of order? */
SCTP_PRINTF("Our list is out of order? last_acked:%x chk:%x\n",
- (unsigned int)stcb->asoc.last_acked_seq, (unsigned int)chk->rec.data.TSN_seq);
+ (unsigned int)stcb->asoc.last_acked_seq, (unsigned int)chk->rec.data.tsn);
recovery_cnt++;
#ifdef INVARIANTS
panic("last acked >= chk on sent-Q");
@@ -574,7 +574,7 @@ start_again:
/* validate its been outstanding long enough */
if (SCTP_BASE_SYSCTL(sctp_logging_level) & SCTP_FR_LOGGING_ENABLE) {
- sctp_log_fr(chk->rec.data.TSN_seq,
+ sctp_log_fr(chk->rec.data.tsn,
chk->sent_rcv_time.tv_sec,
chk->sent_rcv_time.tv_usec,
SCTP_FR_T3_MARK_TIME);
@@ -638,11 +638,11 @@ start_again:
num_mk++;
if (fir == 0) {
fir = 1;
- tsnfirst = chk->rec.data.TSN_seq;
+ tsnfirst = chk->rec.data.tsn;
}
- tsnlast = chk->rec.data.TSN_seq;
+ tsnlast = chk->rec.data.tsn;
if (SCTP_BASE_SYSCTL(sctp_logging_level) & SCTP_FR_LOGGING_ENABLE) {
- sctp_log_fr(chk->rec.data.TSN_seq, chk->snd_count,
+ sctp_log_fr(chk->rec.data.tsn, chk->snd_count,
0, SCTP_FR_T3_MARKED);
}
if (chk->rec.data.chunk_was_revoked) {
@@ -657,7 +657,7 @@ start_again:
chk->whoTo->flight_size,
chk->book_size,
(uint32_t) (uintptr_t) chk->whoTo,
- chk->rec.data.TSN_seq);
+ chk->rec.data.tsn);
}
sctp_flight_size_decrease(chk);
sctp_total_flight_decrease(stcb, chk);
@@ -687,7 +687,7 @@ start_again:
if (TAILQ_EMPTY(&stcb->asoc.send_queue)) {
chk->rec.data.fast_retran_tsn = stcb->asoc.sending_seq;
} else {
- chk->rec.data.fast_retran_tsn = (TAILQ_FIRST(&stcb->asoc.send_queue))->rec.data.TSN_seq;
+ chk->rec.data.fast_retran_tsn = (TAILQ_FIRST(&stcb->asoc.send_queue))->rec.data.tsn;
}
}
/*
@@ -785,7 +785,7 @@ start_again:
chk->whoTo->flight_size,
chk->book_size,
(uint32_t) (uintptr_t) chk->whoTo,
- chk->rec.data.TSN_seq);
+ chk->rec.data.tsn);
}
sctp_flight_size_increase(chk);
sctp_total_flight_increase(stcb, chk);
diff --git a/sys/netinet/sctp_usrreq.c b/sys/netinet/sctp_usrreq.c
index b1711cc..174fb47 100644
--- a/sys/netinet/sctp_usrreq.c
+++ b/sys/netinet/sctp_usrreq.c
@@ -135,7 +135,7 @@ sctp_pathmtu_adjustment(struct sctp_tcb *stcb, uint16_t nxtsz)
chk->whoTo->flight_size,
chk->book_size,
(uint32_t) (uintptr_t) chk->whoTo,
- chk->rec.data.TSN_seq);
+ chk->rec.data.tsn);
}
/* Clear any time so NO RTT is being done */
chk->do_rtt = 0;
diff --git a/sys/netinet/sctp_var.h b/sys/netinet/sctp_var.h
index 858acfb..6365dfe 100644
--- a/sys/netinet/sctp_var.h
+++ b/sys/netinet/sctp_var.h
@@ -267,7 +267,7 @@ extern struct pr_usrreqs sctp_usrreqs;
if (stcb->asoc.fs_index > SCTP_FS_SPEC_LOG_SIZE) \
stcb->asoc.fs_index = 0;\
stcb->asoc.fslog[stcb->asoc.fs_index].total_flight = stcb->asoc.total_flight; \
- stcb->asoc.fslog[stcb->asoc.fs_index].tsn = tp1->rec.data.TSN_seq; \
+ stcb->asoc.fslog[stcb->asoc.fs_index].tsn = tp1->rec.data.tsn; \
stcb->asoc.fslog[stcb->asoc.fs_index].book = tp1->book_size; \
stcb->asoc.fslog[stcb->asoc.fs_index].sent = tp1->sent; \
stcb->asoc.fslog[stcb->asoc.fs_index].incr = 0; \
@@ -288,7 +288,7 @@ extern struct pr_usrreqs sctp_usrreqs;
if (stcb->asoc.fs_index > SCTP_FS_SPEC_LOG_SIZE) \
stcb->asoc.fs_index = 0;\
stcb->asoc.fslog[stcb->asoc.fs_index].total_flight = stcb->asoc.total_flight; \
- stcb->asoc.fslog[stcb->asoc.fs_index].tsn = tp1->rec.data.TSN_seq; \
+ stcb->asoc.fslog[stcb->asoc.fs_index].tsn = tp1->rec.data.tsn; \
stcb->asoc.fslog[stcb->asoc.fs_index].book = tp1->book_size; \
stcb->asoc.fslog[stcb->asoc.fs_index].sent = tp1->sent; \
stcb->asoc.fslog[stcb->asoc.fs_index].incr = 1; \
diff --git a/sys/netinet/sctputil.c b/sys/netinet/sctputil.c
index fbe9d12..61d3732 100644
--- a/sys/netinet/sctputil.c
+++ b/sys/netinet/sctputil.c
@@ -268,11 +268,11 @@ sctp_log_strm_del(struct sctp_queued_to_read *control, struct sctp_queued_to_rea
}
sctp_clog.x.strlog.stcb = control->stcb;
sctp_clog.x.strlog.n_tsn = control->sinfo_tsn;
- sctp_clog.x.strlog.n_sseq = control->sinfo_ssn;
+ sctp_clog.x.strlog.n_sseq = (uint16_t) control->mid;
sctp_clog.x.strlog.strm = control->sinfo_stream;
if (poschk != NULL) {
sctp_clog.x.strlog.e_tsn = poschk->sinfo_tsn;
- sctp_clog.x.strlog.e_sseq = poschk->sinfo_ssn;
+ sctp_clog.x.strlog.e_sseq = (uint16_t) poschk->mid;
} else {
sctp_clog.x.strlog.e_tsn = 0;
sctp_clog.x.strlog.e_sseq = 0;
@@ -1131,7 +1131,7 @@ sctp_init_asoc(struct sctp_inpcb *inp, struct sctp_tcb *stcb,
asoc->strmout[i].abandoned_sent[0] = 0;
asoc->strmout[i].abandoned_unsent[0] = 0;
#endif
- asoc->strmout[i].stream_no = i;
+ asoc->strmout[i].sid = i;
asoc->strmout[i].last_msg_incomplete = 0;
asoc->strmout[i].state = SCTP_STREAM_OPENING;
asoc->ss_functions.sctp_ss_init_stream(stcb, &asoc->strmout[i], NULL);
@@ -2975,9 +2975,9 @@ sctp_notify_send_failed(struct sctp_tcb *stcb, uint8_t sent, uint32_t error,
ssfe->ssfe_length = (uint32_t) (notifhdr_len + payload_len);
ssfe->ssfe_error = error;
/* not exactly what the user sent in, but should be close :) */
- ssfe->ssfe_info.snd_sid = chk->rec.data.stream_number;
+ ssfe->ssfe_info.snd_sid = chk->rec.data.sid;
ssfe->ssfe_info.snd_flags = chk->rec.data.rcv_flags;
- ssfe->ssfe_info.snd_ppid = chk->rec.data.payloadtype;
+ ssfe->ssfe_info.snd_ppid = chk->rec.data.ppid;
ssfe->ssfe_info.snd_context = chk->rec.data.context;
ssfe->ssfe_info.snd_assoc_id = sctp_get_associd(stcb);
ssfe->ssfe_assoc_id = sctp_get_associd(stcb);
@@ -2993,10 +2993,10 @@ sctp_notify_send_failed(struct sctp_tcb *stcb, uint8_t sent, uint32_t error,
ssf->ssf_length = (uint32_t) (notifhdr_len + payload_len);
ssf->ssf_error = error;
/* not exactly what the user sent in, but should be close :) */
- ssf->ssf_info.sinfo_stream = chk->rec.data.stream_number;
- ssf->ssf_info.sinfo_ssn = (uint16_t) chk->rec.data.stream_seq;
+ ssf->ssf_info.sinfo_stream = chk->rec.data.sid;
+ ssf->ssf_info.sinfo_ssn = (uint16_t) chk->rec.data.mid;
ssf->ssf_info.sinfo_flags = chk->rec.data.rcv_flags;
- ssf->ssf_info.sinfo_ppid = chk->rec.data.payloadtype;
+ ssf->ssf_info.sinfo_ppid = chk->rec.data.ppid;
ssf->ssf_info.sinfo_context = chk->rec.data.context;
ssf->ssf_info.sinfo_assoc_id = sctp_get_associd(stcb);
ssf->ssf_assoc_id = sctp_get_associd(stcb);
@@ -3079,7 +3079,7 @@ sctp_notify_send_failed2(struct sctp_tcb *stcb, uint32_t error,
ssfe->ssfe_length = (uint32_t) (notifhdr_len + sp->length);
ssfe->ssfe_error = error;
/* not exactly what the user sent in, but should be close :) */
- ssfe->ssfe_info.snd_sid = sp->stream;
+ ssfe->ssfe_info.snd_sid = sp->sid;
if (sp->some_taken) {
ssfe->ssfe_info.snd_flags = SCTP_DATA_LAST_FRAG;
} else {
@@ -3097,7 +3097,7 @@ sctp_notify_send_failed2(struct sctp_tcb *stcb, uint32_t error,
ssf->ssf_length = (uint32_t) (notifhdr_len + sp->length);
ssf->ssf_error = error;
/* not exactly what the user sent in, but should be close :) */
- ssf->ssf_info.sinfo_stream = sp->stream;
+ ssf->ssf_info.sinfo_stream = sp->sid;
ssf->ssf_info.sinfo_ssn = 0;
if (sp->some_taken) {
ssf->ssf_info.sinfo_flags = SCTP_DATA_LAST_FRAG;
@@ -3847,11 +3847,11 @@ sctp_report_all_outbound(struct sctp_tcb *stcb, uint16_t error, int holds_lock,
TAILQ_REMOVE(&asoc->sent_queue, chk, sctp_next);
asoc->sent_queue_cnt--;
if (chk->sent != SCTP_DATAGRAM_NR_ACKED) {
- if (asoc->strmout[chk->rec.data.stream_number].chunks_on_queues > 0) {
- asoc->strmout[chk->rec.data.stream_number].chunks_on_queues--;
+ if (asoc->strmout[chk->rec.data.sid].chunks_on_queues > 0) {
+ asoc->strmout[chk->rec.data.sid].chunks_on_queues--;
#ifdef INVARIANTS
} else {
- panic("No chunks on the queues for sid %u.", chk->rec.data.stream_number);
+ panic("No chunks on the queues for sid %u.", chk->rec.data.sid);
#endif
}
}
@@ -3871,11 +3871,11 @@ sctp_report_all_outbound(struct sctp_tcb *stcb, uint16_t error, int holds_lock,
TAILQ_FOREACH_SAFE(chk, &asoc->send_queue, sctp_next, nchk) {
TAILQ_REMOVE(&asoc->send_queue, chk, sctp_next);
asoc->send_queue_cnt--;
- if (asoc->strmout[chk->rec.data.stream_number].chunks_on_queues > 0) {
- asoc->strmout[chk->rec.data.stream_number].chunks_on_queues--;
+ if (asoc->strmout[chk->rec.data.sid].chunks_on_queues > 0) {
+ asoc->strmout[chk->rec.data.sid].chunks_on_queues--;
#ifdef INVARIANTS
} else {
- panic("No chunks on the queues for sid %u.", chk->rec.data.stream_number);
+ panic("No chunks on the queues for sid %u.", chk->rec.data.sid);
#endif
}
if (chk->data != NULL) {
@@ -4690,25 +4690,26 @@ sctp_release_pr_sctp_chunk(struct sctp_tcb *stcb, struct sctp_tmit_chunk *tp1,
struct sctp_stream_out *strq;
struct sctp_tmit_chunk *chk = NULL, *tp2;
struct sctp_stream_queue_pending *sp;
- uint16_t stream = 0, seq = 0;
+ uint32_t mid;
+ uint16_t sid;
uint8_t foundeom = 0;
int ret_sz = 0;
int notdone;
int do_wakeup_routine = 0;
- stream = tp1->rec.data.stream_number;
- seq = tp1->rec.data.stream_seq;
+ sid = tp1->rec.data.sid;
+ mid = tp1->rec.data.mid;
if (sent || !(tp1->rec.data.rcv_flags & SCTP_DATA_FIRST_FRAG)) {
stcb->asoc.abandoned_sent[0]++;
stcb->asoc.abandoned_sent[PR_SCTP_POLICY(tp1->flags)]++;
- stcb->asoc.strmout[stream].abandoned_sent[0]++;
+ stcb->asoc.strmout[sid].abandoned_sent[0]++;
#if defined(SCTP_DETAILED_STR_STATS)
stcb->asoc.strmout[stream].abandoned_sent[PR_SCTP_POLICY(tp1->flags)]++;
#endif
} else {
stcb->asoc.abandoned_unsent[0]++;
stcb->asoc.abandoned_unsent[PR_SCTP_POLICY(tp1->flags)]++;
- stcb->asoc.strmout[stream].abandoned_unsent[0]++;
+ stcb->asoc.strmout[sid].abandoned_unsent[0]++;
#if defined(SCTP_DETAILED_STR_STATS)
stcb->asoc.strmout[stream].abandoned_unsent[PR_SCTP_POLICY(tp1->flags)]++;
#endif
@@ -4762,8 +4763,8 @@ sctp_release_pr_sctp_chunk(struct sctp_tcb *stcb, struct sctp_tmit_chunk *tp1,
* sent queue.
*/
TAILQ_FOREACH_SAFE(tp1, &stcb->asoc.send_queue, sctp_next, tp2) {
- if ((tp1->rec.data.stream_number != stream) ||
- (tp1->rec.data.stream_seq != seq)) {
+ if ((tp1->rec.data.sid != sid) ||
+ (!SCTP_MID_EQ(stcb->asoc.idata_supported, tp1->rec.data.mid, mid))) {
break;
}
/*
@@ -4805,7 +4806,7 @@ sctp_release_pr_sctp_chunk(struct sctp_tcb *stcb, struct sctp_tmit_chunk *tp1,
* stream out queue.. yuck.
*/
SCTP_TCB_SEND_LOCK(stcb);
- strq = &stcb->asoc.strmout[stream];
+ strq = &stcb->asoc.strmout[sid];
sp = TAILQ_FIRST(&strq->outqueue);
if (sp != NULL) {
sp->discard_rest = 1;
@@ -4832,23 +4833,23 @@ sctp_release_pr_sctp_chunk(struct sctp_tcb *stcb, struct sctp_tmit_chunk *tp1,
chk->asoc = &stcb->asoc;
if (stcb->asoc.idata_supported == 0) {
if (sp->sinfo_flags & SCTP_UNORDERED) {
- chk->rec.data.stream_seq = 0;
+ chk->rec.data.mid = 0;
} else {
- chk->rec.data.stream_seq = strq->next_mid_ordered;
+ chk->rec.data.mid = strq->next_mid_ordered;
}
} else {
if (sp->sinfo_flags & SCTP_UNORDERED) {
- chk->rec.data.stream_seq = strq->next_mid_unordered;
+ chk->rec.data.mid = strq->next_mid_unordered;
} else {
- chk->rec.data.stream_seq = strq->next_mid_ordered;
+ chk->rec.data.mid = strq->next_mid_ordered;
}
}
- chk->rec.data.stream_number = sp->stream;
- chk->rec.data.payloadtype = sp->ppid;
+ chk->rec.data.sid = sp->sid;
+ chk->rec.data.ppid = sp->ppid;
chk->rec.data.context = sp->context;
chk->flags = sp->act_flags;
chk->whoTo = NULL;
- chk->rec.data.TSN_seq = atomic_fetchadd_int(&stcb->asoc.sending_seq, 1);
+ chk->rec.data.tsn = atomic_fetchadd_int(&stcb->asoc.sending_seq, 1);
strq->chunks_on_queues++;
TAILQ_INSERT_TAIL(&stcb->asoc.sent_queue, chk, sctp_next);
stcb->asoc.sent_queue_cnt++;
@@ -5527,7 +5528,7 @@ found_one:
/* First lets get off the sinfo and sockaddr info */
if ((sinfo != NULL) && (filling_sinfo != 0)) {
sinfo->sinfo_stream = control->sinfo_stream;
- sinfo->sinfo_ssn = (uint16_t) control->sinfo_ssn;
+ sinfo->sinfo_ssn = (uint16_t) control->mid;
sinfo->sinfo_flags = control->sinfo_flags;
sinfo->sinfo_ppid = control->sinfo_ppid;
sinfo->sinfo_context = control->sinfo_context;
@@ -5603,7 +5604,7 @@ found_one:
entry = &inp->readlog[index];
entry->vtag = control->sinfo_assoc_id;
entry->strm = control->sinfo_stream;
- entry->seq = control->sinfo_ssn;
+ entry->seq = (uint16_t) control->mid;
entry->sz = control->length;
entry->flgs = control->sinfo_flags;
}
OpenPOWER on IntegriCloud