Author: tuexen
Date: Thu Nov 11 18:41:03 2010
New Revision: 215134
URL: http://svn.freebsd.org/changeset/base/215134

Log:
  Fix the SACK/NR-SACK generation code.
  
  MFC after: 3 days.

Modified:
  head/sys/netinet/sctp_output.c

Modified: head/sys/netinet/sctp_output.c
==============================================================================
--- head/sys/netinet/sctp_output.c      Thu Nov 11 18:35:28 2010        
(r215133)
+++ head/sys/netinet/sctp_output.c      Thu Nov 11 18:41:03 2010        
(r215134)
@@ -10118,19 +10118,18 @@ sctp_send_sack(struct sctp_tcb *stcb)
                }
        }
 
-       if (((type == SCTP_SELECTIVE_ACK) &&
-           (((asoc->mapping_array[0] | asoc->nr_mapping_array[0]) & 0x01) == 
0x00)) ||
-           ((type == SCTP_NR_SELECTIVE_ACK) &&
-           ((asoc->mapping_array[0] & 0x01) == 0x00))) {
-               sel_start = 0;
-       } else {
-               sel_start = 1;
-       }
        if (compare_with_wrap(asoc->mapping_array_base_tsn, 
asoc->cumulative_tsn, MAX_TSN)) {
                offset = 1;
        } else {
                offset = asoc->mapping_array_base_tsn - asoc->cumulative_tsn;
        }
+       if ((offset == 1) ||
+           ((type == SCTP_NR_SELECTIVE_ACK) &&
+           ((asoc->mapping_array[0] & (1 << (1 - offset))) == 0))) {
+               sel_start = 0;
+       } else {
+               sel_start = 1;
+       }
        if (((type == SCTP_SELECTIVE_ACK) &&
            compare_with_wrap(highest_tsn, asoc->cumulative_tsn, MAX_TSN)) ||
            ((type == SCTP_NR_SELECTIVE_ACK) &&
@@ -10200,7 +10199,7 @@ sctp_send_sack(struct sctp_tcb *stcb)
                        siz = (((MAX_TSN - asoc->mapping_array_base_tsn) + 1) + 
asoc->highest_tsn_inside_nr_map + 7) / 8;
                }
 
-               if ((asoc->nr_mapping_array[0] & 0x01) == 0x00) {
+               if ((asoc->nr_mapping_array[0] & (1 << (1 - offset))) == 0) {
                        sel_start = 0;
                } else {
                        sel_start = 1;
_______________________________________________
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"

Reply via email to