Deleted Added
full compact
sctp_input.c (172156) sctp_input.c (172190)
1/*-
2 * Copyright (c) 2001-2007, by Cisco Systems, Inc. All rights reserved.
3 *
4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are met:
6 *
7 * a) Redistributions of source code must retain the above copyright notice,
8 * this list of conditions and the following disclaimer.

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

26 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
27 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
28 * THE POSSIBILITY OF SUCH DAMAGE.
29 */
30
31/* $KAME: sctp_input.c,v 1.27 2005/03/06 16:04:17 itojun Exp $ */
32
33#include <sys/cdefs.h>
1/*-
2 * Copyright (c) 2001-2007, by Cisco Systems, Inc. All rights reserved.
3 *
4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are met:
6 *
7 * a) Redistributions of source code must retain the above copyright notice,
8 * this list of conditions and the following disclaimer.

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

26 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
27 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
28 * THE POSSIBILITY OF SUCH DAMAGE.
29 */
30
31/* $KAME: sctp_input.c,v 1.27 2005/03/06 16:04:17 itojun Exp $ */
32
33#include <sys/cdefs.h>
34__FBSDID("$FreeBSD: head/sys/netinet/sctp_input.c 172156 2007-09-13 10:36:43Z rrs $");
34__FBSDID("$FreeBSD: head/sys/netinet/sctp_input.c 172190 2007-09-15 19:07:42Z rrs $");
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>

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

1976 (void)sctp_free_assoc(inp, stcb, SCTP_NORMAL_PROC, SCTP_FROM_SCTP_INPUT + SCTP_LOC_19);
1977#if defined (__APPLE__) || defined(SCTP_SO_LOCK_TESTING)
1978 SCTP_SOCKET_UNLOCK(so, 1);
1979#endif
1980 atomic_subtract_int(&stcb->asoc.refcnt, 1);
1981 return (NULL);
1982 }
1983
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>

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

