netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Xin Long <lucien.xin@gmail.com>
To: network dev <netdev@vger.kernel.org>, linux-sctp@vger.kernel.org
Cc: Marcelo Ricardo Leitner <marcelo.leitner@gmail.com>,
	Neil Horman <nhorman@tuxdriver.com>,
	davem@davemloft.net
Subject: [PATCH net-next 18/27] sctp: add rfc6525 section 6.1.2
Date: Sun,  1 Jan 2017 19:20:35 +0800	[thread overview]
Message-ID: <3a60ce82edef82f329fe2cc4ac83e9ca21831d8b.1483269426.git.lucien.xin@gmail.com> (raw)
In-Reply-To: <1e8e248c38fd3874cf80c4b88e4699c8a617066d.1483269426.git.lucien.xin@gmail.com>
In-Reply-To: <cover.1483269426.git.lucien.xin@gmail.com>

This patch is to add Association Reset Event described in section 6.1.2.

Signed-off-by: Xin Long <lucien.xin@gmail.com>
---
 include/net/sctp/ulpevent.h |  4 ++++
 include/uapi/linux/sctp.h   | 15 +++++++++++++++
 net/sctp/ulpevent.c         | 28 ++++++++++++++++++++++++++++
 3 files changed, 47 insertions(+)

diff --git a/include/net/sctp/ulpevent.h b/include/net/sctp/ulpevent.h
index 324b596..2ab7ed4 100644
--- a/include/net/sctp/ulpevent.h
+++ b/include/net/sctp/ulpevent.h
@@ -132,6 +132,10 @@ 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_ulpevent *sctp_ulpevent_make_assoc_reset_event(
+	const struct sctp_association *asoc, __u16 flags,
+	 __u32 local_tsn, __u32 remote_tsn, 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,
diff --git a/include/uapi/linux/sctp.h b/include/uapi/linux/sctp.h
index 97b8a96..9da165a 100644
--- a/include/uapi/linux/sctp.h
+++ b/include/uapi/linux/sctp.h
@@ -503,6 +503,17 @@ struct sctp_stream_reset_event {
 	uint16_t strreset_stream_list[];
 };
 
+#define SCTP_ASSOC_RESET_DENIED		0x0004
+#define SCTP_ASSOC_RESET_FAILED		0x0008
+struct sctp_assoc_reset_event {
+	uint16_t assocreset_type;
+	uint16_t assocreset_flags;
+	uint32_t assocreset_length;
+	sctp_assoc_t assocreset_assoc_id;
+	uint32_t assocreset_local_tsn;
+	uint32_t assocreset_remote_tsn;
+};
+
 /*
  * Described in Section 7.3
  *   Ancillary Data and Notification Interest Options
@@ -519,6 +530,7 @@ struct sctp_event_subscribe {
 	uint8_t sctp_authentication_event;
 	uint8_t sctp_sender_dry_event;
 	uint8_t sctp_stream_reset_event;
+	uint8_t sctp_assoc_reset_event;
 };
 
 /*
@@ -544,6 +556,7 @@ union sctp_notification {
 	struct sctp_authkey_event sn_authkey_event;
 	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;
 };
 
 /* Section 5.3.1
@@ -573,6 +586,8 @@ enum sctp_sn_type {
 #define SCTP_SENDER_DRY_EVENT		SCTP_SENDER_DRY_EVENT
 	SCTP_STREAM_RESET_EVENT,
 #define SCTP_STREAM_RESET_EVENT		SCTP_STREAM_RESET_EVENT
+	SCTP_ASSOC_RESET_EVENT,
+#define SCTP_ASSOC_RESET_EVENT		SCTP_ASSOC_RESET_EVENT
 };
 
 /* Notification error codes used to fill up the error fields in some
diff --git a/net/sctp/ulpevent.c b/net/sctp/ulpevent.c
index 490d573..5492cd7 100644
--- a/net/sctp/ulpevent.c
+++ b/net/sctp/ulpevent.c
@@ -884,6 +884,34 @@ struct sctp_ulpevent *sctp_ulpevent_make_stream_reset_event(
 	return event;
 }
 
+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_assoc_reset_event *areset;
+	struct sctp_ulpevent *event;
+	struct sk_buff *skb;
+
+	event = sctp_ulpevent_new(sizeof(struct sctp_assoc_reset_event),
+				  MSG_NOTIFICATION, gfp);
+	if (!event)
+		return NULL;
+
+	skb = sctp_event2skb(event);
+	areset = (struct sctp_assoc_reset_event *)
+		skb_put(skb, sizeof(struct sctp_assoc_reset_event));
+
+	areset->assocreset_type = SCTP_ASSOC_RESET_EVENT;
+	areset->assocreset_flags = flags;
+	areset->assocreset_length = sizeof(struct sctp_assoc_reset_event);
+	sctp_ulpevent_set_owner(event, asoc);
+	areset->assocreset_assoc_id = sctp_assoc2id(asoc);
+	areset->assocreset_local_tsn = local_tsn;
+	areset->assocreset_remote_tsn = remote_tsn;
+
+	return event;
+}
+
 /* Return the notification type, assuming this is a notification
  * event.
  */
-- 
2.1.0

  reply	other threads:[~2017-01-01 11:23 UTC|newest]

Thread overview: 37+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-01-01 11:20 [PATCH net-next 00/27] sctp: implement rfc6525 sctp stream reconf Xin Long
2017-01-01 11:20 ` [PATCH net-next 01/27] sctp: add stream arrays in asoc Xin Long
2017-01-01 11:20   ` [PATCH net-next 02/27] sctp: replace ssnmap with asoc stream arrays Xin Long
2017-01-01 11:20     ` [PATCH net-next 03/27] sctp: remove asoc ssnmap and ssnmap.c Xin Long
2017-01-01 11:20       ` [PATCH net-next 04/27] sctp: add rfc6525 section 3.1 Xin Long
2017-01-01 11:20         ` [PATCH net-next 05/27] sctp: add rfc6525 section 4.1-4.2 Xin Long
2017-01-01 11:20           ` [PATCH net-next 06/27] sctp: add rfc6525 section 4.3 Xin Long
2017-01-01 11:20             ` [PATCH net-next 07/27] sctp: add rfc6525 section 4.4 Xin Long
2017-01-01 11:20               ` [PATCH net-next 08/27] sctp: add rfc6525 section 4.5-4.6 Xin Long
2017-01-01 11:20                 ` [PATCH net-next 09/27] sctp: add stream reconf timer Xin Long
2017-01-01 11:20                   ` [PATCH net-next 10/27] sctp: add stream reconf primitive Xin Long
2017-01-01 11:20                     ` [PATCH net-next 11/27] sctp: add reconf_enable in asoc ep and netns Xin Long
2017-01-01 11:20                       ` [PATCH net-next 12/27] sctp: add get and set sockopt for reconf_enable Xin Long
2017-01-01 11:20                         ` [PATCH net-next 13/27] sctp: add rfc6525 section 6.3.1 Xin Long
2017-01-01 11:20                           ` [PATCH net-next 14/27] sctp: add rfc6525 section 5.1.2-5.1.3 and 6.3.2 Xin Long
2017-01-01 11:20                             ` [PATCH net-next 15/27] sctp: add rfc6525 section 5.1.4 and 6.3.3 Xin Long
2017-01-01 11:20                               ` [PATCH net-next 16/27] sctp: add rfc6525 section 5.1.5-5.1.6 and 6.3.4 Xin Long
2017-01-01 11:20                                 ` [PATCH net-next 17/27] sctp: add rfc6525 section 6.1.1 Xin Long
2017-01-01 11:20                                   ` Xin Long [this message]
2017-01-01 11:20                                     ` [PATCH net-next 19/27] sctp: add rfc6525 section 6.1.3 Xin Long
2017-01-01 11:20                                       ` [PATCH net-next 20/27] sctp: add rfc6525 section 5.2.2 Xin Long
2017-01-01 11:20                                         ` [PATCH net-next 21/27] sctp: add rfc6525 section 5.2.3 Xin Long
2017-01-01 11:20                                           ` [PATCH net-next 22/27] sctp: add rfc6525 section 5.2.4 Xin Long
2017-01-01 11:20                                             ` [PATCH net-next 23/27] sctp: add rfc6525 section 5.2.5 Xin Long
2017-01-01 11:20                                               ` [PATCH net-next 24/27] sctp: add rfc6525 section 5.2.6 Xin Long
2017-01-01 11:20                                                 ` [PATCH net-next 25/27] sctp: add rfc6525 section 5.2.7 Xin Long
2017-01-01 11:20                                                   ` [PATCH net-next 26/27] sctp: add sctp reconf chunk process Xin Long
2017-01-01 11:20                                                     ` [PATCH net-next 27/27] sctp: add reconf chunk event Xin Long
2017-01-01 12:14                                             ` [PATCH net-next 22/27] sctp: add rfc6525 section 5.2.4 kbuild test robot
2017-01-01 13:26                                               ` Xin Long
2017-01-01 16:32                                                 ` David Miller
2017-01-02 13:43                                                   ` Xin Long
2017-01-01 12:02                                         ` [PATCH net-next 20/27] sctp: add rfc6525 section 5.2.2 kbuild test robot
2017-01-01 13:23                                           ` Xin Long
2017-01-01 11:32 ` [PATCH net-next 00/27] sctp: implement rfc6525 sctp stream reconf Xin Long
2017-01-01 16:30 ` David Miller
2017-01-02 13:42   ` Xin Long

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=3a60ce82edef82f329fe2cc4ac83e9ca21831d8b.1483269426.git.lucien.xin@gmail.com \
    --to=lucien.xin@gmail.com \
    --cc=davem@davemloft.net \
    --cc=linux-sctp@vger.kernel.org \
    --cc=marcelo.leitner@gmail.com \
    --cc=netdev@vger.kernel.org \
    --cc=nhorman@tuxdriver.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).