sctp: add support for generating stream reconf chunks
Subsystems (3)
Xin Long
maintainerv2 cover sctp: add support for generating stream reconf chunks
This patchset is to add some functions to generate stream reconf chunks, described in RFC6525 Section 3 and Section 4.
v1->v2:
- put these into a smaller group.
- rename some temporary variables in the codes.
- rename the titles of the commits and improve some changelogs.
Xin Long (5):
sctp: add a common helper function to generate stream reconf chunk
sctp: add support for generating stream reconf ssn reset request chunk
sctp: add support for generating stream reconf ssn/tsn reset request
chunk
sctp: add support for generating stream reconf response chunk
sctp: add support for generating stream reconf add streams request
chunk
include/linux/sctp.h | 68 ++++++++++++ include/net/sctp/sm.h | 17 ++- include/net/sctp/structs.h | 3 + net/sctp/associola.c | 1 + net/sctp/sm_make_chunk.c | 270 +++++++++++++++++++++++++++++++++++++++++++++ 5 files changed, 358 insertions(+), 1 deletion(-)
Signature · 1 line
2.1.0
Xin Long
maintainerPATCH v2 1/5 sctp: add a common helper function to generate stream reconf chunk
This patch is to define a common api used to alloc memory and initialize reconf chunk header that described in rfc6525 section 3.1.
All reconf chunks will be generated by calling this helper function.
--- include/linux/sctp.h | 6 ++++++ net/sctp/sm_make_chunk.c | 33 +++++++++++++++++++++++++++++++++ 2 files changed, 39 insertions(+)
include/linux/sctp.h +6 -0
@@ -108,6 +108,7 @@ typedef enum {/* Use hex, as defined in ADDIP sec. 3.1 */ SCTP_CID_ASCONF =0xC1 ,SCTP_CID_ASCONF_ACK =0x80 , +SCTP_CID_RECONF =0x82 , } sctp_cid_t; /* enum */
@@ -710,4 +711,9 @@ struct sctp_infox { struct sctp_association *asoc; }; +struct sctp_reconf_chunk { +sctp_chunkhdr_t chunk_hdr; +__u8 params[0 ]; +} __packed; +#endif /* __LINUX_SCTP_H__ */
net/sctp/sm_make_chunk.c +33 -0
@@ -3526,3 +3526,36 @@ struct sctp_chunk *sctp_make_fwdtsn(const struct sctp_association *asoc,return retval; } + +/* RE-CONFIG 3.1 (RE-CONFIG chunk) +* 0 1 2 3 +* 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 +* +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ +* | Type = 130 | Chunk Flags | Chunk Length | +* +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ +* \ \ +* / Re-configuration Parameter / +* \ \ +* +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ +* \ \ +* / Re-configuration Parameter (optional) / +* \ \ +* +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ +*/ +static struct sctp_chunk *sctp_make_reconf ( +const struct sctp_association *asoc, +int length) +{ +struct sctp_reconf_chunk *reconf; +struct sctp_chunk *retval; + + retval =sctp_make_control (asoc,SCTP_CID_RECONF ,0 , length, +GFP_ATOMIC ); +if (!retval) +return NULL ; + + reconf = (struct sctp_reconf_chunk *)retval->chunk_hdr; + retval->param_hdr.v = reconf->params; + +return retval; +}
Signature · 1 line
2.1.0
Xin Long
maintainerPATCH v2 2/5 sctp: add support for generating stream reconf ssn reset request chunk
This patch is to add asoc strreset_outseq and strreset_inseq for saving the reconf request sequence, initialize them when create assoc and process init, and also to define Incoming and Outgoing SSN Reset Request Parameter described in rfc6525 section 4.1 and 4.2, As they can be in one same chunk as section rfc6525 3.1-3 describes, it makes them in one function.
--- include/linux/sctp.h | 26 ++++++++++++++ include/net/sctp/sm.h | 5 ++- include/net/sctp/structs.h | 3 ++ net/sctp/associola.c | 1 + net/sctp/sm_make_chunk.c | 88 ++++++++++++++++++++++++++++++++++++++++++++++ 5 files changed, 122 insertions(+), 1 deletion(-)
include/linux/sctp.h +26 -0
@@ -200,6 +200,13 @@ typedef enum {SCTP_PARAM_SUCCESS_REPORT =cpu_to_be16 (0xc005 ),SCTP_PARAM_ADAPTATION_LAYER_IND =cpu_to_be16 (0xc006 ), +/* RE-CONFIG. Section 4 */ +SCTP_PARAM_RESET_OUT_REQUEST =cpu_to_be16 (0x000d ), +SCTP_PARAM_RESET_IN_REQUEST =cpu_to_be16 (0x000e ), +SCTP_PARAM_RESET_TSN_REQUEST =cpu_to_be16 (0x000f ), +SCTP_PARAM_RESET_RESPONSE =cpu_to_be16 (0x0010 ), +SCTP_PARAM_RESET_ADD_OUT_STREAMS =cpu_to_be16 (0x0011 ), +SCTP_PARAM_RESET_ADD_IN_STREAMS =cpu_to_be16 (0x0012 ), } sctp_param_t; /* enum */
@@ -716,4 +723,23 @@ struct sctp_reconf_chunk { __u8 params[0]; } __packed; +struct sctp_strreset_req { +sctp_paramhdr_t param_hdr; +__u32 request_seq; +} __packed; + +struct sctp_strreset_outreq { +sctp_paramhdr_t param_hdr; +__u32 request_seq; +__u32 response_seq; +__u32 send_reset_at_tsn; +__u16 list_of_streams[0 ]; +} __packed; + +struct sctp_strreset_inreq { +sctp_paramhdr_t param_hdr; +__u32 request_seq; +__u16 list_of_streams[0 ]; +} __packed; +#endif /* __LINUX_SCTP_H__ */
include/net/sctp/sm.h +4 -1
@@ -259,7 +259,10 @@ struct sctp_chunk *sctp_make_fwdtsn(const struct sctp_association *asoc, __u32 new_cum_tsn, size_t nstreams, struct sctp_fwdtsn_skip *skiplist);struct sctp_chunk *sctp_make_auth (const struct sctp_association *asoc); - +struct sctp_chunk *sctp_make_strreset_req ( +const struct sctp_association *asoc, +__u16 stream_num,__u16 *stream_list, +bool out,bool in);void sctp_chunk_assign_tsn (struct sctp_chunk *);void sctp_chunk_assign_ssn (struct sctp_chunk *);
include/net/sctp/structs.h +3 -0
@@ -1865,6 +1865,9 @@ struct sctp_association { temp:1 ,/* Is it a temporary association? */ prsctp_enable:1; +__u32 strreset_outseq;/* Update after receiving response */ +__u32 strreset_inseq;/* Update after receiving request */ +struct sctp_priv_assoc_stats stats;int sent_cnt_removable;
net/sctp/associola.c +1 -0
@@ -207,6 +207,7 @@ static struct sctp_association *sctp_association_init(struct sctp_association *a* association to the same value as the initial TSN. */ asoc->addip_serial = asoc->c.initial_tsn; + asoc->strreset_outseq = asoc->c.initial_tsn;INIT_LIST_HEAD (&asoc->addip_chunk_list);INIT_LIST_HEAD (&asoc->asconf_ack_list);
net/sctp/sm_make_chunk.c +88 -0
102 lines not on this page · raw message
Signature · 1 line
2.1.0
Xin Long
maintainerPATCH v2 3/5 sctp: add support for generating stream reconf ssn/tsn reset request chunk
This patch is to define SSN/TSN Reset Request Parameter described in rfc6525 section 4.3.
--- include/linux/sctp.h | 5 +++++ include/net/sctp/sm.h | 2 ++ net/sctp/sm_make_chunk.c | 29 +++++++++++++++++++++++++++++ 3 files changed, 36 insertions(+)
include/linux/sctp.h +5 -0
@@ -742,4 +742,9 @@ struct sctp_strreset_inreq { __u16 list_of_streams[0]; } __packed; +struct sctp_strreset_tsnreq { +sctp_paramhdr_t param_hdr; +__u32 request_seq; +} __packed; +#endif /* __LINUX_SCTP_H__ */
include/net/sctp/sm.h +2 -0
@@ -263,6 +263,8 @@ struct sctp_chunk *sctp_make_strreset_req(const struct sctp_association *asoc, __u16 stream_num, __u16 *stream_list, bool out, bool in); +struct sctp_chunk *sctp_make_strreset_tsnreq ( +const struct sctp_association *asoc);void sctp_chunk_assign_tsn (struct sctp_chunk *);void sctp_chunk_assign_ssn (struct sctp_chunk *);
net/sctp/sm_make_chunk.c +29 -0
@@ -3647,3 +3647,32 @@ struct sctp_chunk *sctp_make_strreset_req(return retval; } + +/* RE-CONFIG 4.3 (SSN/TSN RESET ALL) +* 0 1 2 3 +* 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 +* +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ +* | Parameter Type = 15 | Parameter Length = 8 | +* +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ +* | Re-configuration Request Sequence Number | +* +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ +*/ +struct sctp_chunk *sctp_make_strreset_tsnreq ( +const struct sctp_association *asoc) +{ +struct sctp_strreset_tsnreq tsnreq; +__u16 length =sizeof (tsnreq); +struct sctp_chunk *retval; + + retval =sctp_make_reconf (asoc, length); +if (!retval) +return NULL ; + + tsnreq.param_hdr.type =SCTP_PARAM_RESET_TSN_REQUEST ; + tsnreq.param_hdr.length =htons (length); + tsnreq.request_seq =htonl (asoc->strreset_outseq); + +sctp_addto_chunk (retval,sizeof (tsnreq), &tsnreq); + +return retval; +}
Signature · 1 line
2.1.0
Xin Long
maintainerPATCH v2 4/5 sctp: add support for generating stream reconf response chunk
This patch is to define Re-configuration Response Parameter described in rfc6525 section 4.4. As optional fields are only for SSN/TSN Reset Request Parameter, it uses another function to make that.
--- include/linux/sctp.h | 24 ++++++++++++++++ include/net/sctp/sm.h | 7 +++++ net/sctp/sm_make_chunk.c | 74 ++++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 105 insertions(+)
include/linux/sctp.h +24 -0
@@ -747,4 +747,28 @@ struct sctp_strreset_tsnreq { __u32 request_seq; } __packed; +enum { +SCTP_STRRESET_NOTHING_TO_DO =0x00 , +SCTP_STRRESET_PERFORMED =0x01 , +SCTP_STRRESET_DENIED =0x02 , +SCTP_STRRESET_ERR_WRONG_SSN =0x03 , +SCTP_STRRESET_ERR_IN_PROGRESS =0x04 , +SCTP_STRRESET_ERR_BAD_SEQNO =0x05 , +SCTP_STRRESET_IN_PROGRESS =0x06 , +}; + +struct sctp_strreset_resp { +sctp_paramhdr_t param_hdr; +__u32 response_seq; +__u32 result; +} __packed; + +struct sctp_strreset_resptsn { +sctp_paramhdr_t param_hdr; +__u32 response_seq; +__u32 result; +__u32 senders_next_tsn; +__u32 receivers_next_tsn; +} __packed; +#endif /* __LINUX_SCTP_H__ */
include/net/sctp/sm.h +7 -0
@@ -265,6 +265,13 @@ struct sctp_chunk *sctp_make_strreset_req( bool out, bool in);struct sctp_chunk *sctp_make_strreset_tsnreq (const struct sctp_association *asoc); +struct sctp_chunk *sctp_make_strreset_resp ( +const struct sctp_association *asoc, +__u32 result,__u32 sn); +struct sctp_chunk *sctp_make_strreset_tsnresp ( +struct sctp_association *asoc, +__u32 result,__u32 sn, +__u32 sender_tsn,__u32 receiver_tsn);void sctp_chunk_assign_tsn (struct sctp_chunk *);void sctp_chunk_assign_ssn (struct sctp_chunk *);
net/sctp/sm_make_chunk.c +74 -0
77 lines not on this page · raw message
Signature · 1 line
2.1.0
Xin Long
maintainerPATCH v2 5/5 sctp: add support for generating stream reconf add streams request chunk
This patch is to define Add Incoming/Outgoing Streams Request Parameter described in rfc6525 section 4.5 and 4.6. They can be in one same chunk trunk as rfc6525 section 3.1-7 describes, so make them in one function.
--- include/linux/sctp.h | 7 +++++++ include/net/sctp/sm.h | 3 +++ net/sctp/sm_make_chunk.c | 46 ++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 56 insertions(+)
include/linux/sctp.h +7 -0
@@ -771,4 +771,11 @@ struct sctp_strreset_resptsn { __u32 receivers_next_tsn; } __packed; +struct sctp_strreset_addstrm { +sctp_paramhdr_t param_hdr; +__u32 request_seq; +__u16 number_of_streams; +__u16 reserved; +} __packed; +#endif /* __LINUX_SCTP_H__ */
include/net/sctp/sm.h +3 -0
@@ -272,6 +272,9 @@ struct sctp_chunk *sctp_make_strreset_tsnresp(struct sctp_association *asoc, __u32 result, __u32 sn, __u32 sender_tsn, __u32 receiver_tsn); +struct sctp_chunk *sctp_make_strreset_addstrm ( +const struct sctp_association *asoc, +__u16 out,__u16 in);void sctp_chunk_assign_tsn (struct sctp_chunk *);void sctp_chunk_assign_ssn (struct sctp_chunk *);
net/sctp/sm_make_chunk.c +46 -0
49 lines not on this page · raw message
Signature · 1 line
2.1.0
Quoted 17 lines · Xin Long
This patchset is to add some functions to generate stream reconf chunks, described in RFC6525 Section 3 and Section 4.
v1->v2:
- put these into a smaller group.
- rename some temporary variables in the codes.
- rename the titles of the commits and improve some changelogs.Xin Long (5):
sctp: add a common helper function to generate stream reconf chunk
sctp: add support for generating stream reconf ssn reset request chunk
sctp: add support for generating stream reconf ssn/tsn reset request
chunk
sctp: add support for generating stream reconf response chunk
sctp: add support for generating stream reconf add streams request
chunk
Quoted 15 lines
include/linux/sctp.h | 68 ++++++++++++ include/net/sctp/sm.h | 17 ++- include/net/sctp/structs.h | 3 + net/sctp/associola.c | 1 + net/sctp/sm_make_chunk.c | 270 +++++++++++++++++++++++++++++++++++++++++++++ 5 files changed, 358 insertions(+), 1 deletion(-)Signature · 6 lines
2.1.0 -- To unsubscribe from this list: send the line "unsubscribe linux-sctp" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
These all look reasonably good, but it seems before we accept them, there should be an additional patch that actually makes use of the code. I presume that is forthcomming?
Neil
David Miller
maintainerFrom: Neil Horman <[email protected]>
Date: Mon, 9 Jan 2017 07:43:25 -0500
Quoted 3 lines
These all look reasonably good, but it seems before we accept them, there should be an additional patch that actually makes use of the code. I presume that is forthcomming?
This all comes from my asking that the original huge set of patches be split up.
People always just rush this kind of work and never think about laying out the resubmission properly.
One should always only submit new interfaces along with an actual use because only with a use can we properly review whether the new interface is good or not.
Xin Long
maintainerQuoted 10 lines · David Miller
From: Neil Horman <[email protected]>
Date: Mon, 9 Jan 2017 07:43:25 -0500Quoted 3 lines
These all look reasonably good, but it seems before we accept them, there should be an additional patch that actually makes use of the code. I presume that is forthcomming?
This all comes from my asking that the original huge set of patches be split up.
Quoted 6 lines
People always just rush this kind of work and never think about laying out the resubmission properly.
One should always only submit new interfaces along with an actual use because only with a use can we properly review whether the new interface is good or not.
I was trying to keep the same order with rfc, but it seems not a good idea, will resplit, thanks.
David Miller
maintainerFrom: Xin Long <[email protected]>
Date: Tue, 10 Jan 2017 02:27:09 +0800
Quoted 2 lines
I was trying to keep the same order with rfc, but it seems not a good idea, will resplit, thanks.
Thank you.
Marcelo Ricardo Leitner
maintainerQuoted 14 lines · Xin Long
Quoted 13 lines · David Miller
From: Neil Horman <[email protected]>
Date: Mon, 9 Jan 2017 07:43:25 -0500Quoted 3 lines
These all look reasonably good, but it seems before we accept them, there should be an additional patch that actually makes use of the code. I presume that is forthcomming?
This all comes from my asking that the original huge set of patches be split up.
People always just rush this kind of work and never think about laying out the resubmission properly.
Quoted 6 lines
Quoted 3 lines
One should always only submit new interfaces along with an actual use because only with a use can we properly review whether the new interface is good or not.
I was trying to keep the same order with rfc, but it seems not a good idea, will resplit, thanks.
Not sure how much it can help but one idea it to split it into requester and requested sides. Do the first patches/patchsets to make Linux able to accept/handle requests, and then to issue requests.
Marcelo