]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
sctp: add support for generating add stream change event notification
authorXin Long <lucien.xin@gmail.com>
Fri, 10 Mar 2017 04:11:08 +0000 (12:11 +0800)
committerDavid S. Miller <davem@davemloft.net>
Mon, 13 Mar 2017 06:22:23 +0000 (23:22 -0700)
This patch is to add Stream Change Event described in rfc6525
section 6.1.3.

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 2ab7ed44de521cfbee973699c1d3de4b333a63cc..1060494ac230b80caca57f6963dca2692ae10b9d 100644 (file)
@@ -136,6 +136,10 @@ struct sctp_ulpevent *sctp_ulpevent_make_assoc_reset_event(
        const struct sctp_association *asoc, __u16 flags,
         __u32 local_tsn, __u32 remote_tsn, gfp_t gfp);
 
+struct sctp_ulpevent *sctp_ulpevent_make_stream_change_event(
+       const struct sctp_association *asoc, __u16 flags,
+       __u32 strchange_instrms, __u32 strchange_outstrms, 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 77358297c2f95f6b7f07d047bcfdd6236aa1afee..fd652e6501b47e53cd5afdf934cb8064d9453592 100644 (file)
@@ -513,6 +513,17 @@ struct sctp_assoc_reset_event {
        __u32 assocreset_remote_tsn;
 };
 
+#define SCTP_ASSOC_CHANGE_DENIED       0x0004
+#define SCTP_ASSOC_CHANGE_FAILED       0x0008
+struct sctp_stream_change_event {
+       __u16 strchange_type;
+       __u16 strchange_flags;
+       __u32 strchange_length;
+       sctp_assoc_t strchange_assoc_id;
+       __u16 strchange_instrms;
+       __u16 strchange_outstrms;
+};
+
 /*
  * Described in Section 7.3
  *   Ancillary Data and Notification Interest Options
@@ -530,6 +541,7 @@ struct sctp_event_subscribe {
        __u8 sctp_sender_dry_event;
        __u8 sctp_stream_reset_event;
        __u8 sctp_assoc_reset_event;
+       __u8 sctp_stream_change_event;
 };
 
 /*
@@ -556,6 +568,7 @@ union sctp_notification {
        struct sctp_sender_dry_event sn_sender_dry_event;
        struct sctp_stream_reset_event sn_strreset_event;
        struct sctp_assoc_reset_event sn_assocreset_event;
+       struct sctp_stream_change_event sn_strchange_event;
 };
 
 /* Section 5.3.1
@@ -587,6 +600,8 @@ enum sctp_sn_type {
 #define SCTP_STREAM_RESET_EVENT                SCTP_STREAM_RESET_EVENT
        SCTP_ASSOC_RESET_EVENT,
 #define SCTP_ASSOC_RESET_EVENT         SCTP_ASSOC_RESET_EVENT
+       SCTP_STREAM_CHANGE_EVENT,
+#define SCTP_STREAM_CHANGE_EVENT       SCTP_STREAM_CHANGE_EVENT
 };
 
 /* Notification error codes used to fill up the error fields in some
index 420d7f35256a6c921f68313a2feeaf6fc42c785c..ec2b3e013c2f4ba48eabfc8d8ed20921cabc08a1 100644 (file)
@@ -911,6 +911,34 @@ struct sctp_ulpevent *sctp_ulpevent_make_assoc_reset_event(
        return event;
 }
 
+struct sctp_ulpevent *sctp_ulpevent_make_stream_change_event(
+       const struct sctp_association *asoc, __u16 flags,
+       __u32 strchange_instrms, __u32 strchange_outstrms, gfp_t gfp)
+{
+       struct sctp_stream_change_event *schange;
+       struct sctp_ulpevent *event;
+       struct sk_buff *skb;
+
+       event = sctp_ulpevent_new(sizeof(struct sctp_stream_change_event),
+                                 MSG_NOTIFICATION, gfp);
+       if (!event)
+               return NULL;
+
+       skb = sctp_event2skb(event);
+       schange = (struct sctp_stream_change_event *)
+               skb_put(skb, sizeof(struct sctp_stream_change_event));
+
+       schange->strchange_type = SCTP_STREAM_CHANGE_EVENT;
+       schange->strchange_flags = flags;
+       schange->strchange_length = sizeof(struct sctp_stream_change_event);
+       sctp_ulpevent_set_owner(event, asoc);
+       schange->strchange_assoc_id = sctp_assoc2id(asoc);
+       schange->strchange_instrms = strchange_instrms;
+       schange->strchange_outstrms = strchange_outstrms;
+
+       return event;
+}
+
 /* Return the notification type, assuming this is a notification
  * event.
  */