Deleted Added
full compact
sctp_timer.c (258454) sctp_timer.c (267723)
1/*-
2 * Copyright (c) 2001-2007, by Cisco Systems, Inc. All rights reserved.
3 * Copyright (c) 2008-2012, by Randall Stewart. All rights reserved.
4 * Copyright (c) 2008-2012, by Michael Tuexen. All rights reserved.
5 *
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions are met:
8 *

--- 17 unchanged lines hidden (view full) ---

26 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
27 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
28 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
29 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
30 * THE POSSIBILITY OF SUCH DAMAGE.
31 */
32
33#include <sys/cdefs.h>
1/*-
2 * Copyright (c) 2001-2007, by Cisco Systems, Inc. All rights reserved.
3 * Copyright (c) 2008-2012, by Randall Stewart. All rights reserved.
4 * Copyright (c) 2008-2012, by Michael Tuexen. All rights reserved.
5 *
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions are met:
8 *

--- 17 unchanged lines hidden (view full) ---

26 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
27 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
28 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
29 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
30 * THE POSSIBILITY OF SUCH DAMAGE.
31 */
32
33#include <sys/cdefs.h>
34__FBSDID("$FreeBSD: stable/10/sys/netinet/sctp_timer.c 258454 2013-11-21 23:00:09Z tuexen $");
34__FBSDID("$FreeBSD: stable/10/sys/netinet/sctp_timer.c 267723 2014-06-22 16:28:52Z tuexen $");
35
36#define _IP_VHL
37#include <netinet/sctp_os.h>
38#include <netinet/sctp_pcb.h>
39#ifdef INET6
40#endif
41#include <netinet/sctp_var.h>
42#include <netinet/sctp_sysctl.h>

--- 99 unchanged lines hidden (view full) ---

