Add support for the sac_info field in struct sctp_assoc_change

as required by RFC 6458.

MFC after: 3 days
This commit is contained in:
Michael Tuexen 2012-05-06 13:09:13 +00:00
parent eb3b1cd0de
commit e06b67c756
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=235081
2 changed files with 30 additions and 7 deletions

View File

@ -296,16 +296,23 @@ struct sctp_assoc_change {
uint16_t sac_outbound_streams;
uint16_t sac_inbound_streams;
sctp_assoc_t sac_assoc_id;
uint8_t sac_info[];
};
/* sac_state values */
#define SCTP_COMM_UP 0x0001
#define SCTP_COMM_LOST 0x0002
#define SCTP_RESTART 0x0003
#define SCTP_SHUTDOWN_COMP 0x0004
#define SCTP_CANT_STR_ASSOC 0x0005
#define SCTP_COMM_UP 0x0001
#define SCTP_COMM_LOST 0x0002
#define SCTP_RESTART 0x0003
#define SCTP_SHUTDOWN_COMP 0x0004
#define SCTP_CANT_STR_ASSOC 0x0005
/* sac_info values */
#define SCTP_ASSOC_SUPPORTS_PR 0x01
#define SCTP_ASSOC_SUPPORTS_AUTH 0x02
#define SCTP_ASSOC_SUPPORTS_ASCONF 0x03
#define SCTP_ASSOC_SUPPORTS_MULTIBUF 0x04
#define SCTP_ASSOC_SUPPORTS_RE_CONFIG 0x05
#define SCTP_ASSOC_SUPPORTS_MAX 0x05
/*
* Address event
*/

View File

@ -2602,6 +2602,7 @@ sctp_notify_assoc_change(uint32_t event, struct sctp_tcb *stcb,
struct mbuf *m_notify;
struct sctp_assoc_change *sac;
struct sctp_queued_to_read *control;
unsigned int i;
#if defined (__APPLE__) || defined(SCTP_SO_LOCK_TESTING)
struct socket *so;
@ -2666,7 +2667,22 @@ sctp_notify_assoc_change(uint32_t event, struct sctp_tcb *stcb,
sac->sac_outbound_streams = stcb->asoc.streamoutcnt;
sac->sac_inbound_streams = stcb->asoc.streamincnt;
sac->sac_assoc_id = sctp_get_associd(stcb);
SCTP_BUF_LEN(m_notify) = sizeof(struct sctp_assoc_change);
i = 0;
if (stcb->asoc.peer_supports_prsctp) {
sac->sac_info[i++] = SCTP_ASSOC_SUPPORTS_PR;
}
if (stcb->asoc.peer_supports_auth) {
sac->sac_info[i++] = SCTP_ASSOC_SUPPORTS_AUTH;
}
if (stcb->asoc.peer_supports_asconf) {
sac->sac_info[i++] = SCTP_ASSOC_SUPPORTS_ASCONF;
}
sac->sac_info[i++] = SCTP_ASSOC_SUPPORTS_MULTIBUF;
if (stcb->asoc.peer_supports_strreset) {
sac->sac_info[i++] = SCTP_ASSOC_SUPPORTS_RE_CONFIG;
}
sac->sac_length += i;
SCTP_BUF_LEN(m_notify) = sac->sac_length;
SCTP_BUF_NEXT(m_notify) = NULL;
control = sctp_build_readq_entry(stcb, stcb->asoc.primary_destination,
0, 0, stcb->asoc.context, 0, 0, 0,