Author: tuexen
Date: Sun Jul 17 13:14:51 2016
New Revision: 302949
URL: https://svnweb.freebsd.org/changeset/base/302949

Log:
  Fix the PR-SCTP behaviour.
  This is done by rrs@.
  
  MFC after:    3 days

Modified:
  head/sys/netinet/sctp_constants.h
  head/sys/netinet/sctp_header.h
  head/sys/netinet/sctp_indata.c
  head/sys/netinet/sctp_output.c

Modified: head/sys/netinet/sctp_constants.h
==============================================================================
--- head/sys/netinet/sctp_constants.h   Sun Jul 17 13:10:57 2016        
(r302948)
+++ head/sys/netinet/sctp_constants.h   Sun Jul 17 13:14:51 2016        
(r302949)
@@ -345,6 +345,7 @@ __FBSDID("$FreeBSD$");
 #define SCTP_RTT_FROM_NON_DATA 0
 #define SCTP_RTT_FROM_DATA     1
 
+#define PR_SCTP_UNORDERED_FLAG 0x0001
 
 /* IP hdr (20/40) + 12+2+2 (enet) + sctp common 12 */
 #define SCTP_FIRST_MBUF_RESV 68

Modified: head/sys/netinet/sctp_header.h
==============================================================================
--- head/sys/netinet/sctp_header.h      Sun Jul 17 13:10:57 2016        
(r302948)
+++ head/sys/netinet/sctp_header.h      Sun Jul 17 13:14:51 2016        
(r302949)
@@ -397,7 +397,7 @@ struct sctp_strseq {
 
 struct sctp_strseq_mid {
        uint16_t stream;
-       uint16_t reserved;
+       uint16_t flags;
        uint32_t msg_id;
 };
 

Modified: head/sys/netinet/sctp_indata.c
==============================================================================
--- head/sys/netinet/sctp_indata.c      Sun Jul 17 13:10:57 2016        
(r302948)
+++ head/sys/netinet/sctp_indata.c      Sun Jul 17 13:14:51 2016        
(r302949)
@@ -5283,10 +5283,11 @@ sctp_kick_prsctp_reorder_queue(struct sc
        }
 }
 
+
 static void
 sctp_flush_reassm_for_str_seq(struct sctp_tcb *stcb,
     struct sctp_association *asoc,
-    uint16_t stream, uint32_t seq)
+    uint16_t stream, uint32_t seq, int ordered, int old)
 {
        struct sctp_queued_to_read *control;
        struct sctp_stream_in *strm;
@@ -5301,7 +5302,7 @@ sctp_flush_reassm_for_str_seq(struct sct
         * queue.
         */
        strm = &asoc->strmin[stream];
-       control = find_reasm_entry(strm, (uint32_t) seq, 0, 0);
+       control = find_reasm_entry(strm, (uint32_t) seq, ordered, old);
        if (control == NULL) {
                /* Not found */
                return;
@@ -5433,6 +5434,7 @@ sctp_handle_forward_tsn(struct sctp_tcb 
                unsigned int num_str;
                uint32_t sequence;
                uint16_t stream;
+               uint16_t ordered, flags;
                int old;
                struct sctp_strseq *stseq, strseqbuf;
                struct sctp_strseq_mid *stseq_m, strseqbuf_m;
@@ -5458,6 +5460,12 @@ sctp_handle_forward_tsn(struct sctp_tcb 
                                }
                                stream = ntohs(stseq_m->stream);
                                sequence = ntohl(stseq_m->msg_id);
+                               flags = ntohs(stseq_m->flags);
+                               if (flags & PR_SCTP_UNORDERED_FLAG) {
+                                       ordered = 0;
+                               } else {
+                                       ordered = 1;
+                               }
                        } else {
                                stseq = (struct sctp_strseq *)sctp_m_getptr(m, 
offset,
                                    sizeof(struct sctp_strseq),
@@ -5468,6 +5476,7 @@ sctp_handle_forward_tsn(struct sctp_tcb 
                                }
                                stream = ntohs(stseq->stream);
                                sequence = (uint32_t) ntohs(stseq->sequence);
+                               ordered = 1;
                        }
                        /* Convert */
 
@@ -5493,7 +5502,7 @@ sctp_handle_forward_tsn(struct sctp_tcb 
                                asoc->fragmented_delivery_inprogress = 0;
                        }
                        strm = &asoc->strmin[stream];
-                       sctp_flush_reassm_for_str_seq(stcb, asoc, stream, 
sequence);
+                       sctp_flush_reassm_for_str_seq(stcb, asoc, stream, 
sequence, ordered, old);
                        TAILQ_FOREACH(ctl, &stcb->sctp_ep->read_queue, next) {
                                if ((ctl->sinfo_stream == stream) &&
                                    (ctl->sinfo_ssn == sequence)) {

Modified: head/sys/netinet/sctp_output.c
==============================================================================
--- head/sys/netinet/sctp_output.c      Sun Jul 17 13:10:57 2016        
(r302948)
+++ head/sys/netinet/sctp_output.c      Sun Jul 17 13:14:51 2016        
(r302949)
@@ -10383,7 +10383,7 @@ sctp_fill_in_rest:
                                /* no more to look at */
                                break;
                        }
-                       if (at->rec.data.rcv_flags & SCTP_DATA_UNORDERED) {
+                       if ((at->rec.data.rcv_flags & SCTP_DATA_UNORDERED) && 
old) {
                                /* We don't report these */
                                continue;
                        }
@@ -10504,7 +10504,7 @@ sctp_fill_in_rest:
                        tp1 = TAILQ_NEXT(at, sctp_next);
                        if (tp1 == NULL)
                                break;
-                       if (at->rec.data.rcv_flags & SCTP_DATA_UNORDERED) {
+                       if (old && (at->rec.data.rcv_flags & 
SCTP_DATA_UNORDERED)) {
                                /* We don't report these */
                                i--;
                                at = tp1;
@@ -10519,8 +10519,11 @@ sctp_fill_in_rest:
                                strseq++;
                        } else {
                                strseq_m->stream = 
ntohs(at->rec.data.stream_number);
-                               strseq_m->reserved = ntohs(0);
                                strseq_m->msg_id = 
ntohl(at->rec.data.stream_seq);
+                               if (at->rec.data.rcv_flags & 
SCTP_DATA_UNORDERED)
+                                       strseq_m->flags = 
ntohs(PR_SCTP_UNORDERED_FLAG);
+                               else
+                                       strseq_m->flags = 0;
                                strseq_m++;
                        }
                        at = tp1;
_______________________________________________
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"

Reply via email to