提交 c95129d1 编写于 作者: X Xin Long 提交者: David S. Miller

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: NXin Long <lucien.xin@gmail.com>
Signed-off-by: NDavid S. Miller <davem@davemloft.net>
上级 b3ca9af0
...@@ -132,6 +132,10 @@ struct sctp_ulpevent *sctp_ulpevent_make_stream_reset_event( ...@@ -132,6 +132,10 @@ struct sctp_ulpevent *sctp_ulpevent_make_stream_reset_event(
const struct sctp_association *asoc, __u16 flags, const struct sctp_association *asoc, __u16 flags,
__u16 stream_num, __u16 *stream_list, gfp_t gfp); __u16 stream_num, __u16 *stream_list, gfp_t gfp);
struct sctp_ulpevent *sctp_ulpevent_make_assoc_reset_event(
const struct sctp_association *asoc, __u16 flags,
__u32 local_tsn, __u32 remote_tsn, gfp_t gfp);
void sctp_ulpevent_read_sndrcvinfo(const struct sctp_ulpevent *event, void sctp_ulpevent_read_sndrcvinfo(const struct sctp_ulpevent *event,
struct msghdr *); struct msghdr *);
void sctp_ulpevent_read_rcvinfo(const struct sctp_ulpevent *event, void sctp_ulpevent_read_rcvinfo(const struct sctp_ulpevent *event,
......
...@@ -502,6 +502,17 @@ struct sctp_stream_reset_event { ...@@ -502,6 +502,17 @@ struct sctp_stream_reset_event {
__u16 strreset_stream_list[]; __u16 strreset_stream_list[];
}; };
#define SCTP_ASSOC_RESET_DENIED 0x0004
#define SCTP_ASSOC_RESET_FAILED 0x0008
struct sctp_assoc_reset_event {
__u16 assocreset_type;
__u16 assocreset_flags;
__u32 assocreset_length;
sctp_assoc_t assocreset_assoc_id;
__u32 assocreset_local_tsn;
__u32 assocreset_remote_tsn;
};
/* /*
* Described in Section 7.3 * Described in Section 7.3
* Ancillary Data and Notification Interest Options * Ancillary Data and Notification Interest Options
...@@ -518,6 +529,7 @@ struct sctp_event_subscribe { ...@@ -518,6 +529,7 @@ struct sctp_event_subscribe {
__u8 sctp_authentication_event; __u8 sctp_authentication_event;
__u8 sctp_sender_dry_event; __u8 sctp_sender_dry_event;
__u8 sctp_stream_reset_event; __u8 sctp_stream_reset_event;
__u8 sctp_assoc_reset_event;
}; };
/* /*
...@@ -543,6 +555,7 @@ union sctp_notification { ...@@ -543,6 +555,7 @@ union sctp_notification {
struct sctp_authkey_event sn_authkey_event; struct sctp_authkey_event sn_authkey_event;
struct sctp_sender_dry_event sn_sender_dry_event; struct sctp_sender_dry_event sn_sender_dry_event;
struct sctp_stream_reset_event sn_strreset_event; struct sctp_stream_reset_event sn_strreset_event;
struct sctp_assoc_reset_event sn_assocreset_event;
}; };
/* Section 5.3.1 /* Section 5.3.1
...@@ -572,6 +585,8 @@ enum sctp_sn_type { ...@@ -572,6 +585,8 @@ enum sctp_sn_type {
#define SCTP_SENDER_DRY_EVENT SCTP_SENDER_DRY_EVENT #define SCTP_SENDER_DRY_EVENT SCTP_SENDER_DRY_EVENT
SCTP_STREAM_RESET_EVENT, SCTP_STREAM_RESET_EVENT,
#define SCTP_STREAM_RESET_EVENT SCTP_STREAM_RESET_EVENT #define SCTP_STREAM_RESET_EVENT SCTP_STREAM_RESET_EVENT
SCTP_ASSOC_RESET_EVENT,
#define SCTP_ASSOC_RESET_EVENT SCTP_ASSOC_RESET_EVENT
}; };
/* Notification error codes used to fill up the error fields in some /* Notification error codes used to fill up the error fields in some
......
...@@ -883,6 +883,34 @@ struct sctp_ulpevent *sctp_ulpevent_make_stream_reset_event( ...@@ -883,6 +883,34 @@ struct sctp_ulpevent *sctp_ulpevent_make_stream_reset_event(
return event; return event;
} }
struct sctp_ulpevent *sctp_ulpevent_make_assoc_reset_event(
const struct sctp_association *asoc, __u16 flags, __u32 local_tsn,
__u32 remote_tsn, gfp_t gfp)
{
struct sctp_assoc_reset_event *areset;
struct sctp_ulpevent *event;
struct sk_buff *skb;
event = sctp_ulpevent_new(sizeof(struct sctp_assoc_reset_event),
MSG_NOTIFICATION, gfp);
if (!event)
return NULL;
skb = sctp_event2skb(event);
areset = (struct sctp_assoc_reset_event *)
skb_put(skb, sizeof(struct sctp_assoc_reset_event));
areset->assocreset_type = SCTP_ASSOC_RESET_EVENT;
areset->assocreset_flags = flags;
areset->assocreset_length = sizeof(struct sctp_assoc_reset_event);
sctp_ulpevent_set_owner(event, asoc);
areset->assocreset_assoc_id = sctp_assoc2id(asoc);
areset->assocreset_local_tsn = local_tsn;
areset->assocreset_remote_tsn = remote_tsn;
return event;
}
/* Return the notification type, assuming this is a notification /* Return the notification type, assuming this is a notification
* event. * event.
*/ */
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册