Deleted Added
full compact
sctputil.c (195918) sctputil.c (196260)
1/*-
2 * Copyright (c) 2001-2008, 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: sctputil.c,v 1.37 2005/03/07 23:26:09 itojun Exp $ */
32
33#include <sys/cdefs.h>
1/*-
2 * Copyright (c) 2001-2008, 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: 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 195918 2009-07-28 14:09:06Z rrs $");
34__FBSDID("$FreeBSD: head/sys/netinet/sctputil.c 196260 2009-08-15 21:10:52Z tuexen $");
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#endif

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

1479 it = (struct sctp_iterator *)inp;
1480 inp = NULL;
1481 }
1482 type = tmr->type;
1483 if (inp) {
1484 SCTP_INP_INCR_REF(inp);
1485 if ((inp->sctp_socket == 0) &&
1486 ((tmr->type != SCTP_TIMER_TYPE_INPKILL) &&
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#endif

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

1479 it = (struct sctp_iterator *)inp;
1480 inp = NULL;
1481 }
1482 type = tmr->type;
1483 if (inp) {
1484 SCTP_INP_INCR_REF(inp);
1485 if ((inp->sctp_socket == 0) &&
1486 ((tmr->type != SCTP_TIMER_TYPE_INPKILL) &&
1487 (tmr->type != SCTP_TIMER_TYPE_INIT) &&
1487 (tmr->type != SCTP_TIMER_TYPE_SEND) &&
1488 (tmr->type != SCTP_TIMER_TYPE_RECV) &&
1489 (tmr->type != SCTP_TIMER_TYPE_HEARTBEAT) &&
1490 (tmr->type != SCTP_TIMER_TYPE_SHUTDOWN) &&
1491 (tmr->type != SCTP_TIMER_TYPE_SHUTDOWNACK) &&
1492 (tmr->type != SCTP_TIMER_TYPE_SHUTDOWNGUARD) &&
1493 (tmr->type != SCTP_TIMER_TYPE_ASOCKILL))
1494 ) {

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

2979 ssf->ssf_info.sinfo_stream = chk->rec.data.stream_number;
2980 ssf->ssf_info.sinfo_ssn = chk->rec.data.stream_seq;
2981 ssf->ssf_info.sinfo_flags = chk->rec.data.rcv_flags;
2982 ssf->ssf_info.sinfo_ppid = chk->rec.data.payloadtype;
2983 ssf->ssf_info.sinfo_context = chk->rec.data.context;
2984 ssf->ssf_info.sinfo_assoc_id = sctp_get_associd(stcb);
2985 ssf->ssf_assoc_id = sctp_get_associd(stcb);
2986
1488 (tmr->type != SCTP_TIMER_TYPE_SEND) &&
1489 (tmr->type != SCTP_TIMER_TYPE_RECV) &&
1490 (tmr->type != SCTP_TIMER_TYPE_HEARTBEAT) &&
1491 (tmr->type != SCTP_TIMER_TYPE_SHUTDOWN) &&
1492 (tmr->type != SCTP_TIMER_TYPE_SHUTDOWNACK) &&
1493 (tmr->type != SCTP_TIMER_TYPE_SHUTDOWNGUARD) &&
1494 (tmr->type != SCTP_TIMER_TYPE_ASOCKILL))
1495 ) {

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

2980 ssf->ssf_info.sinfo_stream = chk->rec.data.stream_number;
2981 ssf->ssf_info.sinfo_ssn = chk->rec.data.stream_seq;
2982 ssf->ssf_info.sinfo_flags = chk->rec.data.rcv_flags;
2983 ssf->ssf_info.sinfo_ppid = chk->rec.data.payloadtype;
2984 ssf->ssf_info.sinfo_context = chk->rec.data.context;
2985 ssf->ssf_info.sinfo_assoc_id = sctp_get_associd(stcb);
2986 ssf->ssf_assoc_id = sctp_get_associd(stcb);
2987
2987 SCTP_BUF_NEXT(m_notify) = chk->data;
2988 SCTP_BUF_LEN(m_notify) = sizeof(struct sctp_send_failed);
2989 if (chk->data) {
2990 /*
2991 * trim off the sctp chunk header(it should be there)
2992 */
2993 if (chk->send_size >= sizeof(struct sctp_data_chunk)) {
2994 m_adj(chk->data, sizeof(struct sctp_data_chunk));
2995 sctp_mbuf_crush(chk->data);
2996 chk->send_size -= sizeof(struct sctp_data_chunk);
2997 }
2998 }
2988 if (chk->data) {
2989 /*
2990 * trim off the sctp chunk header(it should be there)
2991 */
2992 if (chk->send_size >= sizeof(struct sctp_data_chunk)) {
2993 m_adj(chk->data, sizeof(struct sctp_data_chunk));
2994 sctp_mbuf_crush(chk->data);
2995 chk->send_size -= sizeof(struct sctp_data_chunk);
2996 }
2997 }
2998 SCTP_BUF_NEXT(m_notify) = chk->data;
2999 SCTP_BUF_LEN(m_notify) = sizeof(struct sctp_send_failed);
2999 /* Steal off the mbuf */
3000 chk->data = NULL;
3001 /*
3002 * For this case, we check the actual socket buffer, since the assoc
3003 * is going away we don't want to overfill the socket buffer for a
3004 * non-reader
3005 */
3006 if (sctp_sbspace_failedmsgs(&stcb->sctp_socket->so_rcv) < SCTP_BUF_LEN(m_notify)) {

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

3141 /* not that we need this */
3142 control->tail_mbuf = m_notify;
3143 sctp_add_to_readq(stcb->sctp_ep, stcb,
3144 control,
3145 &stcb->sctp_socket->so_rcv, 1, SCTP_READ_LOCK_NOT_HELD, SCTP_SO_NOT_LOCKED);
3146}
3147
3148/* This always must be called with the read-queue LOCKED in the INP */
3000 /* Steal off the mbuf */
3001 chk->data = NULL;
3002 /*
3003 * For this case, we check the actual socket buffer, since the assoc
3004 * is going away we don't want to overfill the socket buffer for a
3005 * non-reader
3006 */
3007 if (sctp_sbspace_failedmsgs(&stcb->sctp_socket->so_rcv) < SCTP_BUF_LEN(m_notify)) {

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

3142 /* not that we need this */
3143 control->tail_mbuf = m_notify;
3144 sctp_add_to_readq(stcb->sctp_ep, stcb,
3145 control,
3146 &stcb->sctp_socket->so_rcv, 1, SCTP_READ_LOCK_NOT_HELD, SCTP_SO_NOT_LOCKED);
3147}
3148
3149/* This always must be called with the read-queue LOCKED in the INP */
3149void
3150static void
3150sctp_notify_partial_delivery_indication(struct sctp_tcb *stcb, uint32_t error,
3151sctp_notify_partial_delivery_indication(struct sctp_tcb *stcb, uint32_t error,
3151 int nolock, uint32_t val)
3152 uint32_t val, int so_locked
3153#if !defined(__APPLE__) && !defined(SCTP_SO_LOCK_TESTING)
3154 SCTP_UNUSED
3155#endif
3156)
3152{
3153 struct mbuf *m_notify;
3154 struct sctp_pdapi_event *pdapi;
3155 struct sctp_queued_to_read *control;
3156 struct sockbuf *sb;
3157
3158 if (sctp_is_feature_off(stcb->sctp_ep, SCTP_PCB_FLAGS_PDAPIEVNT)) {
3159 /* event not enabled */

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

3184 return;
3185 }
3186 control->spec_flags = M_NOTIFICATION;
3187 control->length = SCTP_BUF_LEN(m_notify);
3188 /* not that we need this */
3189 control->tail_mbuf = m_notify;
3190 control->held_length = 0;
3191 control->length = 0;
3157{
3158 struct mbuf *m_notify;
3159 struct sctp_pdapi_event *pdapi;
3160 struct sctp_queued_to_read *control;
3161 struct sockbuf *sb;
3162
3163 if (sctp_is_feature_off(stcb->sctp_ep, SCTP_PCB_FLAGS_PDAPIEVNT)) {
3164 /* event not enabled */

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

3189 return;
3190 }
3191 control->spec_flags = M_NOTIFICATION;
3192 control->length = SCTP_BUF_LEN(m_notify);
3193 /* not that we need this */
3194 control->tail_mbuf = m_notify;
3195 control->held_length = 0;
3196 control->length = 0;
3192 if (nolock == 0) {
3193 SCTP_INP_READ_LOCK(stcb->sctp_ep);
3194 }
3195 sb = &stcb->sctp_socket->so_rcv;
3196 if (SCTP_BASE_SYSCTL(sctp_logging_level) & SCTP_SB_LOGGING_ENABLE) {
3197 sctp_sblog(sb, control->do_not_ref_stcb ? NULL : stcb, SCTP_LOG_SBALLOC, SCTP_BUF_LEN(m_notify));
3198 }
3199 sctp_sballoc(stcb, sb, m_notify);
3200 if (SCTP_BASE_SYSCTL(sctp_logging_level) & SCTP_SB_LOGGING_ENABLE) {
3201 sctp_sblog(sb, control->do_not_ref_stcb ? NULL : stcb, SCTP_LOG_SBRESULT, 0);
3202 }
3203 atomic_add_int(&control->length, SCTP_BUF_LEN(m_notify));
3204 control->end_added = 1;
3205 if (stcb->asoc.control_pdapi)
3206 TAILQ_INSERT_AFTER(&stcb->sctp_ep->read_queue, stcb->asoc.control_pdapi, control, next);
3207 else {
3208 /* we really should not see this case */
3209 TAILQ_INSERT_TAIL(&stcb->sctp_ep->read_queue, control, next);
3210 }
3197 sb = &stcb->sctp_socket->so_rcv;
3198 if (SCTP_BASE_SYSCTL(sctp_logging_level) & SCTP_SB_LOGGING_ENABLE) {
3199 sctp_sblog(sb, control->do_not_ref_stcb ? NULL : stcb, SCTP_LOG_SBALLOC, SCTP_BUF_LEN(m_notify));
3200 }
3201 sctp_sballoc(stcb, sb, m_notify);
3202 if (SCTP_BASE_SYSCTL(sctp_logging_level) & SCTP_SB_LOGGING_ENABLE) {
3203 sctp_sblog(sb, control->do_not_ref_stcb ? NULL : stcb, SCTP_LOG_SBRESULT, 0);
3204 }
3205 atomic_add_int(&control->length, SCTP_BUF_LEN(m_notify));
3206 control->end_added = 1;
3207 if (stcb->asoc.control_pdapi)
3208 TAILQ_INSERT_AFTER(&stcb->sctp_ep->read_queue, stcb->asoc.control_pdapi, control, next);
3209 else {
3210 /* we really should not see this case */
3211 TAILQ_INSERT_TAIL(&stcb->sctp_ep->read_queue, control, next);
3212 }
3211 if (nolock == 0) {
3212 SCTP_INP_READ_UNLOCK(stcb->sctp_ep);
3213 }
3214 if (stcb->sctp_ep && stcb->sctp_socket) {
3215 /* This should always be the case */
3213 if (stcb->sctp_ep && stcb->sctp_socket) {
3214 /* This should always be the case */
3215#if defined (__APPLE__) || defined(SCTP_SO_LOCK_TESTING)
3216 struct socket *so;
3217
3218 so = SCTP_INP_SO(stcb->sctp_ep);
3219 if (!so_locked) {
3220 atomic_add_int(&stcb->asoc.refcnt, 1);
3221 SCTP_TCB_UNLOCK(stcb);
3222 SCTP_SOCKET_LOCK(so, 1);
3223 SCTP_TCB_LOCK(stcb);
3224 atomic_subtract_int(&stcb->asoc.refcnt, 1);
3225 if (stcb->sctp_ep->sctp_flags & SCTP_PCB_FLAGS_SOCKET_GONE) {
3226 SCTP_SOCKET_UNLOCK(so, 1);
3227 return;
3228 }
3229 }
3230#endif
3216 sctp_sorwakeup(stcb->sctp_ep, stcb->sctp_socket);
3231 sctp_sorwakeup(stcb->sctp_ep, stcb->sctp_socket);
3232#if defined (__APPLE__) || defined(SCTP_SO_LOCK_TESTING)
3233 if (!so_locked) {
3234 SCTP_SOCKET_UNLOCK(so, 1);
3235 }
3236#endif
3217 }
3218}
3219
3220static void
3221sctp_notify_shutdown_event(struct sctp_tcb *stcb)
3222{
3223 struct mbuf *m_notify;
3224 struct sctp_shutdown_event *sse;

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

3535 (struct sctp_tmit_chunk *)data, so_locked);
3536 break;
3537 case SCTP_NOTIFY_PARTIAL_DELVIERY_INDICATION:
3538 {
3539 uint32_t val;
3540
3541 val = *((uint32_t *) data);
3542
3237 }
3238}
3239
3240static void
3241sctp_notify_shutdown_event(struct sctp_tcb *stcb)
3242{
3243 struct mbuf *m_notify;
3244 struct sctp_shutdown_event *sse;

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

3555 (struct sctp_tmit_chunk *)data, so_locked);
3556 break;
3557 case SCTP_NOTIFY_PARTIAL_DELVIERY_INDICATION:
3558 {
3559 uint32_t val;
3560
3561 val = *((uint32_t *) data);
3562
3543 sctp_notify_partial_delivery_indication(stcb, error, 0, val);
3563 sctp_notify_partial_delivery_indication(stcb, error, val, so_locked);
3564 break;
3544 }
3565 }
3545 break;
3546 case SCTP_NOTIFY_STRDATA_ERR:
3547 break;
3548 case SCTP_NOTIFY_ASSOC_ABORTED:
3549 if ((stcb) && (((stcb->asoc.state & SCTP_STATE_MASK) == SCTP_STATE_COOKIE_WAIT) ||
3550 ((stcb->asoc.state & SCTP_STATE_MASK) == SCTP_STATE_COOKIE_ECHOED))) {
3551 sctp_notify_assoc_change(SCTP_CANT_STR_ASSOC, stcb, error, NULL, so_locked);
3552 } else {
3553 sctp_notify_assoc_change(SCTP_COMM_LOST, stcb, error, NULL, so_locked);

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

3580 sctp_notify_stream_reset(stcb, error, ((uint16_t *) data), SCTP_STRRESET_OUTBOUND_STR);
3581 break;
3582 case SCTP_NOTIFY_STR_RESET_RECV:
3583 sctp_notify_stream_reset(stcb, error, ((uint16_t *) data), SCTP_STRRESET_INBOUND_STR);
3584 break;
3585 case SCTP_NOTIFY_STR_RESET_FAILED_OUT:
3586 sctp_notify_stream_reset(stcb, error, ((uint16_t *) data), (SCTP_STRRESET_OUTBOUND_STR | SCTP_STRRESET_FAILED));
3587 break;
3566 case SCTP_NOTIFY_STRDATA_ERR:
3567 break;
3568 case SCTP_NOTIFY_ASSOC_ABORTED:
3569 if ((stcb) && (((stcb->asoc.state & SCTP_STATE_MASK) == SCTP_STATE_COOKIE_WAIT) ||
3570 ((stcb->asoc.state & SCTP_STATE_MASK) == SCTP_STATE_COOKIE_ECHOED))) {
3571 sctp_notify_assoc_change(SCTP_CANT_STR_ASSOC, stcb, error, NULL, so_locked);
3572 } else {
3573 sctp_notify_assoc_change(SCTP_COMM_LOST, stcb, error, NULL, so_locked);

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

3600 sctp_notify_stream_reset(stcb, error, ((uint16_t *) data), SCTP_STRRESET_OUTBOUND_STR);
3601 break;
3602 case SCTP_NOTIFY_STR_RESET_RECV:
3603 sctp_notify_stream_reset(stcb, error, ((uint16_t *) data), SCTP_STRRESET_INBOUND_STR);
3604 break;
3605 case SCTP_NOTIFY_STR_RESET_FAILED_OUT:
3606 sctp_notify_stream_reset(stcb, error, ((uint16_t *) data), (SCTP_STRRESET_OUTBOUND_STR | SCTP_STRRESET_FAILED));
3607 break;
3588
3589 case SCTP_NOTIFY_STR_RESET_FAILED_IN:
3590 sctp_notify_stream_reset(stcb, error, ((uint16_t *) data), (SCTP_STRRESET_INBOUND_STR | SCTP_STRRESET_FAILED));
3591 break;
3608 case SCTP_NOTIFY_STR_RESET_FAILED_IN:
3609 sctp_notify_stream_reset(stcb, error, ((uint16_t *) data), (SCTP_STRRESET_INBOUND_STR | SCTP_STRRESET_FAILED));
3610 break;
3592
3593 case SCTP_NOTIFY_ASCONF_ADD_IP:
3594 sctp_notify_peer_addr_change(stcb, SCTP_ADDR_ADDED, data,
3595 error);
3596 break;
3597 case SCTP_NOTIFY_ASCONF_DELETE_IP:
3598 sctp_notify_peer_addr_change(stcb, SCTP_ADDR_REMOVED, data,
3599 error);
3600 break;

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

3666 chk = TAILQ_FIRST(&asoc->sent_queue);
3667 while (chk) {
3668 TAILQ_REMOVE(&asoc->sent_queue, chk, sctp_next);
3669 asoc->sent_queue_cnt--;
3670 if (chk->data != NULL) {
3671 sctp_free_bufspace(stcb, asoc, chk, 1);
3672 sctp_ulp_notify(SCTP_NOTIFY_DG_FAIL, stcb,
3673 SCTP_NOTIFY_DATAGRAM_SENT, chk, so_locked);
3611 case SCTP_NOTIFY_ASCONF_ADD_IP:
3612 sctp_notify_peer_addr_change(stcb, SCTP_ADDR_ADDED, data,
3613 error);
3614 break;
3615 case SCTP_NOTIFY_ASCONF_DELETE_IP:
3616 sctp_notify_peer_addr_change(stcb, SCTP_ADDR_REMOVED, data,
3617 error);
3618 break;

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

3684 chk = TAILQ_FIRST(&asoc->sent_queue);
3685 while (chk) {
3686 TAILQ_REMOVE(&asoc->sent_queue, chk, sctp_next);
3687 asoc->sent_queue_cnt--;
3688 if (chk->data != NULL) {
3689 sctp_free_bufspace(stcb, asoc, chk, 1);
3690 sctp_ulp_notify(SCTP_NOTIFY_DG_FAIL, stcb,
3691 SCTP_NOTIFY_DATAGRAM_SENT, chk, so_locked);
3674 sctp_m_freem(chk->data);
3675 chk->data = NULL;
3692 if (chk->data) {
3693 sctp_m_freem(chk->data);
3694 chk->data = NULL;
3695 }
3676 }
3677 sctp_free_a_chunk(stcb, chk);
3678 /* sa_ignore FREED_MEMORY */
3679 chk = TAILQ_FIRST(&asoc->sent_queue);
3680 }
3681 }
3682 /* pending send queue SHOULD be empty */
3683 if (!TAILQ_EMPTY(&asoc->send_queue)) {
3684 chk = TAILQ_FIRST(&asoc->send_queue);
3685 while (chk) {
3686 TAILQ_REMOVE(&asoc->send_queue, chk, sctp_next);
3687 asoc->send_queue_cnt--;
3688 if (chk->data != NULL) {
3689 sctp_free_bufspace(stcb, asoc, chk, 1);
3690 sctp_ulp_notify(SCTP_NOTIFY_DG_FAIL, stcb,
3691 SCTP_NOTIFY_DATAGRAM_UNSENT, chk, so_locked);
3696 }
3697 sctp_free_a_chunk(stcb, chk);
3698 /* sa_ignore FREED_MEMORY */
3699 chk = TAILQ_FIRST(&asoc->sent_queue);
3700 }
3701 }
3702 /* pending send queue SHOULD be empty */
3703 if (!TAILQ_EMPTY(&asoc->send_queue)) {
3704 chk = TAILQ_FIRST(&asoc->send_queue);
3705 while (chk) {
3706 TAILQ_REMOVE(&asoc->send_queue, chk, sctp_next);
3707 asoc->send_queue_cnt--;
3708 if (chk->data != NULL) {
3709 sctp_free_bufspace(stcb, asoc, chk, 1);
3710 sctp_ulp_notify(SCTP_NOTIFY_DG_FAIL, stcb,
3711 SCTP_NOTIFY_DATAGRAM_UNSENT, chk, so_locked);
3692 sctp_m_freem(chk->data);
3693 chk->data = NULL;
3712 if (chk->data) {
3713 sctp_m_freem(chk->data);
3714 chk->data = NULL;
3715 }
3694 }
3695 sctp_free_a_chunk(stcb, chk);
3696 /* sa_ignore FREED_MEMORY */
3697 chk = TAILQ_FIRST(&asoc->send_queue);
3698 }
3699 }
3700 for (i = 0; i < stcb->asoc.streamoutcnt; i++) {
3701 /* For each stream */

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

5341 sctp_free_a_readq(stcb, control);
5342 }
5343 if (hold_rlock) {
5344 hold_rlock = 0;
5345 SCTP_INP_READ_UNLOCK(inp);
5346 }
5347 goto restart;
5348 }
3716 }
3717 sctp_free_a_chunk(stcb, chk);
3718 /* sa_ignore FREED_MEMORY */
3719 chk = TAILQ_FIRST(&asoc->send_queue);
3720 }
3721 }
3722 for (i = 0; i < stcb->asoc.streamoutcnt; i++) {
3723 /* For each stream */

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

5363 sctp_free_a_readq(stcb, control);
5364 }
5365 if (hold_rlock) {
5366 hold_rlock = 0;
5367 SCTP_INP_READ_UNLOCK(inp);
5368 }
5369 goto restart;
5370 }
5371 if ((control->length == 0) &&
5372 (control->end_added == 1)) {
5373 /*
5374 * Do we also need to check for (control->pdapi_aborted ==
5375 * 1)?
5376 */
5377 if (hold_rlock == 0) {
5378 hold_rlock = 1;
5379 SCTP_INP_READ_LOCK(inp);
5380 }
5381 TAILQ_REMOVE(&inp->read_queue, control, next);
5382 if (control->data) {
5383#ifdef INVARIANTS
5384 panic("control->data not null but control->length == 0");
5385#else
5386 SCTP_PRINTF("Strange, data left in the control buffer. Cleaning up.\n");
5387 sctp_m_freem(control->data);
5388 control->data = NULL;
5389#endif
5390 }
5391 if (control->aux_data) {
5392 sctp_m_free(control->aux_data);
5393 control->aux_data = NULL;
5394 }
5395 sctp_free_remote_addr(control->whoFrom);
5396 sctp_free_a_readq(stcb, control);
5397 if (hold_rlock) {
5398 hold_rlock = 0;
5399 SCTP_INP_READ_UNLOCK(inp);
5400 }
5401 goto restart;
5402 }
5349 if (control->length == 0) {
5350 if ((sctp_is_feature_on(inp, SCTP_PCB_FLAGS_FRAG_INTERLEAVE)) &&
5351 (filling_sinfo)) {
5352 /* find a more suitable one then this */
5353 ctl = TAILQ_NEXT(control, next);
5354 while (ctl) {
5355 if ((ctl->stcb != control->stcb) && (ctl->length) &&
5356 (ctl->some_taken ||

--- 1515 unchanged lines hidden ---
5403 if (control->length == 0) {
5404 if ((sctp_is_feature_on(inp, SCTP_PCB_FLAGS_FRAG_INTERLEAVE)) &&
5405 (filling_sinfo)) {
5406 /* find a more suitable one then this */
5407 ctl = TAILQ_NEXT(control, next);
5408 while (ctl) {
5409 if ((ctl->stcb != control->stcb) && (ctl->length) &&
5410 (ctl->some_taken ||

--- 1515 unchanged lines hidden ---