diff options
author | tuexen <tuexen@FreeBSD.org> | 2014-06-22 16:28:52 +0000 |
---|---|---|
committer | tuexen <tuexen@FreeBSD.org> | 2014-06-22 16:28:52 +0000 |
commit | bfa185cf87a08086dbf1c5a1511f85f3c71ffba7 (patch) | |
tree | 82bfc760cb279faed99e0faa9190ad31973ea089 /sys/netinet/sctp_timer.c | |
parent | 23098a703ac8e491721697eacf342e5e61144188 (diff) | |
download | FreeBSD-src-bfa185cf87a08086dbf1c5a1511f85f3c71ffba7.zip FreeBSD-src-bfa185cf87a08086dbf1c5a1511f85f3c71ffba7.tar.gz |
MFC r263237:
* Provide information in error causes in ASCII instead of
proprietary binary format.
* Add support for a diagnostic information error cause.
The code is sysctlable and the default is 0, which
means it is not sent.
This is joint work with rrs@.
Diffstat (limited to 'sys/netinet/sctp_timer.c')
-rw-r--r-- | sys/netinet/sctp_timer.c | 44 |
1 files changed, 10 insertions, 34 deletions
diff --git a/sys/netinet/sctp_timer.c b/sys/netinet/sctp_timer.c index 188b086..2aef412 100644 --- a/sys/netinet/sctp_timer.c +++ b/sys/netinet/sctp_timer.c @@ -147,24 +147,12 @@ sctp_threshold_management(struct sctp_inpcb *inp, struct sctp_tcb *stcb, */ if (stcb->asoc.overall_error_count > threshold) { /* Abort notification sends a ULP notify */ - struct mbuf *oper; - - oper = sctp_get_mbuf_for_msg((sizeof(struct sctp_paramhdr) + sizeof(uint32_t)), - 0, M_NOWAIT, 1, MT_DATA); - if (oper) { - struct sctp_paramhdr *ph; - uint32_t *ippp; - - SCTP_BUF_LEN(oper) = sizeof(struct sctp_paramhdr) + - sizeof(uint32_t); - ph = mtod(oper, struct sctp_paramhdr *); - ph->param_type = htons(SCTP_CAUSE_PROTOCOL_VIOLATION); - ph->param_length = htons(SCTP_BUF_LEN(oper)); - ippp = (uint32_t *) (ph + 1); - *ippp = htonl(SCTP_FROM_SCTP_TIMER + SCTP_LOC_1); - } + struct mbuf *op_err; + + op_err = sctp_generate_cause(SCTP_CAUSE_PROTOCOL_VIOLATION, + "Association error couter exceeded"); inp->last_abort_code = SCTP_FROM_SCTP_TIMER + SCTP_LOC_1; - sctp_abort_an_association(inp, stcb, oper, SCTP_SO_NOT_LOCKED); + sctp_abort_an_association(inp, stcb, op_err, SCTP_SO_NOT_LOCKED); return (1); } return (0); @@ -1051,24 +1039,12 @@ sctp_cookie_timer(struct sctp_inpcb *inp, if (cookie == NULL) { if (SCTP_GET_STATE(&stcb->asoc) == SCTP_STATE_COOKIE_ECHOED) { /* FOOBAR! */ - struct mbuf *oper; - - oper = sctp_get_mbuf_for_msg((sizeof(struct sctp_paramhdr) + sizeof(uint32_t)), - 0, M_NOWAIT, 1, MT_DATA); - if (oper) { - struct sctp_paramhdr *ph; - uint32_t *ippp; - - SCTP_BUF_LEN(oper) = sizeof(struct sctp_paramhdr) + - sizeof(uint32_t); - ph = mtod(oper, struct sctp_paramhdr *); - ph->param_type = htons(SCTP_CAUSE_PROTOCOL_VIOLATION); - ph->param_length = htons(SCTP_BUF_LEN(oper)); - ippp = (uint32_t *) (ph + 1); - *ippp = htonl(SCTP_FROM_SCTP_TIMER + SCTP_LOC_3); - } + struct mbuf *op_err; + + op_err = sctp_generate_cause(SCTP_CAUSE_PROTOCOL_VIOLATION, + "Cookie timer expired, but no cookie"); inp->last_abort_code = SCTP_FROM_SCTP_TIMER + SCTP_LOC_4; - sctp_abort_an_association(inp, stcb, oper, SCTP_SO_NOT_LOCKED); + sctp_abort_an_association(inp, stcb, op_err, SCTP_SO_NOT_LOCKED); } else { #ifdef INVARIANTS panic("Cookie timer expires in wrong state?"); |