diff options
author | Xin Long <lucien.xin@gmail.com> | 2017-01-17 11:44:44 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2017-01-18 14:55:10 -0500 |
commit | 7a090b04522b46a219c271d4cd2abbf572623e03 (patch) | |
tree | 54c33372eb70a012a22d715130fdff9c504fa1fa | |
parent | 7b9438de0cd4b46a6914416bfede6cf839cd9e68 (diff) |
sctp: add stream reconf primitive
This patch is to add a primitive based on sctp primitive frame for
sending stream reconf request. It works as the other primitives,
and create a SCTP_CMD_REPLY command to send the request chunk out.
sctp_primitive_RECONF would be the api to send a reconf request
chunk.
Signed-off-by: Xin Long <lucien.xin@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r-- | include/net/sctp/constants.h | 3 | ||||
-rw-r--r-- | include/net/sctp/sctp.h | 2 | ||||
-rw-r--r-- | include/net/sctp/sm.h | 1 | ||||
-rw-r--r-- | net/sctp/primitive.c | 3 | ||||
-rw-r--r-- | net/sctp/sm_statefuns.c | 13 | ||||
-rw-r--r-- | net/sctp/sm_statetable.c | 20 |
6 files changed, 41 insertions, 1 deletions
diff --git a/include/net/sctp/constants.h b/include/net/sctp/constants.h index 8307c862b5c2..3567c971cf3b 100644 --- a/include/net/sctp/constants.h +++ b/include/net/sctp/constants.h | |||
@@ -114,9 +114,10 @@ typedef enum { | |||
114 | SCTP_PRIMITIVE_SEND, | 114 | SCTP_PRIMITIVE_SEND, |
115 | SCTP_PRIMITIVE_REQUESTHEARTBEAT, | 115 | SCTP_PRIMITIVE_REQUESTHEARTBEAT, |
116 | SCTP_PRIMITIVE_ASCONF, | 116 | SCTP_PRIMITIVE_ASCONF, |
117 | SCTP_PRIMITIVE_RECONF, | ||
117 | } sctp_event_primitive_t; | 118 | } sctp_event_primitive_t; |
118 | 119 | ||
119 | #define SCTP_EVENT_PRIMITIVE_MAX SCTP_PRIMITIVE_ASCONF | 120 | #define SCTP_EVENT_PRIMITIVE_MAX SCTP_PRIMITIVE_RECONF |
120 | #define SCTP_NUM_PRIMITIVE_TYPES (SCTP_EVENT_PRIMITIVE_MAX + 1) | 121 | #define SCTP_NUM_PRIMITIVE_TYPES (SCTP_EVENT_PRIMITIVE_MAX + 1) |
121 | 122 | ||
122 | /* We define here a utility type for manipulating subtypes. | 123 | /* We define here a utility type for manipulating subtypes. |
diff --git a/include/net/sctp/sctp.h b/include/net/sctp/sctp.h index 598d938b0d0a..bc0e049b1474 100644 --- a/include/net/sctp/sctp.h +++ b/include/net/sctp/sctp.h | |||
@@ -141,6 +141,8 @@ int sctp_primitive_ABORT(struct net *, struct sctp_association *, void *arg); | |||
141 | int sctp_primitive_SEND(struct net *, struct sctp_association *, void *arg); | 141 | int sctp_primitive_SEND(struct net *, struct sctp_association *, void *arg); |
142 | int sctp_primitive_REQUESTHEARTBEAT(struct net *, struct sctp_association *, void *arg); | 142 | int sctp_primitive_REQUESTHEARTBEAT(struct net *, struct sctp_association *, void *arg); |
143 | int sctp_primitive_ASCONF(struct net *, struct sctp_association *, void *arg); | 143 | int sctp_primitive_ASCONF(struct net *, struct sctp_association *, void *arg); |
144 | int sctp_primitive_RECONF(struct net *net, struct sctp_association *asoc, | ||
145 | void *arg); | ||
144 | 146 | ||
145 | /* | 147 | /* |
146 | * sctp/input.c | 148 | * sctp/input.c |
diff --git a/include/net/sctp/sm.h b/include/net/sctp/sm.h index d2d9e28fe783..430ed139fbbb 100644 --- a/include/net/sctp/sm.h +++ b/include/net/sctp/sm.h | |||
@@ -157,6 +157,7 @@ sctp_state_fn_t sctp_sf_error_shutdown; | |||
157 | sctp_state_fn_t sctp_sf_ignore_primitive; | 157 | sctp_state_fn_t sctp_sf_ignore_primitive; |
158 | sctp_state_fn_t sctp_sf_do_prm_requestheartbeat; | 158 | sctp_state_fn_t sctp_sf_do_prm_requestheartbeat; |
159 | sctp_state_fn_t sctp_sf_do_prm_asconf; | 159 | sctp_state_fn_t sctp_sf_do_prm_asconf; |
160 | sctp_state_fn_t sctp_sf_do_prm_reconf; | ||
160 | 161 | ||
161 | /* Prototypes for other event state functions. */ | 162 | /* Prototypes for other event state functions. */ |
162 | sctp_state_fn_t sctp_sf_do_no_pending_tsn; | 163 | sctp_state_fn_t sctp_sf_do_no_pending_tsn; |
diff --git a/net/sctp/primitive.c b/net/sctp/primitive.c index ab8d9f96a177..f0553a022859 100644 --- a/net/sctp/primitive.c +++ b/net/sctp/primitive.c | |||
@@ -211,3 +211,6 @@ DECLARE_PRIMITIVE(REQUESTHEARTBEAT); | |||
211 | */ | 211 | */ |
212 | 212 | ||
213 | DECLARE_PRIMITIVE(ASCONF); | 213 | DECLARE_PRIMITIVE(ASCONF); |
214 | |||
215 | /* RE-CONFIG 5.1 */ | ||
216 | DECLARE_PRIMITIVE(RECONF); | ||
diff --git a/net/sctp/sm_statefuns.c b/net/sctp/sm_statefuns.c index 2ae186aba9a8..782e579472c9 100644 --- a/net/sctp/sm_statefuns.c +++ b/net/sctp/sm_statefuns.c | |||
@@ -5185,6 +5185,19 @@ sctp_disposition_t sctp_sf_do_prm_asconf(struct net *net, | |||
5185 | return SCTP_DISPOSITION_CONSUME; | 5185 | return SCTP_DISPOSITION_CONSUME; |
5186 | } | 5186 | } |
5187 | 5187 | ||
5188 | /* RE-CONFIG Section 5.1 RECONF Chunk Procedures */ | ||
5189 | sctp_disposition_t sctp_sf_do_prm_reconf(struct net *net, | ||
5190 | const struct sctp_endpoint *ep, | ||
5191 | const struct sctp_association *asoc, | ||
5192 | const sctp_subtype_t type, | ||
5193 | void *arg, sctp_cmd_seq_t *commands) | ||
5194 | { | ||
5195 | struct sctp_chunk *chunk = arg; | ||
5196 | |||
5197 | sctp_add_cmd_sf(commands, SCTP_CMD_REPLY, SCTP_CHUNK(chunk)); | ||
5198 | return SCTP_DISPOSITION_CONSUME; | ||
5199 | } | ||
5200 | |||
5188 | /* | 5201 | /* |
5189 | * Ignore the primitive event | 5202 | * Ignore the primitive event |
5190 | * | 5203 | * |
diff --git a/net/sctp/sm_statetable.c b/net/sctp/sm_statetable.c index 3da521abfc57..b5438b4f6c1e 100644 --- a/net/sctp/sm_statetable.c +++ b/net/sctp/sm_statetable.c | |||
@@ -643,6 +643,25 @@ chunk_event_table_unknown[SCTP_STATE_NUM_STATES] = { | |||
643 | TYPE_SCTP_FUNC(sctp_sf_error_shutdown), \ | 643 | TYPE_SCTP_FUNC(sctp_sf_error_shutdown), \ |
644 | } /* TYPE_SCTP_PRIMITIVE_ASCONF */ | 644 | } /* TYPE_SCTP_PRIMITIVE_ASCONF */ |
645 | 645 | ||
646 | #define TYPE_SCTP_PRIMITIVE_RECONF { \ | ||
647 | /* SCTP_STATE_CLOSED */ \ | ||
648 | TYPE_SCTP_FUNC(sctp_sf_error_closed), \ | ||
649 | /* SCTP_STATE_COOKIE_WAIT */ \ | ||
650 | TYPE_SCTP_FUNC(sctp_sf_error_closed), \ | ||
651 | /* SCTP_STATE_COOKIE_ECHOED */ \ | ||
652 | TYPE_SCTP_FUNC(sctp_sf_error_closed), \ | ||
653 | /* SCTP_STATE_ESTABLISHED */ \ | ||
654 | TYPE_SCTP_FUNC(sctp_sf_do_prm_reconf), \ | ||
655 | /* SCTP_STATE_SHUTDOWN_PENDING */ \ | ||
656 | TYPE_SCTP_FUNC(sctp_sf_do_prm_reconf), \ | ||
657 | /* SCTP_STATE_SHUTDOWN_SENT */ \ | ||
658 | TYPE_SCTP_FUNC(sctp_sf_do_prm_reconf), \ | ||
659 | /* SCTP_STATE_SHUTDOWN_RECEIVED */ \ | ||
660 | TYPE_SCTP_FUNC(sctp_sf_do_prm_reconf), \ | ||
661 | /* SCTP_STATE_SHUTDOWN_ACK_SENT */ \ | ||
662 | TYPE_SCTP_FUNC(sctp_sf_error_shutdown), \ | ||
663 | } /* TYPE_SCTP_PRIMITIVE_RECONF */ | ||
664 | |||
646 | /* The primary index for this table is the primitive type. | 665 | /* The primary index for this table is the primitive type. |
647 | * The secondary index for this table is the state. | 666 | * The secondary index for this table is the state. |
648 | */ | 667 | */ |
@@ -653,6 +672,7 @@ static const sctp_sm_table_entry_t primitive_event_table[SCTP_NUM_PRIMITIVE_TYPE | |||
653 | TYPE_SCTP_PRIMITIVE_SEND, | 672 | TYPE_SCTP_PRIMITIVE_SEND, |
654 | TYPE_SCTP_PRIMITIVE_REQUESTHEARTBEAT, | 673 | TYPE_SCTP_PRIMITIVE_REQUESTHEARTBEAT, |
655 | TYPE_SCTP_PRIMITIVE_ASCONF, | 674 | TYPE_SCTP_PRIMITIVE_ASCONF, |
675 | TYPE_SCTP_PRIMITIVE_RECONF, | ||
656 | }; | 676 | }; |
657 | 677 | ||
658 | #define TYPE_SCTP_OTHER_NO_PENDING_TSN { \ | 678 | #define TYPE_SCTP_OTHER_NO_PENDING_TSN { \ |