Deleted Added
full compact
sctputil.c (168709) sctputil.c (168859)
1/*-
2 * Copyright (c) 2001-2007, 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: sctputil.c,v 1.37 2005/03/07 23:26:09 itojun Exp $ */
32
33#include <sys/cdefs.h>
1/*-
2 * Copyright (c) 2001-2007, 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: sctputil.c,v 1.37 2005/03/07 23:26:09 itojun Exp $ */
32
33#include <sys/cdefs.h>
34__FBSDID("$FreeBSD: head/sys/netinet/sctputil.c 168709 2007-04-14 09:44:09Z rrs $");
34__FBSDID("$FreeBSD: head/sys/netinet/sctputil.c 168859 2007-04-19 11:28:43Z rrs $");
35
36#include <netinet/sctp_os.h>
37#include <netinet/sctp_pcb.h>
38#include <netinet/sctputil.h>
39#include <netinet/sctp_var.h>
40#include <netinet/sctp_sysctl.h>
41#ifdef INET6
42#include <netinet6/sctp6_var.h>

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

1080 "MappingArray");
1081 if (asoc->mapping_array == NULL) {
1082 SCTP_FREE(asoc->strmout);
1083 return (ENOMEM);
1084 }
1085 memset(asoc->mapping_array, 0, asoc->mapping_array_size);
1086 /* Now the init of the other outqueues */
1087 TAILQ_INIT(&asoc->free_chunks);
35
36#include <netinet/sctp_os.h>
37#include <netinet/sctp_pcb.h>
38#include <netinet/sctputil.h>
39#include <netinet/sctp_var.h>
40#include <netinet/sctp_sysctl.h>
41#ifdef INET6
42#include <netinet6/sctp6_var.h>

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

1080 "MappingArray");
1081 if (asoc->mapping_array == NULL) {
1082 SCTP_FREE(asoc->strmout);
1083 return (ENOMEM);
1084 }
1085 memset(asoc->mapping_array, 0, asoc->mapping_array_size);
1086 /* Now the init of the other outqueues */
1087 TAILQ_INIT(&asoc->free_chunks);
1088 TAILQ_INIT(&asoc->free_strmoq);
1089 TAILQ_INIT(&asoc->out_wheel);
1090 TAILQ_INIT(&asoc->control_send_queue);
1091 TAILQ_INIT(&asoc->send_queue);
1092 TAILQ_INIT(&asoc->sent_queue);
1093 TAILQ_INIT(&asoc->reasmqueue);
1094 TAILQ_INIT(&asoc->resetHead);
1095 asoc->max_inbound_streams = m->sctp_ep.max_open_streams_intome;
1096 TAILQ_INIT(&asoc->asconf_queue);

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

3489 if (inp->sctp_flags & SCTP_PCB_FLAGS_SOCKET_GONE) {
3490 if (LIST_FIRST(&inp->sctp_asoc_list) == NULL) {
3491 sctp_inpcb_free(inp, 1, 0);
3492 }
3493 }
3494 }
3495}
3496
1088 TAILQ_INIT(&asoc->out_wheel);
1089 TAILQ_INIT(&asoc->control_send_queue);
1090 TAILQ_INIT(&asoc->send_queue);
1091 TAILQ_INIT(&asoc->sent_queue);
1092 TAILQ_INIT(&asoc->reasmqueue);
1093 TAILQ_INIT(&asoc->resetHead);
1094 asoc->max_inbound_streams = m->sctp_ep.max_open_streams_intome;
1095 TAILQ_INIT(&asoc->asconf_queue);

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

