sctp: add subscribe per asoc and sockopt SCTP_EVENT
Subsystems (3)
Xin Long
maintainercover sctp: add subscribe per asoc and sockopt SCTP_EVENT
This patchset mainly adds the Event Subscription sockopt described in rfc6525#section-6.2:
Subscribing to events as described in [RFC6458] uses a setsockopt() call with the SCTP_EVENT socket option. This option takes the following structure, which specifies the association, the event type (using the same value found in the event type field), and an on/off boolean.
struct sctp_event {
sctp_assoc_t se_assoc_id;
uint16_t se_type;
uint8_t se_on;
};The user fills in the se_type field with the same value found in the strreset_type field, i.e., SCTP_STREAM_RESET_EVENT. The user will also fill in the se_assoc_id field with either the association to set this event on (this field is ignored for one-to-one style sockets) or one of the reserved constant values defined in [RFC6458]. Finally, the se_on field is set with a 1 to enable the event or a 0 to disable the event.
As for the old SCTP_EVENTS Option with struct sctp_event_subscribe, it's being DEPRECATED.
Xin Long (4):
sctp: define subscribe in sctp_sock as __u16
sctp: add subscribe per asoc
sctp: rename enum sctp_event to sctp_event_type
sctp: add sockopt SCTP_EVENT
include/net/sctp/constants.h | 2 +- include/net/sctp/sm.h | 4 +- include/net/sctp/structs.h | 4 +- include/net/sctp/ulpevent.h | 39 ++++++++------ include/uapi/linux/sctp.h | 13 ++++- net/sctp/associola.c | 2 + net/sctp/chunk.c | 8 ++- net/sctp/primitive.c | 2 +- net/sctp/sm_sideeffect.c | 12 ++--- net/sctp/sm_statetable.c | 2 +- net/sctp/socket.c | 126 ++++++++++++++++++++++++++++++++++++++++--- net/sctp/stream_interleave.c | 12 +++-- net/sctp/ulpqueue.c | 8 +-- 13 files changed, 184 insertions(+), 50 deletions(-)
Signature · 1 line
2.1.0
Xin Long
maintainerPATCH 3/4 sctp: rename enum sctp_event to sctp_event_type
In reply to a message not in the archivesctp_event is a structure name defined in RFC for sockopt SCTP_EVENT. To avoid the conflict, rename it.
--- include/net/sctp/constants.h | 2 +- include/net/sctp/sm.h | 4 ++-- net/sctp/primitive.c | 2 +- net/sctp/sm_sideeffect.c | 12 ++++++------ net/sctp/sm_statetable.c | 2 +- 5 files changed, 11 insertions(+), 11 deletions(-)
include/net/sctp/constants.h +1 -1
@@ -71,7 +71,7 @@ enum { SCTP_DEFAULT_INSTREAMS = SCTP_MAX_STREAM }; SCTP_NUM_AUTH_CHUNK_TYPES)/* These are the different flavours of event. */ -enum sctp_event { +enum sctp_event_type {SCTP_EVENT_T_CHUNK =1 ,SCTP_EVENT_T_TIMEOUT ,SCTP_EVENT_T_OTHER ,
include/net/sctp/sm.h +2 -2
@@ -173,7 +173,7 @@ sctp_state_fn_t sctp_sf_autoclose_timer_expire;__u8 sctp_get_chunk_type (struct sctp_chunk *chunk);const struct sctp_sm_table_entry *sctp_sm_lookup_event (struct net *net, -enum sctp_event event_type, +enum sctp_event_type event_type,enum sctp_state state,union sctp_subtype event_subtype);int sctp_chunk_iif (const struct sctp_chunk *);
@@ -313,7 +313,7 @@ struct sctp_chunk *sctp_process_strreset_resp(/* Prototypes for statetable processing. */ -int sctp_do_sm (struct net *net,enum sctp_event event_type, +int sctp_do_sm (struct net *net,enum sctp_event_type event_type,union sctp_subtype subtype,enum sctp_state state,struct sctp_endpoint *ep,struct sctp_association *asoc,void *event_arg,gfp_t gfp);
net/sctp/primitive.c +1 -1
@@ -53,7 +53,7 @@ int sctp_primitive_ ## name(struct net *net, struct sctp_association *asoc, \ void *arg) { \ int error = 0; \ - enum sctp_event event_type; union sctp_subtype subtype; \ + enum sctp_event_type event_type; union sctp_subtype subtype; \ enum sctp_state state; \ struct sctp_endpoint *ep; \ \
net/sctp/sm_sideeffect.c +6 -6
@@ -52,7 +52,7 @@#include <net/sctp/sm.h> #include <net/sctp/stream_sched.h> -static int sctp_cmd_interpreter(enum sctp_event event_type, +static int sctp_cmd_interpreter(enum sctp_event_type event_type, union sctp_subtype subtype, enum sctp_state state, struct sctp_endpoint *ep,
@@ -61,7 +61,7 @@ static int sctp_cmd_interpreter(enum sctp_event event_type,enum sctp_disposition status, struct sctp_cmd_seq *commands, gfp_t gfp); -static int sctp_side_effects(enum sctp_event event_type, +static int sctp_side_effects(enum sctp_event_type event_type, union sctp_subtype subtype, enum sctp_state state, struct sctp_endpoint *ep,
@@ -623,7 +623,7 @@ static void sctp_cmd_init_failed(struct sctp_cmd_seq *commands,/* Worker routine to handle SCTP_CMD_ASSOC_FAILED. */ static void sctp_cmd_assoc_failed (struct sctp_cmd_seq *commands,struct sctp_association *asoc, -enum sctp_event event_type, +enum sctp_event_type event_type,union sctp_subtype subtype,struct sctp_chunk *chunk,unsigned int error)
@@ -1162,7 +1162,7 @@ static void sctp_cmd_send_asconf(struct sctp_association *asoc)* If you want to understand all of lksctp, this is a * good place to start. */ -int sctp_do_sm (struct net *net,enum sctp_event event_type, +int sctp_do_sm (struct net *net,enum sctp_event_type event_type,union sctp_subtype subtype,enum sctp_state state,struct sctp_endpoint *ep,struct sctp_association *asoc,void *event_arg,gfp_t gfp)
@@ -1199,7 +1199,7 @@ int sctp_do_sm(struct net *net, enum sctp_event event_type,/***************************************************************** * This the master state function side effect processing function. *****************************************************************/ -static int sctp_side_effects(enum sctp_event event_type, +static int sctp_side_effects(enum sctp_event_type event_type, union sctp_subtype subtype, enum sctp_state state, struct sctp_endpoint *ep,
@@ -1285,7 +1285,7 @@ static int sctp_side_effects(enum sctp_event event_type,********************************************************************/ /* This is the side-effect interpreter. */ -static int sctp_cmd_interpreter(enum sctp_event event_type, +static int sctp_cmd_interpreter(enum sctp_event_type event_type, union sctp_subtype subtype, enum sctp_state state, struct sctp_endpoint *ep,
net/sctp/sm_statetable.c +1 -1
@@ -79,7 +79,7 @@ static const struct sctp_sm_table_entry bug = {const struct sctp_sm_table_entry *sctp_sm_lookup_event (struct net *net, -enum sctp_event event_type, +enum sctp_event_type event_type,enum sctp_state state,union sctp_subtype event_subtype) {
Signature · 1 line
2.1.0
Xin Long
maintainerPATCH 4/4 sctp: add sockopt SCTP_EVENT
This patch adds sockopt SCTP_EVENT described in rfc6525#section-6.2. With this sockopt users can subscribe to an event from a specified asoc.
--- include/uapi/linux/sctp.h | 7 ++++ net/sctp/socket.c | 89 +++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 96 insertions(+)
include/uapi/linux/sctp.h +7 -0
@@ -129,6 +129,7 @@ typedef __s32 sctp_assoc_t;#define SCTP_STREAM_SCHEDULER_VALUE 124#define SCTP_INTERLEAVING_SUPPORTED 125#define SCTP_SENDMSG_CONNECT 126 +#define SCTP_EVENT 127/* PR-SCTP policies */ #define SCTP_PR_SCTP_NONE 0x0000
@@ -1154,6 +1155,12 @@ struct sctp_add_streams {uint16_t sas_outstrms; }; +struct sctp_event { +sctp_assoc_t se_assoc_id; +uint16_t se_type; +uint8_t se_on; +}; +/* SCTP Stream schedulers */ enum sctp_sched_type {SCTP_SS_FCFS ,
net/sctp/socket.c +89 -0
113 lines not on this page · raw message
Signature · 1 line
2.1.0
Xin Long
maintainerQuoted 48 lines · Xin Long
This patchset mainly adds the Event Subscription sockopt described in rfc6525#section-6.2:
Subscribing to events as described in [RFC6458] uses a
setsockopt()call with theSCTP_EVENTsocket option. This option takes the following structure, which specifies the association, the event type (using the same value found in the event type field), and an on/off boolean.struct sctp_event { sctp_assoc_t se_assoc_id; uint16_t se_type; uint8_t se_on; };The user fills in the
se_typefield with the same value found in thestrreset_typefield, i.e.,SCTP_STREAM_RESET_EVENT. The user will also fill in these_assoc_idfield with either the association to set this event on (this field is ignored for one-to-one style sockets) or one of the reserved constant values defined in [RFC6458]. Finally, these_onfield is set with a 1 to enable the event or a 0 to disable the event.As for the old
SCTP_EVENTSOption with structsctp_event_subscribe, it's being DEPRECATED.Xin Long (4):
sctp: define subscribe insctp_sockas__u16
sctp: add subscribe per asoc
sctp: rename enumsctp_eventtosctp_event_type
sctp: add sockoptSCTP_EVENTinclude/net/sctp/constants.h | 2 +- include/net/sctp/sm.h | 4 +- include/net/sctp/structs.h | 4 +- include/net/sctp/ulpevent.h | 39 ++++++++------ include/uapi/linux/sctp.h | 13 ++++- net/sctp/associola.c | 2 + net/sctp/chunk.c | 8 ++- net/sctp/primitive.c | 2 +- net/sctp/sm_sideeffect.c | 12 ++--- net/sctp/sm_statetable.c | 2 +- net/sctp/socket.c | 126 ++++++++++++++++++++++++++++++++++++++++--- net/sctp/stream_interleave.c | 12 +++-- net/sctp/ulpqueue.c | 8 +-- 13 files changed, 184 insertions(+), 50 deletions(-)
Quoted 3 lines
--
2.1.0
Because some key word in changelog triggerred the filters at vger.kernel.org, v2 has been posted.