Deleted Added
full compact
sctp_indata.c (243882) sctp_indata.c (246588)
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: head/sys/netinet/sctp_indata.c 243882 2012-12-05 08:04:20Z glebius $");
34__FBSDID("$FreeBSD: head/sys/netinet/sctp_indata.c 246588 2013-02-09 08:27:08Z tuexen $");
35
36#include <netinet/sctp_os.h>
37#include <netinet/sctp_var.h>
38#include <netinet/sctp_sysctl.h>
39#include <netinet/sctp_pcb.h>
40#include <netinet/sctp_header.h>
41#include <netinet/sctputil.h>
42#include <netinet/sctp_output.h>

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

4257 stcb->sctp_ep, stcb, netp);
4258 sctp_timer_start(SCTP_TIMER_TYPE_SHUTDOWNGUARD,
4259 stcb->sctp_ep, stcb, netp);
4260 }
4261 } else if ((SCTP_GET_STATE(asoc) == SCTP_STATE_SHUTDOWN_RECEIVED) &&
4262 (asoc->stream_queue_cnt == 0)) {
4263 struct sctp_nets *netp;
4264
35
36#include <netinet/sctp_os.h>
37#include <netinet/sctp_var.h>
38#include <netinet/sctp_sysctl.h>
39#include <netinet/sctp_pcb.h>
40#include <netinet/sctp_header.h>
41#include <netinet/sctputil.h>
42#include <netinet/sctp_output.h>

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

4257 stcb->sctp_ep, stcb, netp);
4258 sctp_timer_start(SCTP_TIMER_TYPE_SHUTDOWNGUARD,
4259 stcb->sctp_ep, stcb, netp);
4260 }
4261 } else if ((SCTP_GET_STATE(asoc) == SCTP_STATE_SHUTDOWN_RECEIVED) &&
4262 (asoc->stream_queue_cnt == 0)) {
4263 struct sctp_nets *netp;
4264
4265 if (asoc->alternate) {
4266 netp = asoc->alternate;
4267 } else {
4268 netp = asoc->primary_destination;
4269 }
4270 if (asoc->state & SCTP_STATE_PARTIAL_MSG_LEFT) {
4271 goto abort_out_now;
4272 }
4273 SCTP_STAT_DECR_GAUGE32(sctps_currestab);
4274 SCTP_SET_STATE(asoc, SCTP_STATE_SHUTDOWN_ACK_SENT);
4275 SCTP_CLEAR_SUBSTATE(asoc, SCTP_STATE_SHUTDOWN_PENDING);
4265 if (asoc->state & SCTP_STATE_PARTIAL_MSG_LEFT) {
4266 goto abort_out_now;
4267 }
4268 SCTP_STAT_DECR_GAUGE32(sctps_currestab);
4269 SCTP_SET_STATE(asoc, SCTP_STATE_SHUTDOWN_ACK_SENT);
4270 SCTP_CLEAR_SUBSTATE(asoc, SCTP_STATE_SHUTDOWN_PENDING);
4276 sctp_send_shutdown_ack(stcb, netp);
4277 sctp_stop_timers_for_shutdown(stcb);
4271 sctp_stop_timers_for_shutdown(stcb);
4272 if (asoc->alternate) {
4273 netp = asoc->alternate;
4274 } else {
4275 netp = asoc->primary_destination;
4276 }
4277 sctp_send_shutdown_ack(stcb, netp);
4278 sctp_timer_start(SCTP_TIMER_TYPE_SHUTDOWNACK,
4279 stcb->sctp_ep, stcb, netp);
4280 }
4281 }
4282 /*********************************************/
4283 /* Here we perform PR-SCTP procedures */
4284 /* (section 4.2) */
4285 /*********************************************/

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

4968 *ippp = htonl(SCTP_FROM_SCTP_INDATA + SCTP_LOC_31);
4969 }
4970 stcb->sctp_ep->last_abort_code = SCTP_FROM_SCTP_INDATA + SCTP_LOC_31;
4971 sctp_abort_an_association(stcb->sctp_ep, stcb, oper, SCTP_SO_NOT_LOCKED);
4972 return;
4973 } else {
4974 struct sctp_nets *netp;
4975
4278 sctp_timer_start(SCTP_TIMER_TYPE_SHUTDOWNACK,
4279 stcb->sctp_ep, stcb, netp);
4280 }
4281 }
4282 /*********************************************/
4283 /* Here we perform PR-SCTP procedures */
4284 /* (section 4.2) */
4285 /*********************************************/

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

