svn commit: r206758 - head/sys/netinet

Michael Tuexen tuexen at FreeBSD.org
Sat Apr 17 12:22:45 UTC 2010


Author: tuexen
Date: Sat Apr 17 12:22:44 2010
New Revision: 206758
URL: http://svn.freebsd.org/changeset/base/206758

Log:
  Fix a bug where SACKs are not sent when they should.
  Move some protection code to INVARIANTS.
  Cleanups.
  
  MFC after: 3 days.

Modified:
  head/sys/netinet/sctp_indata.c

Modified: head/sys/netinet/sctp_indata.c
==============================================================================
--- head/sys/netinet/sctp_indata.c	Sat Apr 17 12:01:50 2010	(r206757)
+++ head/sys/netinet/sctp_indata.c	Sat Apr 17 12:22:44 2010	(r206758)
@@ -1466,7 +1466,7 @@ sctp_process_a_data_chunk(struct sctp_tc
 		asoc->send_sack = 1;
 	}
 	protocol_id = ch->dp.protocol_id;
-	ordered = ((ch->ch.chunk_flags & SCTP_DATA_UNORDERED) == 0);
+	ordered = ((chunk_flags & SCTP_DATA_UNORDERED) == 0);
 	if (SCTP_BASE_SYSCTL(sctp_logging_level) & SCTP_MAP_LOGGING_ENABLE) {
 		sctp_log_map(tsn, asoc->cumulative_tsn, asoc->highest_tsn_inside_map, SCTP_MAP_TSN_ENTERS);
 	}
@@ -2300,7 +2300,12 @@ sctp_slide_mapping_arrays(struct sctp_tc
 	if ((asoc->cumulative_tsn == highest_tsn) && (at >= 8)) {
 		/* The complete array was completed by a single FR */
 		/* highest becomes the cum-ack */
-		int clr, i;
+		int clr;
+
+#ifdef INVARIANTS
+		unsigned int i;
+
+#endif
 
 		/* clear the array */
 		clr = ((at + 7) >> 3);
@@ -2309,12 +2314,14 @@ sctp_slide_mapping_arrays(struct sctp_tc
 		}
 		memset(asoc->mapping_array, 0, clr);
 		memset(asoc->nr_mapping_array, 0, clr);
+#ifdef INVARIANTS
 		for (i = 0; i < asoc->mapping_array_size; i++) {
 			if ((asoc->mapping_array[i]) || (asoc->nr_mapping_array[i])) {
 				printf("Error Mapping array's not clean at clear\n");
 				sctp_print_mapping_array(asoc);
 			}
 		}
+#endif
 		asoc->mapping_array_base_tsn = asoc->cumulative_tsn + 1;
 		asoc->highest_tsn_inside_nr_map = asoc->highest_tsn_inside_map = asoc->cumulative_tsn;
 	} else if (at >= 8) {
@@ -2371,10 +2378,8 @@ sctp_slide_mapping_arrays(struct sctp_tc
 			int ii;
 
 			for (ii = 0; ii < distance; ii++) {
-				asoc->mapping_array[ii] =
-				    asoc->mapping_array[slide_from + ii];
-				asoc->nr_mapping_array[ii] =
-				    asoc->nr_mapping_array[slide_from + ii];
+				asoc->mapping_array[ii] = asoc->mapping_array[slide_from + ii];
+				asoc->nr_mapping_array[ii] = asoc->nr_mapping_array[slide_from + ii];
 
 			}
 			for (ii = distance; ii < asoc->mapping_array_size; ii++) {
@@ -2808,8 +2813,8 @@ sctp_process_data(struct mbuf **mm, int 
 		stcb->asoc.send_sack = 1;
 	}
 	/* Start a sack timer or QUEUE a SACK for sending */
-	if ((stcb->asoc.cumulative_tsn == stcb->asoc.highest_tsn_inside_map) &&
-	    (stcb->asoc.mapping_array[0] != 0xff)) {
+	if ((stcb->asoc.cumulative_tsn == stcb->asoc.highest_tsn_inside_nr_map) &&
+	    (stcb->asoc.nr_mapping_array[0] != 0xff)) {
 		if ((stcb->asoc.data_pkts_seen >= stcb->asoc.sack_freq) ||
 		    (stcb->asoc.delayed_ack == 0) ||
 		    (stcb->asoc.numduptsns) ||


More information about the svn-src-all mailing list