Author: tuexen
Date: Thu Jun 30 06:06:35 2016
New Revision: 302293
URL: https://svnweb.freebsd.org/changeset/base/302293

Log:
  This patch fixes two bugs related to the setting of the I-Bit
  for SCTP DATA and I-DATA chunks.
  * For fragmented user messages, set the I-Bit only on the last
    fragment.
  * When using explicit EOR mode, set the I-Bit on the last
    fragment, whenever SCTP_SACK_IMMEDIATELY was set in snd_flags
    for any of the send() calls.
  
  Approved by:  re (hrs)
  MFC after:    1 week

Modified:
  head/sys/netinet/sctp_output.c

Modified: head/sys/netinet/sctp_output.c
==============================================================================
--- head/sys/netinet/sctp_output.c      Thu Jun 30 05:18:37 2016        
(r302292)
+++ head/sys/netinet/sctp_output.c      Thu Jun 30 06:06:35 2016        
(r302293)
@@ -7325,10 +7325,12 @@ re_look:
                        /* All of it fits in the MTU */
                        if (sp->some_taken) {
                                rcv_flags |= SCTP_DATA_LAST_FRAG;
-                               sp->put_last_out = 1;
                        } else {
                                rcv_flags |= SCTP_DATA_NOT_FRAG;
-                               sp->put_last_out = 1;
+                       }
+                       sp->put_last_out = 1;
+                       if (sp->sinfo_flags & SCTP_SACK_IMMEDIATELY) {
+                               rcv_flags |= SCTP_DATA_SACK_IMMEDIATELY;
                        }
                } else {
                        /* Not all of it fits, we fragment */
@@ -7396,8 +7398,8 @@ re_look:
        if (sp->sinfo_flags & SCTP_UNORDERED) {
                rcv_flags |= SCTP_DATA_UNORDERED;
        }
-       if ((SCTP_BASE_SYSCTL(sctp_enable_sack_immediately) && 
((sp->sinfo_flags & SCTP_EOF) == SCTP_EOF)) ||
-           ((sp->sinfo_flags & SCTP_SACK_IMMEDIATELY) == 
SCTP_SACK_IMMEDIATELY)) {
+       if (SCTP_BASE_SYSCTL(sctp_enable_sack_immediately) &&
+           (sp->sinfo_flags & SCTP_EOF) == SCTP_EOF) {
                rcv_flags |= SCTP_DATA_SACK_IMMEDIATELY;
        }
        /* clear out the chunk before setting up */
@@ -13280,7 +13282,9 @@ skip_preblock:
                                sctp_snd_sb_alloc(stcb, sndout);
                                atomic_add_int(&sp->length, sndout);
                                len += sndout;
-
+                               if (srcv->sinfo_flags & SCTP_SACK_IMMEDIATELY) {
+                                       sp->sinfo_flags |= 
SCTP_SACK_IMMEDIATELY;
+                               }
                                /* Did we reach EOR? */
                                if ((uio->uio_resid == 0) &&
                                    ((user_marks_eor == 0) ||
_______________________________________________
[email protected] mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "[email protected]"

Reply via email to