Skip to content

Commit c95129d

Browse files
lxindavem330
authored andcommitted
sctp: add support for generating assoc reset event notification
This patch is to add Association Reset Event described in rfc6525 section 6.1.2. Signed-off-by: Xin Long <lucien.xin@gmail.com> Signed-off-by: David S. Miller <davem@davemloft.net>
1 parent b3ca9af commit c95129d

File tree

3 files changed

+47
-0
lines changed

3 files changed

+47
-0
lines changed

include/net/sctp/ulpevent.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -132,6 +132,10 @@ struct sctp_ulpevent *sctp_ulpevent_make_stream_reset_event(
132132
const struct sctp_association *asoc, __u16 flags,
133133
__u16 stream_num, __u16 *stream_list, gfp_t gfp);
134134

135+
struct sctp_ulpevent *sctp_ulpevent_make_assoc_reset_event(
136+
const struct sctp_association *asoc, __u16 flags,
137+
__u32 local_tsn, __u32 remote_tsn, gfp_t gfp);
138+
135139
void sctp_ulpevent_read_sndrcvinfo(const struct sctp_ulpevent *event,
136140
struct msghdr *);
137141
void sctp_ulpevent_read_rcvinfo(const struct sctp_ulpevent *event,

include/uapi/linux/sctp.h

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -502,6 +502,17 @@ struct sctp_stream_reset_event {
502502
__u16 strreset_stream_list[];
503503
};
504504

505+
#define SCTP_ASSOC_RESET_DENIED 0x0004
506+
#define SCTP_ASSOC_RESET_FAILED 0x0008
507+
struct sctp_assoc_reset_event {
508+
__u16 assocreset_type;
509+
__u16 assocreset_flags;
510+
__u32 assocreset_length;
511+
sctp_assoc_t assocreset_assoc_id;
512+
__u32 assocreset_local_tsn;
513+
__u32 assocreset_remote_tsn;
514+
};
515+
505516
/*
506517
* Described in Section 7.3
507518
* Ancillary Data and Notification Interest Options
@@ -518,6 +529,7 @@ struct sctp_event_subscribe {
518529
__u8 sctp_authentication_event;
519530
__u8 sctp_sender_dry_event;
520531
__u8 sctp_stream_reset_event;
532+
__u8 sctp_assoc_reset_event;
521533
};
522534

523535
/*
@@ -543,6 +555,7 @@ union sctp_notification {
543555
struct sctp_authkey_event sn_authkey_event;
544556
struct sctp_sender_dry_event sn_sender_dry_event;
545557
struct sctp_stream_reset_event sn_strreset_event;
558+
struct sctp_assoc_reset_event sn_assocreset_event;
546559
};
547560

548561
/* Section 5.3.1
@@ -572,6 +585,8 @@ enum sctp_sn_type {
572585
#define SCTP_SENDER_DRY_EVENT SCTP_SENDER_DRY_EVENT
573586
SCTP_STREAM_RESET_EVENT,
574587
#define SCTP_STREAM_RESET_EVENT SCTP_STREAM_RESET_EVENT
588+
SCTP_ASSOC_RESET_EVENT,
589+
#define SCTP_ASSOC_RESET_EVENT SCTP_ASSOC_RESET_EVENT
575590
};
576591

577592
/* Notification error codes used to fill up the error fields in some

net/sctp/ulpevent.c

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -883,6 +883,34 @@ struct sctp_ulpevent *sctp_ulpevent_make_stream_reset_event(
883883
return event;
884884
}
885885

886+
struct sctp_ulpevent *sctp_ulpevent_make_assoc_reset_event(
887+
const struct sctp_association *asoc, __u16 flags, __u32 local_tsn,
888+
__u32 remote_tsn, gfp_t gfp)
889+
{
890+
struct sctp_assoc_reset_event *areset;
891+
struct sctp_ulpevent *event;
892+
struct sk_buff *skb;
893+
894+
event = sctp_ulpevent_new(sizeof(struct sctp_assoc_reset_event),
895+
MSG_NOTIFICATION, gfp);
896+
if (!event)
897+
return NULL;
898+
899+
skb = sctp_event2skb(event);
900+
areset = (struct sctp_assoc_reset_event *)
901+
skb_put(skb, sizeof(struct sctp_assoc_reset_event));
902+
903+
areset->assocreset_type = SCTP_ASSOC_RESET_EVENT;
904+
areset->assocreset_flags = flags;
905+
areset->assocreset_length = sizeof(struct sctp_assoc_reset_event);
906+
sctp_ulpevent_set_owner(event, asoc);
907+
areset->assocreset_assoc_id = sctp_assoc2id(asoc);
908+
areset->assocreset_local_tsn = local_tsn;
909+
areset->assocreset_remote_tsn = remote_tsn;
910+
911+
return event;
912+
}
913+
886914
/* Return the notification type, assuming this is a notification
887915
* event.
888916
*/

0 commit comments

Comments
 (0)