1976 (void)sctp_free_assoc(inp, stcb, SCTP_NORMAL_PROC, SCTP_FROM_SCTP_INPUT + SCTP_LOC_19);
1977#if defined (__APPLE__) || defined(SCTP_SO_LOCK_TESTING)
1978 SCTP_SOCKET_UNLOCK(so, 1);
1979#endif
1980 atomic_subtract_int(&stcb->asoc.refcnt, 1);
1981 return (NULL);
1982 }
1983
1984 sctp_check_address_list(stcb, m,
1985 initack_offset + sizeof(struct sctp_init_ack_chunk),
1986 initack_limit - (initack_offset + sizeof(struct sctp_init_ack_chunk)),
1987 initack_src, cookie->local_scope, cookie->site_scope,
1988 cookie->ipv4_scope, cookie->loopback_scope);
1989
1990
1991 /* set up to notify upper layer */
1992 *notification = SCTP_NOTIFY_ASSOC_UP;
1993 if (((stcb->sctp_ep->sctp_flags & SCTP_PCB_FLAGS_TCPTYPE) ||
1994 (stcb->sctp_ep->sctp_flags & SCTP_PCB_FLAGS_IN_TCPPOOL)) &&
1995 (inp->sctp_socket->so_qlimit == 0)) {
1996 /*
1997 * This is an endpoint that called connect() how it got a
1998 * cookie that is NEW is a bit of a mystery. It must be that

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

2029 /* since we did not send a HB make sure we don't double things */
2030 if ((netp) && (*netp))
2031 (*netp)->hb_responded = 1;
2032
2033 if (stcb->asoc.sctp_autoclose_ticks &&
2034 sctp_is_feature_on(inp, SCTP_PCB_FLAGS_AUTOCLOSE)) {
2035 sctp_timer_start(SCTP_TIMER_TYPE_AUTOCLOSE, inp, stcb, NULL);
2036 }
1984 /* set up to notify upper layer */
1985 *notification = SCTP_NOTIFY_ASSOC_UP;
1986 if (((stcb->sctp_ep->sctp_flags & SCTP_PCB_FLAGS_TCPTYPE) ||
1987 (stcb->sctp_ep->sctp_flags & SCTP_PCB_FLAGS_IN_TCPPOOL)) &&
1988 (inp->sctp_socket->so_qlimit == 0)) {
1989 /*
1990 * This is an endpoint that called connect() how it got a
1991 * cookie that is NEW is a bit of a mystery. It must be that

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

2022 /* since we did not send a HB make sure we don't double things */
2023 if ((netp) && (*netp))
2024 (*netp)->hb_responded = 1;
2025
2026 if (stcb->asoc.sctp_autoclose_ticks &&
2027 sctp_is_feature_on(inp, SCTP_PCB_FLAGS_AUTOCLOSE)) {
2028 sctp_timer_start(SCTP_TIMER_TYPE_AUTOCLOSE, inp, stcb, NULL);
2029 }
2037 /* respond with a COOKIE-ACK */
2038 /* calculate the RTT */
2039 (void)SCTP_GETTIME_TIMEVAL(&stcb->asoc.time_entered);
2040 if ((netp) && (*netp)) {
2041 (*netp)->RTO = sctp_calculate_rto(stcb, asoc, *netp,
2042 &cookie->time_entered, sctp_align_unsafe_makecopy);
2043 }
2030 /* calculate the RTT */
2031 (void)SCTP_GETTIME_TIMEVAL(&stcb->asoc.time_entered);
2032 if ((netp) && (*netp)) {
2033 (*netp)->RTO = sctp_calculate_rto(stcb, asoc, *netp,
2034 &cookie->time_entered, sctp_align_unsafe_makecopy);
2035 }
2036 /* respond with a COOKIE-ACK */
2044 sctp_send_cookie_ack(stcb);
2037 sctp_send_cookie_ack(stcb);
2038
2039 /*
2040 * check the address lists for any ASCONFs that need to be sent
2041 * AFTER the cookie-ack is sent
2042 */
2043 sctp_check_address_list(stcb, m,
2044 initack_offset + sizeof(struct sctp_init_ack_chunk),
2045 initack_limit - (initack_offset + sizeof(struct sctp_init_ack_chunk)),
2046 initack_src, cookie->local_scope, cookie->site_scope,
2047 cookie->ipv4_scope, cookie->loopback_scope);
2048
2049
2045 return (stcb);
2046}
2047
2048
2049/*
2050 * handles a COOKIE-ECHO message stcb: modified to either a new or left as
2051 * existing (non-NULL) TCB
2052 */

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

2608 if ((sctp_is_feature_on(stcb->sctp_ep, SCTP_PCB_FLAGS_DO_ASCONF)) &&
2609 (stcb->asoc.peer_supports_asconf) &&
2610 (!TAILQ_EMPTY(&stcb->asoc.asconf_queue))) {
2611#ifdef SCTP_TIMER_BASED_ASCONF
2612 sctp_timer_start(SCTP_TIMER_TYPE_ASCONF,
2613 stcb->sctp_ep, stcb,
2614 stcb->asoc.primary_destination);
2615#else
2050 return (stcb);
2051}
2052
2053
2054/*
2055 * handles a COOKIE-ECHO message stcb: modified to either a new or left as
2056 * existing (non-NULL) TCB
2057 */

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

2613 if ((sctp_is_feature_on(stcb->sctp_ep, SCTP_PCB_FLAGS_DO_ASCONF)) &&
2614 (stcb->asoc.peer_supports_asconf) &&
2615 (!TAILQ_EMPTY(&stcb->asoc.asconf_queue))) {
2616#ifdef SCTP_TIMER_BASED_ASCONF
2617 sctp_timer_start(SCTP_TIMER_TYPE_ASCONF,
2618 stcb->sctp_ep, stcb,
2619 stcb->asoc.primary_destination);
2620#else
2616 sctp_send_asconf(stcb, stcb->asoc.primary_destination);
2621 sctp_send_asconf(stcb, stcb->asoc.primary_destination,
2622 SCTP_ADDR_NOT_LOCKED);
2617#endif
2618 }
2619 }
2620 /* Toss the cookie if I can */
2621 sctp_toss_old_cookies(stcb, asoc);
2622 if (!TAILQ_EMPTY(&asoc->sent_queue)) {
2623 /* Restart the timer if we have pending data */
2624 struct sctp_tmit_chunk *chk;

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

4604 sctp_misc_ints(SCTP_THRESHOLD_CLEAR,
4605 stcb->asoc.overall_error_count,
4606 0,
4607 SCTP_FROM_SCTP_INPUT,
4608 __LINE__);
4609 }
4610 stcb->asoc.overall_error_count = 0;
4611 sctp_handle_asconf_ack(m, *offset,
2623#endif
2624 }
2625 }
2626 /* Toss the cookie if I can */
2627 sctp_toss_old_cookies(stcb, asoc);
2628 if (!TAILQ_EMPTY(&asoc->sent_queue)) {
2629 /* Restart the timer if we have pending data */
2630 struct sctp_tmit_chunk *chk;

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

4610 sctp_misc_ints(SCTP_THRESHOLD_CLEAR,
4611 stcb->asoc.overall_error_count,
4612 0,
4613 SCTP_FROM_SCTP_INPUT,
4614 __LINE__);
4615 }
4616 stcb->asoc.overall_error_count = 0;
4617 sctp_handle_asconf_ack(m, *offset,
4612 (struct sctp_asconf_ack_chunk *)ch, stcb, *netp);
4618 (struct sctp_asconf_ack_chunk *)ch, stcb, *netp, &abort_no_unlock);
4619 if (abort_no_unlock)
4620 return (NULL);
4613 }
4614 break;
4615 case SCTP_FORWARD_CUM_TSN:
4616 SCTPDBG(SCTP_DEBUG_INPUT3, "SCTP_FWD-TSN\n");
4617 if (chk_length < sizeof(struct sctp_forward_tsn_chunk)) {
4618 /* Its not ours */
4619 if (locked_tcb) {
4620 SCTP_TCB_UNLOCK(locked_tcb);

--- 761 unchanged lines hidden ---
4621 }
4622 break;
4623 case SCTP_FORWARD_CUM_TSN:
4624 SCTPDBG(SCTP_DEBUG_INPUT3, "SCTP_FWD-TSN\n");
4625 if (chk_length < sizeof(struct sctp_forward_tsn_chunk)) {
4626 /* Its not ours */
4627 if (locked_tcb) {
4628 SCTP_TCB_UNLOCK(locked_tcb);

--- 761 unchanged lines hidden ---