Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 18 Dec 2016 13:04:29 +0000 (UTC)
From:      Michael Tuexen <tuexen@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org
Subject:   svn commit: r310219 - stable/11/sys/netinet
Message-ID:  <201612181304.uBID4TXK074282@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: tuexen
Date: Sun Dec 18 13:04:29 2016
New Revision: 310219
URL: https://svnweb.freebsd.org/changeset/base/310219

Log:
  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

Modified:
  stable/11/sys/netinet/sctp_cc_functions.c
  stable/11/sys/netinet/sctp_constants.h
  stable/11/sys/netinet/sctp_header.h
  stable/11/sys/netinet/sctp_indata.c
  stable/11/sys/netinet/sctp_indata.h
  stable/11/sys/netinet/sctp_input.c
  stable/11/sys/netinet/sctp_output.c
  stable/11/sys/netinet/sctp_pcb.c
  stable/11/sys/netinet/sctp_ss_functions.c
  stable/11/sys/netinet/sctp_structs.h
  stable/11/sys/netinet/sctp_timer.c
  stable/11/sys/netinet/sctp_usrreq.c
  stable/11/sys/netinet/sctp_var.h
  stable/11/sys/netinet/sctputil.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/sys/netinet/sctp_cc_functions.c
==============================================================================
--- stable/11/sys/netinet/sctp_cc_functions.c	Sun Dec 18 13:00:11 2016	(r310218)
+++ stable/11/sys/netinet/sctp_cc_functions.c	Sun Dec 18 13:04:29 2016	(r310219)
@@ -205,7 +205,7 @@ sctp_cwnd_update_after_fr(struct sctp_tc
 					/* 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_tc
 					/* 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
 					/* 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
 					/* 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 sc
 					/* 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 sc
 					/* 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,

Modified: stable/11/sys/netinet/sctp_constants.h
==============================================================================
--- stable/11/sys/netinet/sctp_constants.h	Sun Dec 18 13:00:11 2016	(r310218)
+++ stable/11/sys/netinet/sctp_constants.h	Sun Dec 18 13:04:29 2016	(r310219)
@@ -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)

Modified: stable/11/sys/netinet/sctp_header.h
==============================================================================
--- stable/11/sys/netinet/sctp_header.h	Sun Dec 18 13:00:11 2016	(r310218)
+++ stable/11/sys/netinet/sctp_header.h	Sun Dec 18 13:04:29 2016	(r310219)
@@ -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 {

Modified: stable/11/sys/netinet/sctp_indata.c
==============================================================================
--- stable/11/sys/netinet/sctp_indata.c	Sun Dec 18 13:00:11 2016	(r310218)
+++ stable/11/sys/netinet/sctp_indata.c	Sun Dec 18 13:04:29 2016	(r310219)
@@ -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 *
 		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
 		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
 					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 *stc
 		    "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_tc
 	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 s
 {
 	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 sc
 {
 	/*
 	 * 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 sc
 		/* 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 sc
 			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 sc
 			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 sc
 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
 	}
 	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_queu
 	} 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_tc
 		/* 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_tc
 			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_tc
 
 		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_tc
 				 * 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_tc
 				/* 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_tc
 				 * 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_tc
 			}
 			/* 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_tc
 		 */
 		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_tc
 				 */
 				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_tc
 		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_tc
 	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_tc
 }
 
 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_tc
 	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_tc
 		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_tc
 	 */
 
 	/* 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_tc
 			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_tc
 		}
 		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_tc
 		 * 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_tc
 		 * 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_tc
 		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_tc
 	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_tc
 	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_tc
 		}
 		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_tc
 		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_tc
 
 		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_tc
 			}
 			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_tc
 		}
 		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_tc
 			    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_tc
 	/* 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_t
 			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_t
 						 * 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;

*** DIFF OUTPUT TRUNCATED AT 1000 LINES ***



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201612181304.uBID4TXK074282>