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 11/27] sctp: add reconf_enable in asoc ep and netns
Date: Sun, 01 Jan 2017 11:20:28 +0000 [thread overview]
Message-ID: <1e4560205cff3c10868d5614b62a3db14e87ccf0.1483269426.git.lucien.xin@gmail.com> (raw)
In-Reply-To: <1d0b270084289945c4b42ae36d0556648a3f9b64.1483269426.git.lucien.xin@gmail.com>
This patch is to add reconf_enable field in all of asoc ep and netns
to indicate if they support stream reset.
When initializing, asoc reconf_enable get the default value from ep
reconf_enable which is from netns netns reconf_enable by default.
It is also to add reconf_capable in asoc peer part to know if peer
supports reconf_enable, the value is set if ext params have reconf
chunk support when processing init chunk, just as rfc6525 section
5.1.1 demands.
Signed-off-by: Xin Long <lucien.xin@gmail.com>
---
include/net/netns/sctp.h | 3 +++
include/net/sctp/structs.h | 7 +++++--
net/sctp/associola.c | 1 +
net/sctp/endpointola.c | 1 +
net/sctp/sm_make_chunk.c | 15 +++++++++++++++
net/sctp/sysctl.c | 7 +++++++
6 files changed, 32 insertions(+), 2 deletions(-)
diff --git a/include/net/netns/sctp.h b/include/net/netns/sctp.h
index c501d67..b7871d0 100644
--- a/include/net/netns/sctp.h
+++ b/include/net/netns/sctp.h
@@ -118,6 +118,9 @@ struct netns_sctp {
/* Flag to indicate if PR-SCTP is enabled. */
int prsctp_enable;
+ /* Flag to indicate if PR-CONFIG is enabled. */
+ int reconf_enable;
+
/* Flag to idicate if SCTP-AUTH is enabled */
int auth_enable;
diff --git a/include/net/sctp/structs.h b/include/net/sctp/structs.h
index bb18990..7c46398 100644
--- a/include/net/sctp/structs.h
+++ b/include/net/sctp/structs.h
@@ -1251,7 +1251,8 @@ struct sctp_endpoint {
struct list_head endpoint_shared_keys;
__u16 active_key_id;
__u8 auth_enable:1,
- prsctp_enable:1;
+ prsctp_enable:1,
+ reconf_enable:1;
};
/* Recover the outter endpoint structure. */
@@ -1497,6 +1498,7 @@ struct sctp_association {
hostname_address:1, /* Peer understands DNS addresses? */
asconf_capable:1, /* Does peer support ADDIP? */
prsctp_capable:1, /* Can peer do PR-SCTP? */
+ reconf_capable:1, /* Can peer do RE-CONFIG? */
auth_capable:1; /* Is peer doing SCTP-AUTH? */
/* sack_needed : This flag indicates if the next received
@@ -1853,7 +1855,8 @@ struct sctp_association {
__u8 need_ecne:1, /* Need to send an ECNE Chunk? */
temp:1, /* Is it a temporary association? */
- prsctp_enable:1;
+ prsctp_enable:1,
+ reconf_enable:1;
/* stream arrays */
struct sctp_stream_out *streamout;
diff --git a/net/sctp/associola.c b/net/sctp/associola.c
index 7acfdad..ab43cb6 100644
--- a/net/sctp/associola.c
+++ b/net/sctp/associola.c
@@ -270,6 +270,7 @@ static struct sctp_association *sctp_association_init(struct sctp_association *a
asoc->active_key_id = ep->active_key_id;
asoc->prsctp_enable = ep->prsctp_enable;
+ asoc->reconf_enable = ep->reconf_enable;
/* Save the hmacs and chunks list into this association */
if (ep->auth_hmacs_list)
diff --git a/net/sctp/endpointola.c b/net/sctp/endpointola.c
index 410ddc1..8c58923 100644
--- a/net/sctp/endpointola.c
+++ b/net/sctp/endpointola.c
@@ -164,6 +164,7 @@ static struct sctp_endpoint *sctp_endpoint_init(struct sctp_endpoint *ep,
ep->auth_hmacs_list = auth_hmacs;
ep->auth_chunk_list = auth_chunks;
ep->prsctp_enable = net->sctp.prsctp_enable;
+ ep->reconf_enable = net->sctp.reconf_enable;
return ep;
diff --git a/net/sctp/sm_make_chunk.c b/net/sctp/sm_make_chunk.c
index 102e816..f1efba6 100644
--- a/net/sctp/sm_make_chunk.c
+++ b/net/sctp/sm_make_chunk.c
@@ -270,6 +270,11 @@ struct sctp_chunk *sctp_make_init(const struct sctp_association *asoc,
num_ext += 2;
}
+ if (asoc->reconf_enable) {
+ extensions[num_ext] = SCTP_CID_RECONF;
+ num_ext += 1;
+ }
+
if (sp->adaptation_ind)
chunksize += sizeof(aiparam);
@@ -434,6 +439,11 @@ struct sctp_chunk *sctp_make_init_ack(const struct sctp_association *asoc,
num_ext += 2;
}
+ if (asoc->peer.reconf_capable) {
+ extensions[num_ext] = SCTP_CID_RECONF;
+ num_ext += 1;
+ }
+
if (sp->adaptation_ind)
chunksize += sizeof(aiparam);
@@ -2010,6 +2020,11 @@ static void sctp_process_ext_param(struct sctp_association *asoc,
for (i = 0; i < num_ext; i++) {
switch (param.ext->chunks[i]) {
+ case SCTP_CID_RECONF:
+ if (asoc->reconf_enable &&
+ !asoc->peer.reconf_capable)
+ asoc->peer.reconf_capable = 1;
+ break;
case SCTP_CID_FWD_TSN:
if (asoc->prsctp_enable && !asoc->peer.prsctp_capable)
asoc->peer.prsctp_capable = 1;
diff --git a/net/sctp/sysctl.c b/net/sctp/sysctl.c
index daf8554..0e732f6 100644
--- a/net/sctp/sysctl.c
+++ b/net/sctp/sysctl.c
@@ -275,6 +275,13 @@ static struct ctl_table sctp_net_table[] = {
.proc_handler = proc_dointvec,
},
{
+ .procname = "reconf_enable",
+ .data = &init_net.sctp.reconf_enable,
+ .maxlen = sizeof(int),
+ .mode = 0644,
+ .proc_handler = proc_dointvec,
+ },
+ {
.procname = "auth_enable",
.data = &init_net.sctp.auth_enable,
.maxlen = sizeof(int),
--
2.1.0
next prev parent reply other threads:[~2017-01-01 11:20 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 ` Xin Long [this message]
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 ` [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=1e4560205cff3c10868d5614b62a3db14e87ccf0.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).