3488 if (inp->sctp_flags & SCTP_PCB_FLAGS_SOCKET_GONE) {
3489 if (LIST_FIRST(&inp->sctp_asoc_list) == NULL) {
3490 sctp_inpcb_free(inp, 1, 0);
3491 }
3492 }
3493 }
3494}
3495
3496#ifdef SCTP_ASOCLOG_OF_TSNS
3497void
3497void
3498sctp_print_out_track_log(struct sctp_tcb *stcb)
3499{
3500 int i;
3501
3502 printf("Last ep reason:%x\n", stcb->sctp_ep->last_abort_code);
3503 printf("IN bound TSN log-aaa\n");
3504 if ((stcb->asoc.tsn_in_at == 0) && (stcb->asoc.tsn_in_wrapped == 0)) {
3505 printf("None rcvd\n");
3506 goto none_in;
3507 }
3508 if (stcb->asoc.tsn_in_wrapped) {
3509 for (i = stcb->asoc.tsn_in_at; i < SCTP_TSN_LOG_SIZE; i++) {
3510 printf("TSN:%x strm:%d seq:%d flags:%x sz:%d\n",
3511 stcb->asoc.in_tsnlog[i].tsn,
3512 stcb->asoc.in_tsnlog[i].strm,
3513 stcb->asoc.in_tsnlog[i].seq,
3514 stcb->asoc.in_tsnlog[i].flgs,
3515 stcb->asoc.in_tsnlog[i].sz);
3516 }
3517 }
3518 if (stcb->asoc.tsn_in_at) {
3519 for (i = 0; i < stcb->asoc.tsn_in_at; i++) {
3520 printf("TSN:%x strm:%d seq:%d flags:%x sz:%d\n",
3521 stcb->asoc.in_tsnlog[i].tsn,
3522 stcb->asoc.in_tsnlog[i].strm,
3523 stcb->asoc.in_tsnlog[i].seq,
3524 stcb->asoc.in_tsnlog[i].flgs,
3525 stcb->asoc.in_tsnlog[i].sz);
3526 }
3527 }
3528none_in:
3529 printf("OUT bound TSN log-aaa\n");
3530 if ((stcb->asoc.tsn_out_at == 0) && (stcb->asoc.tsn_out_wrapped == 0)) {
3531 printf("None sent\n");
3532 }
3533 if (stcb->asoc.tsn_out_wrapped) {
3534 for (i = stcb->asoc.tsn_out_at; i < SCTP_TSN_LOG_SIZE; i++) {
3535 printf("TSN:%x strm:%d seq:%d flags:%x sz:%d\n",
3536 stcb->asoc.out_tsnlog[i].tsn,
3537 stcb->asoc.out_tsnlog[i].strm,
3538 stcb->asoc.out_tsnlog[i].seq,
3539 stcb->asoc.out_tsnlog[i].flgs,
3540 stcb->asoc.out_tsnlog[i].sz);
3541 }
3542 }
3543 if (stcb->asoc.tsn_out_at) {
3544 for (i = 0; i < stcb->asoc.tsn_out_at; i++) {
3545 printf("TSN:%x strm:%d seq:%d flags:%x sz:%d\n",
3546 stcb->asoc.out_tsnlog[i].tsn,
3547 stcb->asoc.out_tsnlog[i].strm,
3548 stcb->asoc.out_tsnlog[i].seq,
3549 stcb->asoc.out_tsnlog[i].flgs,
3550 stcb->asoc.out_tsnlog[i].sz);
3551 }
3552 }
3553}
3554
3555#endif
3556
3557void
3498sctp_abort_an_association(struct sctp_inpcb *inp, struct sctp_tcb *stcb,
3499 int error, struct mbuf *op_err)
3500{
3501 uint32_t vtag;
3502
3503 if (stcb == NULL) {
3504 /* Got to have a TCB */
3505 if (inp->sctp_flags & SCTP_PCB_FLAGS_SOCKET_GONE) {

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

3516 /* notify the peer */
3517 sctp_send_abort_tcb(stcb, op_err);
3518 SCTP_STAT_INCR_COUNTER32(sctps_aborted);
3519 if ((SCTP_GET_STATE(&stcb->asoc) == SCTP_STATE_OPEN) ||
3520 (SCTP_GET_STATE(&stcb->asoc) == SCTP_STATE_SHUTDOWN_RECEIVED)) {
3521 SCTP_STAT_DECR_GAUGE32(sctps_currestab);
3522 }
3523 /* now free the asoc */
3558sctp_abort_an_association(struct sctp_inpcb *inp, struct sctp_tcb *stcb,
3559 int error, struct mbuf *op_err)
3560{
3561 uint32_t vtag;
3562
3563 if (stcb == NULL) {
3564 /* Got to have a TCB */
3565 if (inp->sctp_flags & SCTP_PCB_FLAGS_SOCKET_GONE) {

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

3576 /* notify the peer */
3577 sctp_send_abort_tcb(stcb, op_err);
3578 SCTP_STAT_INCR_COUNTER32(sctps_aborted);
3579 if ((SCTP_GET_STATE(&stcb->asoc) == SCTP_STATE_OPEN) ||
3580 (SCTP_GET_STATE(&stcb->asoc) == SCTP_STATE_SHUTDOWN_RECEIVED)) {
3581 SCTP_STAT_DECR_GAUGE32(sctps_currestab);
3582 }
3583 /* now free the asoc */
3584#ifdef SCTP_ASOCLOG_OF_TSNS
3585 sctp_print_out_track_log(stcb);
3586#endif
3524 sctp_free_assoc(inp, stcb, SCTP_NORMAL_PROC, SCTP_FROM_SCTPUTIL + SCTP_LOC_5);
3525}
3526
3527void
3528sctp_handle_ootb(struct mbuf *m, int iphlen, int offset, struct sctphdr *sh,
3529 struct sctp_inpcb *inp, struct mbuf *op_err)
3530{
3531 struct sctp_chunkhdr *ch, chunk_buf;

--- 2110 unchanged lines hidden ---
3587 sctp_free_assoc(inp, stcb, SCTP_NORMAL_PROC, SCTP_FROM_SCTPUTIL + SCTP_LOC_5);
3588}
3589
3590void
3591sctp_handle_ootb(struct mbuf *m, int iphlen, int offset, struct sctphdr *sh,
3592 struct sctp_inpcb *inp, struct mbuf *op_err)
3593{
3594 struct sctp_chunkhdr *ch, chunk_buf;

--- 2110 unchanged lines hidden ---