4968 *ippp = htonl(SCTP_FROM_SCTP_INDATA + SCTP_LOC_31);
4969 }
4970 stcb->sctp_ep->last_abort_code = SCTP_FROM_SCTP_INDATA + SCTP_LOC_31;
4971 sctp_abort_an_association(stcb->sctp_ep, stcb, oper, SCTP_SO_NOT_LOCKED);
4972 return;
4973 } else {
4974 struct sctp_nets *netp;
4975
4976 if (asoc->alternate) {
4977 netp = asoc->alternate;
4978 } else {
4979 netp = asoc->primary_destination;
4980 }
4981 if ((SCTP_GET_STATE(asoc) == SCTP_STATE_OPEN) ||
4982 (SCTP_GET_STATE(asoc) == SCTP_STATE_SHUTDOWN_RECEIVED)) {
4983 SCTP_STAT_DECR_GAUGE32(sctps_currestab);
4984 }
4985 SCTP_SET_STATE(asoc, SCTP_STATE_SHUTDOWN_SENT);
4986 SCTP_CLEAR_SUBSTATE(asoc, SCTP_STATE_SHUTDOWN_PENDING);
4987 sctp_stop_timers_for_shutdown(stcb);
4976 if ((SCTP_GET_STATE(asoc) == SCTP_STATE_OPEN) ||
4977 (SCTP_GET_STATE(asoc) == SCTP_STATE_SHUTDOWN_RECEIVED)) {
4978 SCTP_STAT_DECR_GAUGE32(sctps_currestab);
4979 }
4980 SCTP_SET_STATE(asoc, SCTP_STATE_SHUTDOWN_SENT);
4981 SCTP_CLEAR_SUBSTATE(asoc, SCTP_STATE_SHUTDOWN_PENDING);
4982 sctp_stop_timers_for_shutdown(stcb);
4983 if (asoc->alternate) {
4984 netp = asoc->alternate;
4985 } else {
4986 netp = asoc->primary_destination;
4987 }
4988 sctp_send_shutdown(stcb, netp);
4989 sctp_timer_start(SCTP_TIMER_TYPE_SHUTDOWN,
4990 stcb->sctp_ep, stcb, netp);
4991 sctp_timer_start(SCTP_TIMER_TYPE_SHUTDOWNGUARD,
4992 stcb->sctp_ep, stcb, netp);
4993 }
4994 return;
4995 } else if ((SCTP_GET_STATE(asoc) == SCTP_STATE_SHUTDOWN_RECEIVED) &&
4996 (asoc->stream_queue_cnt == 0)) {
4997 struct sctp_nets *netp;
4998
4988 sctp_send_shutdown(stcb, netp);
4989 sctp_timer_start(SCTP_TIMER_TYPE_SHUTDOWN,
4990 stcb->sctp_ep, stcb, netp);
4991 sctp_timer_start(SCTP_TIMER_TYPE_SHUTDOWNGUARD,
4992 stcb->sctp_ep, stcb, netp);
4993 }
4994 return;
4995 } else if ((SCTP_GET_STATE(asoc) == SCTP_STATE_SHUTDOWN_RECEIVED) &&
4996 (asoc->stream_queue_cnt == 0)) {
4997 struct sctp_nets *netp;
4998
4999 if (asoc->alternate) {
5000 netp = asoc->alternate;
5001 } else {
5002 netp = asoc->primary_destination;
5003 }
5004 if (asoc->state & SCTP_STATE_PARTIAL_MSG_LEFT) {
5005 goto abort_out_now;
5006 }
5007 SCTP_STAT_DECR_GAUGE32(sctps_currestab);
5008 SCTP_SET_STATE(asoc, SCTP_STATE_SHUTDOWN_ACK_SENT);
5009 SCTP_CLEAR_SUBSTATE(asoc, SCTP_STATE_SHUTDOWN_PENDING);
4999 if (asoc->state & SCTP_STATE_PARTIAL_MSG_LEFT) {
5000 goto abort_out_now;
5001 }
5002 SCTP_STAT_DECR_GAUGE32(sctps_currestab);
5003 SCTP_SET_STATE(asoc, SCTP_STATE_SHUTDOWN_ACK_SENT);
5004 SCTP_CLEAR_SUBSTATE(asoc, SCTP_STATE_SHUTDOWN_PENDING);
5010 sctp_send_shutdown_ack(stcb, netp);
5011 sctp_stop_timers_for_shutdown(stcb);
5005 sctp_stop_timers_for_shutdown(stcb);
5006 if (asoc->alternate) {
5007 netp = asoc->alternate;
5008 } else {
5009 netp = asoc->primary_destination;
5010 }
5011 sctp_send_shutdown_ack(stcb, netp);
5012 sctp_timer_start(SCTP_TIMER_TYPE_SHUTDOWNACK,
5013 stcb->sctp_ep, stcb, netp);
5014 return;
5015 }
5016 }
5017 /*
5018 * Now here we are going to recycle net_ack for a different use...
5019 * HEADS UP.

--- 592 unchanged lines hidden ---
5012 sctp_timer_start(SCTP_TIMER_TYPE_SHUTDOWNACK,
5013 stcb->sctp_ep, stcb, netp);
5014 return;
5015 }
5016 }
5017 /*
5018 * Now here we are going to recycle net_ack for a different use...
5019 * HEADS UP.

--- 592 unchanged lines hidden ---