aboutsummaryrefslogtreecommitdiffstats
path: root/net/sctp/ulpqueue.c
diff options
context:
space:
mode:
authorXin Long <lucien.xin@gmail.com>2017-12-08 08:04:04 -0500
committerDavid S. Miller <davem@davemloft.net>2017-12-11 11:23:05 -0500
commitbd4d627dbd5adb8130d5c54a4135d89f45e41905 (patch)
tree7b6199437964741f39378f2571a206fe0e1fcd7f /net/sctp/ulpqueue.c
parent9d4ceaf154a947e69648041bcb11a24a7a40c380 (diff)
sctp: implement ulpevent_data for sctp_stream_interleave
ulpevent_data is added as a member of sctp_stream_interleave, used to do the most process in ulpq, including to convert data or idata chunk to event, reasm them in reasm queue and put them in lobby queue in right order, and deliver them up to user sk rx queue. This procedure is described in section 2.2.3 of RFC8260. It adds most functions for idata here to do the similar process as the old functions for data. But since the details are very different between them, the old functions can not be reused for idata. event->ssn and event->ppid settings are moved to ulpevent_data from sctp_ulpevent_make_rcvmsg, so that sctp_ulpevent_make_rcvmsg could work for both data and idata. Note that mid is added in sctp_ulpevent for idata, __packed has to be used for defining sctp_ulpevent, or it would exceeds the skb cb that saves a sctp_ulpevent variable for ulp layer process. Signed-off-by: Xin Long <lucien.xin@gmail.com> Acked-by: Marcelo Ricardo Leitner <marcelo.leitner@gmail.com> Acked-by: Neil Horman <nhorman@tuxdriver.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/sctp/ulpqueue.c')
-rw-r--r--net/sctp/ulpqueue.c12
1 files changed, 8 insertions, 4 deletions
diff --git a/net/sctp/ulpqueue.c b/net/sctp/ulpqueue.c
index a71be33f3afe..0d07f2a6cb35 100644
--- a/net/sctp/ulpqueue.c
+++ b/net/sctp/ulpqueue.c
@@ -104,6 +104,9 @@ int sctp_ulpq_tail_data(struct sctp_ulpq *ulpq, struct sctp_chunk *chunk,
104 if (!event) 104 if (!event)
105 return -ENOMEM; 105 return -ENOMEM;
106 106
107 event->ssn = ntohs(chunk->subh.data_hdr->ssn);
108 event->ppid = chunk->subh.data_hdr->ppid;
109
107 /* Do reassembly if needed. */ 110 /* Do reassembly if needed. */
108 event = sctp_ulpq_reasm(ulpq, event); 111 event = sctp_ulpq_reasm(ulpq, event);
109 112
@@ -328,9 +331,10 @@ static void sctp_ulpq_store_reasm(struct sctp_ulpq *ulpq,
328 * payload was fragmented on the way and ip had to reassemble them. 331 * payload was fragmented on the way and ip had to reassemble them.
329 * We add the rest of skb's to the first skb's fraglist. 332 * We add the rest of skb's to the first skb's fraglist.
330 */ 333 */
331static struct sctp_ulpevent *sctp_make_reassembled_event(struct net *net, 334struct sctp_ulpevent *sctp_make_reassembled_event(struct net *net,
332 struct sk_buff_head *queue, struct sk_buff *f_frag, 335 struct sk_buff_head *queue,
333 struct sk_buff *l_frag) 336 struct sk_buff *f_frag,
337 struct sk_buff *l_frag)
334{ 338{
335 struct sk_buff *pos; 339 struct sk_buff *pos;
336 struct sk_buff *new = NULL; 340 struct sk_buff *new = NULL;
@@ -853,7 +857,7 @@ static struct sctp_ulpevent *sctp_ulpq_order(struct sctp_ulpq *ulpq,
853 struct sctp_stream *stream; 857 struct sctp_stream *stream;
854 858
855 /* Check if this message needs ordering. */ 859 /* Check if this message needs ordering. */
856 if (SCTP_DATA_UNORDERED & event->msg_flags) 860 if (event->msg_flags & SCTP_DATA_UNORDERED)
857 return event; 861 return event;
858 862
859 /* Note: The stream ID must be verified before this routine. */ 863 /* Note: The stream ID must be verified before this routine. */