sctp: introduce sctp_chunk_stream_no
authorMarcelo Ricardo Leitner <marcelo.leitner@gmail.com>
Tue, 3 Oct 2017 22:20:12 +0000 (19:20 -0300)
committerDavid S. Miller <davem@davemloft.net>
Tue, 3 Oct 2017 23:27:28 +0000 (16:27 -0700)
Add a helper to fetch the stream number from a given chunk.

Tested-by: Xin Long <lucien.xin@gmail.com>
Signed-off-by: Marcelo Ricardo Leitner <marcelo.leitner@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
include/net/sctp/structs.h

index 9b2b30b..c48f799 100644 (file)
@@ -642,6 +642,11 @@ void sctp_init_addrs(struct sctp_chunk *, union sctp_addr *,
                     union sctp_addr *);
 const union sctp_addr *sctp_source(const struct sctp_chunk *chunk);
 
+static inline __u16 sctp_chunk_stream_no(struct sctp_chunk *ch)
+{
+       return ntohs(ch->subh.data_hdr->stream);
+}
+
 enum {
        SCTP_ADDR_NEW,          /* new address added to assoc/ep */
        SCTP_ADDR_SRC,          /* address can be used as source */