]> git.karo-electronics.de Git - linux-beck.git/commitdiff
sctp: add support for generating stream ssn reset event notification
authorXin Long <lucien.xin@gmail.com>
Fri, 17 Feb 2017 04:45:38 +0000 (12:45 +0800)
committerDavid S. Miller <davem@davemloft.net>
Sun, 19 Feb 2017 23:17:59 +0000 (18:17 -0500)
This patch is to add Stream Reset Event described in rfc6525
section 6.1.1.

Signed-off-by: Xin Long <lucien.xin@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
include/net/sctp/ulpevent.h
include/uapi/linux/sctp.h
net/sctp/ulpevent.c

index 2c098cd7e7e202b6fa96e97ccb56471df27cec91..324b5965fc4de505ca98fbbb9aedc0d3a0039742 100644 (file)
@@ -128,6 +128,10 @@ struct sctp_ulpevent *sctp_ulpevent_make_authkey(
 struct sctp_ulpevent *sctp_ulpevent_make_sender_dry_event(
        const struct sctp_association *asoc, gfp_t gfp);
 
+struct sctp_ulpevent *sctp_ulpevent_make_stream_reset_event(
+       const struct sctp_association *asoc, __u16 flags,
+       __u16 stream_num, __u16 *stream_list, gfp_t gfp);
+
 void sctp_ulpevent_read_sndrcvinfo(const struct sctp_ulpevent *event,
                                   struct msghdr *);
 void sctp_ulpevent_read_rcvinfo(const struct sctp_ulpevent *event,
index a91a9cccbae69024dcce98266e4084f3dee86b8a..d3ae381fcf3327489c82e2f47eb39a363ec030c7 100644 (file)
@@ -490,6 +490,18 @@ struct sctp_sender_dry_event {
        sctp_assoc_t sender_dry_assoc_id;
 };
 
+#define SCTP_STREAM_RESET_INCOMING_SSN 0x0001
+#define SCTP_STREAM_RESET_OUTGOING_SSN 0x0002
+#define SCTP_STREAM_RESET_DENIED       0x0004
+#define SCTP_STREAM_RESET_FAILED       0x0008
+struct sctp_stream_reset_event {
+       __u16 strreset_type;
+       __u16 strreset_flags;
+       __u32 strreset_length;
+       sctp_assoc_t strreset_assoc_id;
+       __u16 strreset_stream_list[];
+};
+
 /*
  * Described in Section 7.3
  *   Ancillary Data and Notification Interest Options
@@ -505,6 +517,7 @@ struct sctp_event_subscribe {
        __u8 sctp_adaptation_layer_event;
        __u8 sctp_authentication_event;
        __u8 sctp_sender_dry_event;
+       __u8 sctp_stream_reset_event;
 };
 
 /*
@@ -529,6 +542,7 @@ union sctp_notification {
        struct sctp_pdapi_event sn_pdapi_event;
        struct sctp_authkey_event sn_authkey_event;
        struct sctp_sender_dry_event sn_sender_dry_event;
+       struct sctp_stream_reset_event sn_strreset_event;
 };
 
 /* Section 5.3.1
@@ -556,6 +570,8 @@ enum sctp_sn_type {
 #define SCTP_AUTHENTICATION_INDICATION SCTP_AUTHENTICATION_EVENT
        SCTP_SENDER_DRY_EVENT,
 #define SCTP_SENDER_DRY_EVENT          SCTP_SENDER_DRY_EVENT
+       SCTP_STREAM_RESET_EVENT,
+#define SCTP_STREAM_RESET_EVENT                SCTP_STREAM_RESET_EVENT
 };
 
 /* Notification error codes used to fill up the error fields in some
index bea00058ce354b7c910cab96d3f2ec4747763a10..c8881bc542a066e6f7f234beea3c7208394242c5 100644 (file)
@@ -854,6 +854,35 @@ struct sctp_ulpevent *sctp_ulpevent_make_sender_dry_event(
        return event;
 }
 
+struct sctp_ulpevent *sctp_ulpevent_make_stream_reset_event(
+       const struct sctp_association *asoc, __u16 flags, __u16 stream_num,
+       __u16 *stream_list, gfp_t gfp)
+{
+       struct sctp_stream_reset_event *sreset;
+       struct sctp_ulpevent *event;
+       struct sk_buff *skb;
+       int length, i;
+
+       length = sizeof(struct sctp_stream_reset_event) + 2 * stream_num;
+       event = sctp_ulpevent_new(length, MSG_NOTIFICATION, gfp);
+       if (!event)
+               return NULL;
+
+       skb = sctp_event2skb(event);
+       sreset = (struct sctp_stream_reset_event *)skb_put(skb, length);
+
+       sreset->strreset_type = SCTP_STREAM_RESET_EVENT;
+       sreset->strreset_flags = flags;
+       sreset->strreset_length = length;
+       sctp_ulpevent_set_owner(event, asoc);
+       sreset->strreset_assoc_id = sctp_assoc2id(asoc);
+
+       for (i = 0; i < stream_num; i++)
+               sreset->strreset_stream_list[i] = ntohs(stream_list[i]);
+
+       return event;
+}
+
 /* Return the notification type, assuming this is a notification
  * event.
  */