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 27/27] sctp: add reconf chunk event
Date: Sun,  1 Jan 2017 19:20:44 +0800	[thread overview]
Message-ID: <b765925613f97c4734d1ecff726bf6eaf0d93280.1483269426.git.lucien.xin@gmail.com> (raw)
In-Reply-To: <24997940f9c6ca9d4cbb8ce72741fdddcfe4ebc1.1483269426.git.lucien.xin@gmail.com>
In-Reply-To: <cover.1483269426.git.lucien.xin@gmail.com>

This patch is to add reconf chunk event based on the sctp event
frame, after which, the reconf chunk process would be activated.

Signed-off-by: Xin Long <lucien.xin@gmail.com>
---
 include/net/sctp/constants.h |  3 +++
 net/sctp/sm_statetable.c     | 30 ++++++++++++++++++++++++++++++
 2 files changed, 33 insertions(+)

diff --git a/include/net/sctp/constants.h b/include/net/sctp/constants.h
index 3567c97..b07a745 100644
--- a/include/net/sctp/constants.h
+++ b/include/net/sctp/constants.h
@@ -60,11 +60,14 @@ enum { SCTP_DEFAULT_INSTREAMS = SCTP_MAX_STREAM };
 
 #define SCTP_NUM_PRSCTP_CHUNK_TYPES	1
 
+#define SCTP_NUM_RECONF_CHUNK_TYPES	1
+
 #define SCTP_NUM_AUTH_CHUNK_TYPES	1
 
 #define SCTP_NUM_CHUNK_TYPES		(SCTP_NUM_BASE_CHUNK_TYPES + \
 					 SCTP_NUM_ADDIP_CHUNK_TYPES +\
 					 SCTP_NUM_PRSCTP_CHUNK_TYPES +\
+					 SCTP_NUM_RECONF_CHUNK_TYPES +\
 					 SCTP_NUM_AUTH_CHUNK_TYPES)
 
 /* These are the different flavours of event.  */
diff --git a/net/sctp/sm_statetable.c b/net/sctp/sm_statetable.c
index b5438b4..419b18e 100644
--- a/net/sctp/sm_statetable.c
+++ b/net/sctp/sm_statetable.c
@@ -482,6 +482,32 @@ static const sctp_sm_table_entry_t prsctp_chunk_event_table[SCTP_NUM_PRSCTP_CHUN
 	TYPE_SCTP_FWD_TSN,
 }; /*state_fn_t prsctp_chunk_event_table[][] */
 
+#define TYPE_SCTP_RECONF { \
+	/* SCTP_STATE_CLOSED */ \
+	TYPE_SCTP_FUNC(sctp_sf_discard_chunk), \
+	/* SCTP_STATE_COOKIE_WAIT */ \
+	TYPE_SCTP_FUNC(sctp_sf_discard_chunk), \
+	/* SCTP_STATE_COOKIE_ECHOED */ \
+	TYPE_SCTP_FUNC(sctp_sf_discard_chunk), \
+	/* SCTP_STATE_ESTABLISHED */ \
+	TYPE_SCTP_FUNC(sctp_sf_do_reconf), \
+	/* SCTP_STATE_SHUTDOWN_PENDING */ \
+	TYPE_SCTP_FUNC(sctp_sf_do_reconf), \
+	/* SCTP_STATE_SHUTDOWN_SENT */ \
+	TYPE_SCTP_FUNC(sctp_sf_discard_chunk), \
+	/* SCTP_STATE_SHUTDOWN_RECEIVED */ \
+	TYPE_SCTP_FUNC(sctp_sf_discard_chunk), \
+	/* SCTP_STATE_SHUTDOWN_ACK_SENT */ \
+	TYPE_SCTP_FUNC(sctp_sf_discard_chunk), \
+} /* TYPE_SCTP_RECONF */
+
+/* The primary index for this table is the chunk type.
+ * The secondary index for this table is the state.
+ */
+static const sctp_sm_table_entry_t reconf_chunk_event_table[SCTP_NUM_RECONF_CHUNK_TYPES][SCTP_STATE_NUM_STATES] = {
+	TYPE_SCTP_RECONF,
+}; /*state_fn_t reconf_chunk_event_table[][] */
+
 #define TYPE_SCTP_AUTH { \
 	/* SCTP_STATE_CLOSED */ \
 	TYPE_SCTP_FUNC(sctp_sf_ootb), \
@@ -964,6 +990,10 @@ static const sctp_sm_table_entry_t *sctp_chunk_event_lookup(struct net *net,
 			return &addip_chunk_event_table[1][state];
 	}
 
+	if (net->sctp.reconf_enable)
+		if (cid == SCTP_CID_RECONF)
+			return &reconf_chunk_event_table[0][state];
+
 	if (net->sctp.auth_enable) {
 		if (cid == SCTP_CID_AUTH)
 			return &auth_chunk_event_table[0][state];
-- 
2.1.0

  reply	other threads:[~2017-01-01 11:24 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                                   ` [PATCH net-next 18/27] sctp: add rfc6525 section 6.1.2 Xin Long
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                                                     ` Xin Long [this message]
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=b765925613f97c4734d1ecff726bf6eaf0d93280.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).