142 (uint32_t) threshold,
143 ((net == NULL) ? (uint32_t) 0 : (uint32_t) net->dest_state));
144 /*
145 * We specifically do not do >= to give the assoc one more change
146 * before we fail it.
147 */
148 if (stcb->asoc.overall_error_count > threshold) {
149 /* Abort notification sends a ULP notify */
35
36#define _IP_VHL
37#include <netinet/sctp_os.h>
38#include <netinet/sctp_pcb.h>
39#ifdef INET6
40#endif
41#include <netinet/sctp_var.h>
42#include <netinet/sctp_sysctl.h>

--- 99 unchanged lines hidden (view full) ---

142 (uint32_t) threshold,
143 ((net == NULL) ? (uint32_t) 0 : (uint32_t) net->dest_state));
144 /*
145 * We specifically do not do >= to give the assoc one more change
146 * before we fail it.
147 */
148 if (stcb->asoc.overall_error_count > threshold) {
149 /* Abort notification sends a ULP notify */
150 struct mbuf *oper;
150 struct mbuf *op_err;
151
151
152 oper = sctp_get_mbuf_for_msg((sizeof(struct sctp_paramhdr) + sizeof(uint32_t)),
153 0, M_NOWAIT, 1, MT_DATA);
154 if (oper) {
155 struct sctp_paramhdr *ph;
156 uint32_t *ippp;
157
158 SCTP_BUF_LEN(oper) = sizeof(struct sctp_paramhdr) +
159 sizeof(uint32_t);
160 ph = mtod(oper, struct sctp_paramhdr *);
161 ph->param_type = htons(SCTP_CAUSE_PROTOCOL_VIOLATION);
162 ph->param_length = htons(SCTP_BUF_LEN(oper));
163 ippp = (uint32_t *) (ph + 1);
164 *ippp = htonl(SCTP_FROM_SCTP_TIMER + SCTP_LOC_1);
165 }
152 op_err = sctp_generate_cause(SCTP_CAUSE_PROTOCOL_VIOLATION,
153 "Association error couter exceeded");
166 inp->last_abort_code = SCTP_FROM_SCTP_TIMER + SCTP_LOC_1;
154 inp->last_abort_code = SCTP_FROM_SCTP_TIMER + SCTP_LOC_1;
167 sctp_abort_an_association(inp, stcb, oper, SCTP_SO_NOT_LOCKED);
155 sctp_abort_an_association(inp, stcb, op_err, SCTP_SO_NOT_LOCKED);
168 return (1);
169 }
170 return (0);
171}
172
173/*
174 * sctp_find_alternate_net() returns a non-NULL pointer as long
175 * the argument net is non-NULL.

--- 870 unchanged lines hidden (view full) ---

1046 TAILQ_FOREACH(cookie, &stcb->asoc.control_send_queue, sctp_next) {
1047 if (cookie->rec.chunk_id.id == SCTP_COOKIE_ECHO) {
1048 break;
1049 }
1050 }
1051 if (cookie == NULL) {
1052 if (SCTP_GET_STATE(&stcb->asoc) == SCTP_STATE_COOKIE_ECHOED) {
1053 /* FOOBAR! */
156 return (1);
157 }
158 return (0);
159}
160
161/*
162 * sctp_find_alternate_net() returns a non-NULL pointer as long
163 * the argument net is non-NULL.

--- 870 unchanged lines hidden (view full) ---

1034 TAILQ_FOREACH(cookie, &stcb->asoc.control_send_queue, sctp_next) {
1035 if (cookie->rec.chunk_id.id == SCTP_COOKIE_ECHO) {
1036 break;
1037 }
1038 }
1039 if (cookie == NULL) {
1040 if (SCTP_GET_STATE(&stcb->asoc) == SCTP_STATE_COOKIE_ECHOED) {
1041 /* FOOBAR! */
1054 struct mbuf *oper;
1042 struct mbuf *op_err;
1055
1043
1056 oper = sctp_get_mbuf_for_msg((sizeof(struct sctp_paramhdr) + sizeof(uint32_t)),
1057 0, M_NOWAIT, 1, MT_DATA);
1058 if (oper) {
1059 struct sctp_paramhdr *ph;
1060 uint32_t *ippp;
1061
1062 SCTP_BUF_LEN(oper) = sizeof(struct sctp_paramhdr) +
1063 sizeof(uint32_t);
1064 ph = mtod(oper, struct sctp_paramhdr *);
1065 ph->param_type = htons(SCTP_CAUSE_PROTOCOL_VIOLATION);
1066 ph->param_length = htons(SCTP_BUF_LEN(oper));
1067 ippp = (uint32_t *) (ph + 1);
1068 *ippp = htonl(SCTP_FROM_SCTP_TIMER + SCTP_LOC_3);
1069 }
1044 op_err = sctp_generate_cause(SCTP_CAUSE_PROTOCOL_VIOLATION,
1045 "Cookie timer expired, but no cookie");
1070 inp->last_abort_code = SCTP_FROM_SCTP_TIMER + SCTP_LOC_4;
1046 inp->last_abort_code = SCTP_FROM_SCTP_TIMER + SCTP_LOC_4;
1071 sctp_abort_an_association(inp, stcb, oper, SCTP_SO_NOT_LOCKED);
1047 sctp_abort_an_association(inp, stcb, op_err, SCTP_SO_NOT_LOCKED);
1072 } else {
1073#ifdef INVARIANTS
1074 panic("Cookie timer expires in wrong state?");
1075#else
1076 SCTP_PRINTF("Strange in state %d not cookie-echoed yet c-e timer expires?\n", SCTP_GET_STATE(&stcb->asoc));
1077 return (0);
1078#endif
1079 }

--- 521 unchanged lines hidden ---
1048 } else {
1049#ifdef INVARIANTS
1050 panic("Cookie timer expires in wrong state?");
1051#else
1052 SCTP_PRINTF("Strange in state %d not cookie-echoed yet c-e timer expires?\n", SCTP_GET_STATE(&stcb->asoc));
1053 return (0);
1054#endif
1055 }

--- 521 unchanged lines hidden ---