sctputil.c (235412) | sctputil.c (235416) |
---|---|
1/*- 2 * Copyright (c) 2001-2008, by Cisco Systems, Inc. All rights reserved. 3 * Copyright (c) 2008-2011, by Randall Stewart. All rights reserved. 4 * Copyright (c) 2008-2011, 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 * --- 19 unchanged lines hidden (view full) --- 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/* $KAME: sctputil.c,v 1.37 2005/03/07 23:26:09 itojun Exp $ */ 34 35#include <sys/cdefs.h> | 1/*- 2 * Copyright (c) 2001-2008, by Cisco Systems, Inc. All rights reserved. 3 * Copyright (c) 2008-2011, by Randall Stewart. All rights reserved. 4 * Copyright (c) 2008-2011, 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 * --- 19 unchanged lines hidden (view full) --- 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/* $KAME: sctputil.c,v 1.37 2005/03/07 23:26:09 itojun Exp $ */ 34 35#include <sys/cdefs.h> |
36__FBSDID("$FreeBSD: head/sys/netinet/sctputil.c 235412 2012-05-13 17:17:13Z tuexen $"); | 36__FBSDID("$FreeBSD: head/sys/netinet/sctputil.c 235416 2012-05-13 19:32:49Z tuexen $"); |
37 38#include <netinet/sctp_os.h> 39#include <netinet/sctp_pcb.h> 40#include <netinet/sctputil.h> 41#include <netinet/sctp_var.h> 42#include <netinet/sctp_sysctl.h> 43#ifdef INET6 44#endif --- 2760 unchanged lines hidden (view full) --- 2805 control, 2806 &stcb->sctp_socket->so_rcv, 1, 2807 SCTP_READ_LOCK_NOT_HELD, 2808 SCTP_SO_NOT_LOCKED); 2809} 2810 2811 2812static void | 37 38#include <netinet/sctp_os.h> 39#include <netinet/sctp_pcb.h> 40#include <netinet/sctputil.h> 41#include <netinet/sctp_var.h> 42#include <netinet/sctp_sysctl.h> 43#ifdef INET6 44#endif --- 2760 unchanged lines hidden (view full) --- 2805 control, 2806 &stcb->sctp_socket->so_rcv, 1, 2807 SCTP_READ_LOCK_NOT_HELD, 2808 SCTP_SO_NOT_LOCKED); 2809} 2810 2811 2812static void |
2813sctp_notify_send_failed(struct sctp_tcb *stcb, uint32_t error, | 2813sctp_notify_send_failed(struct sctp_tcb *stcb, uint8_t sent, uint32_t error, |
2814 struct sctp_tmit_chunk *chk, int so_locked 2815#if !defined(__APPLE__) && !defined(SCTP_SO_LOCK_TESTING) 2816 SCTP_UNUSED 2817#endif 2818) 2819{ 2820 struct mbuf *m_notify; 2821 struct sctp_send_failed *ssf; --- 17 unchanged lines hidden (view full) --- 2839 /* no space left */ 2840 return; 2841 length += chk->send_size; 2842 length -= sizeof(struct sctp_data_chunk); 2843 SCTP_BUF_LEN(m_notify) = 0; 2844 if (sctp_stcb_is_feature_on(stcb->sctp_ep, stcb, SCTP_PCB_FLAGS_RECVNSENDFAILEVNT)) { 2845 ssfe = mtod(m_notify, struct sctp_send_failed_event *); 2846 ssfe->ssfe_type = SCTP_SEND_FAILED_EVENT; | 2814 struct sctp_tmit_chunk *chk, int so_locked 2815#if !defined(__APPLE__) && !defined(SCTP_SO_LOCK_TESTING) 2816 SCTP_UNUSED 2817#endif 2818) 2819{ 2820 struct mbuf *m_notify; 2821 struct sctp_send_failed *ssf; --- 17 unchanged lines hidden (view full) --- 2839 /* no space left */ 2840 return; 2841 length += chk->send_size; 2842 length -= sizeof(struct sctp_data_chunk); 2843 SCTP_BUF_LEN(m_notify) = 0; 2844 if (sctp_stcb_is_feature_on(stcb->sctp_ep, stcb, SCTP_PCB_FLAGS_RECVNSENDFAILEVNT)) { 2845 ssfe = mtod(m_notify, struct sctp_send_failed_event *); 2846 ssfe->ssfe_type = SCTP_SEND_FAILED_EVENT; |
2847 if (error == SCTP_NOTIFY_DATAGRAM_UNSENT) 2848 ssfe->ssfe_flags = SCTP_DATA_UNSENT; 2849 else | 2847 if (sent) { |
2850 ssfe->ssfe_flags = SCTP_DATA_SENT; | 2848 ssfe->ssfe_flags = SCTP_DATA_SENT; |
2849 } else { 2850 ssfe->ssfe_flags = SCTP_DATA_UNSENT; 2851 } |
|
2851 ssfe->ssfe_length = length; 2852 ssfe->ssfe_error = error; 2853 /* not exactly what the user sent in, but should be close :) */ 2854 bzero(&ssfe->ssfe_info, sizeof(ssfe->ssfe_info)); 2855 ssfe->ssfe_info.snd_sid = chk->rec.data.stream_number; 2856 ssfe->ssfe_info.snd_flags = chk->rec.data.rcv_flags; 2857 ssfe->ssfe_info.snd_ppid = chk->rec.data.payloadtype; 2858 ssfe->ssfe_info.snd_context = chk->rec.data.context; 2859 ssfe->ssfe_info.snd_assoc_id = sctp_get_associd(stcb); 2860 ssfe->ssfe_assoc_id = sctp_get_associd(stcb); 2861 SCTP_BUF_LEN(m_notify) = sizeof(struct sctp_send_failed_event); 2862 } else { 2863 ssf = mtod(m_notify, struct sctp_send_failed *); 2864 ssf->ssf_type = SCTP_SEND_FAILED; | 2852 ssfe->ssfe_length = length; 2853 ssfe->ssfe_error = error; 2854 /* not exactly what the user sent in, but should be close :) */ 2855 bzero(&ssfe->ssfe_info, sizeof(ssfe->ssfe_info)); 2856 ssfe->ssfe_info.snd_sid = chk->rec.data.stream_number; 2857 ssfe->ssfe_info.snd_flags = chk->rec.data.rcv_flags; 2858 ssfe->ssfe_info.snd_ppid = chk->rec.data.payloadtype; 2859 ssfe->ssfe_info.snd_context = chk->rec.data.context; 2860 ssfe->ssfe_info.snd_assoc_id = sctp_get_associd(stcb); 2861 ssfe->ssfe_assoc_id = sctp_get_associd(stcb); 2862 SCTP_BUF_LEN(m_notify) = sizeof(struct sctp_send_failed_event); 2863 } else { 2864 ssf = mtod(m_notify, struct sctp_send_failed *); 2865 ssf->ssf_type = SCTP_SEND_FAILED; |
2865 if (error == SCTP_NOTIFY_DATAGRAM_UNSENT) 2866 ssf->ssf_flags = SCTP_DATA_UNSENT; 2867 else | 2866 if (sent) { |
2868 ssf->ssf_flags = SCTP_DATA_SENT; | 2867 ssf->ssf_flags = SCTP_DATA_SENT; |
2868 } else { 2869 ssf->ssf_flags = SCTP_DATA_UNSENT; 2870 } |
|
2869 ssf->ssf_length = length; 2870 ssf->ssf_error = error; 2871 /* not exactly what the user sent in, but should be close :) */ 2872 bzero(&ssf->ssf_info, sizeof(ssf->ssf_info)); 2873 ssf->ssf_info.sinfo_stream = chk->rec.data.stream_number; 2874 ssf->ssf_info.sinfo_ssn = chk->rec.data.stream_seq; 2875 ssf->ssf_info.sinfo_flags = chk->rec.data.rcv_flags; 2876 ssf->ssf_info.sinfo_ppid = chk->rec.data.payloadtype; --- 72 unchanged lines hidden (view full) --- 2949 /* no space left */ 2950 return; 2951 } 2952 length += sp->length; 2953 SCTP_BUF_LEN(m_notify) = 0; 2954 if (sctp_stcb_is_feature_on(stcb->sctp_ep, stcb, SCTP_PCB_FLAGS_RECVNSENDFAILEVNT)) { 2955 ssfe = mtod(m_notify, struct sctp_send_failed_event *); 2956 ssfe->ssfe_type = SCTP_SEND_FAILED; | 2871 ssf->ssf_length = length; 2872 ssf->ssf_error = error; 2873 /* not exactly what the user sent in, but should be close :) */ 2874 bzero(&ssf->ssf_info, sizeof(ssf->ssf_info)); 2875 ssf->ssf_info.sinfo_stream = chk->rec.data.stream_number; 2876 ssf->ssf_info.sinfo_ssn = chk->rec.data.stream_seq; 2877 ssf->ssf_info.sinfo_flags = chk->rec.data.rcv_flags; 2878 ssf->ssf_info.sinfo_ppid = chk->rec.data.payloadtype; --- 72 unchanged lines hidden (view full) --- 2951 /* no space left */ 2952 return; 2953 } 2954 length += sp->length; 2955 SCTP_BUF_LEN(m_notify) = 0; 2956 if (sctp_stcb_is_feature_on(stcb->sctp_ep, stcb, SCTP_PCB_FLAGS_RECVNSENDFAILEVNT)) { 2957 ssfe = mtod(m_notify, struct sctp_send_failed_event *); 2958 ssfe->ssfe_type = SCTP_SEND_FAILED; |
2957 if (error == SCTP_NOTIFY_DATAGRAM_UNSENT) 2958 ssfe->ssfe_flags = SCTP_DATA_UNSENT; 2959 else 2960 ssfe->ssfe_flags = SCTP_DATA_SENT; | 2959 ssfe->ssfe_flags = SCTP_DATA_UNSENT; |
2961 ssfe->ssfe_length = length; 2962 ssfe->ssfe_error = error; 2963 /* not exactly what the user sent in, but should be close :) */ 2964 bzero(&ssfe->ssfe_info, sizeof(ssfe->ssfe_info)); 2965 ssfe->ssfe_info.snd_sid = sp->stream; 2966 if (sp->some_taken) { 2967 ssfe->ssfe_info.snd_flags = SCTP_DATA_LAST_FRAG; 2968 } else { 2969 ssfe->ssfe_info.snd_flags = SCTP_DATA_NOT_FRAG; 2970 } 2971 ssfe->ssfe_info.snd_ppid = sp->ppid; 2972 ssfe->ssfe_info.snd_context = sp->context; 2973 ssfe->ssfe_info.snd_assoc_id = sctp_get_associd(stcb); 2974 ssfe->ssfe_assoc_id = sctp_get_associd(stcb); 2975 SCTP_BUF_LEN(m_notify) = sizeof(struct sctp_send_failed_event); 2976 } else { 2977 ssf = mtod(m_notify, struct sctp_send_failed *); 2978 ssf->ssf_type = SCTP_SEND_FAILED; | 2960 ssfe->ssfe_length = length; 2961 ssfe->ssfe_error = error; 2962 /* not exactly what the user sent in, but should be close :) */ 2963 bzero(&ssfe->ssfe_info, sizeof(ssfe->ssfe_info)); 2964 ssfe->ssfe_info.snd_sid = sp->stream; 2965 if (sp->some_taken) { 2966 ssfe->ssfe_info.snd_flags = SCTP_DATA_LAST_FRAG; 2967 } else { 2968 ssfe->ssfe_info.snd_flags = SCTP_DATA_NOT_FRAG; 2969 } 2970 ssfe->ssfe_info.snd_ppid = sp->ppid; 2971 ssfe->ssfe_info.snd_context = sp->context; 2972 ssfe->ssfe_info.snd_assoc_id = sctp_get_associd(stcb); 2973 ssfe->ssfe_assoc_id = sctp_get_associd(stcb); 2974 SCTP_BUF_LEN(m_notify) = sizeof(struct sctp_send_failed_event); 2975 } else { 2976 ssf = mtod(m_notify, struct sctp_send_failed *); 2977 ssf->ssf_type = SCTP_SEND_FAILED; |
2979 if (error == SCTP_NOTIFY_DATAGRAM_UNSENT) 2980 ssf->ssf_flags = SCTP_DATA_UNSENT; 2981 else 2982 ssf->ssf_flags = SCTP_DATA_SENT; | 2978 ssf->ssf_flags = SCTP_DATA_UNSENT; |
2983 ssf->ssf_length = length; 2984 ssf->ssf_error = error; 2985 /* not exactly what the user sent in, but should be close :) */ 2986 bzero(&ssf->ssf_info, sizeof(ssf->ssf_info)); 2987 ssf->ssf_info.sinfo_stream = sp->stream; 2988 ssf->ssf_info.sinfo_ssn = sp->strseq; 2989 if (sp->some_taken) { 2990 ssf->ssf_info.sinfo_flags = SCTP_DATA_LAST_FRAG; --- 547 unchanged lines hidden (view full) --- 3538 sctp_notify_peer_addr_change(stcb, SCTP_ADDR_CONFIRMED, 3539 (struct sockaddr *)&net->ro._l_addr, error); 3540 break; 3541 } 3542 case SCTP_NOTIFY_SPECIAL_SP_FAIL: 3543 sctp_notify_send_failed2(stcb, error, 3544 (struct sctp_stream_queue_pending *)data, so_locked); 3545 break; | 2979 ssf->ssf_length = length; 2980 ssf->ssf_error = error; 2981 /* not exactly what the user sent in, but should be close :) */ 2982 bzero(&ssf->ssf_info, sizeof(ssf->ssf_info)); 2983 ssf->ssf_info.sinfo_stream = sp->stream; 2984 ssf->ssf_info.sinfo_ssn = sp->strseq; 2985 if (sp->some_taken) { 2986 ssf->ssf_info.sinfo_flags = SCTP_DATA_LAST_FRAG; --- 547 unchanged lines hidden (view full) --- 3534 sctp_notify_peer_addr_change(stcb, SCTP_ADDR_CONFIRMED, 3535 (struct sockaddr *)&net->ro._l_addr, error); 3536 break; 3537 } 3538 case SCTP_NOTIFY_SPECIAL_SP_FAIL: 3539 sctp_notify_send_failed2(stcb, error, 3540 (struct sctp_stream_queue_pending *)data, so_locked); 3541 break; |
3546 case SCTP_NOTIFY_DG_FAIL: 3547 sctp_notify_send_failed(stcb, error, | 3542 case SCTP_NOTIFY_SENT_DG_FAIL: 3543 sctp_notify_send_failed(stcb, 1, error, |
3548 (struct sctp_tmit_chunk *)data, so_locked); 3549 break; | 3544 (struct sctp_tmit_chunk *)data, so_locked); 3545 break; |
3546 case SCTP_NOTIFY_UNSENT_DG_FAIL: 3547 sctp_notify_send_failed(stcb, 0, error, 3548 (struct sctp_tmit_chunk *)data, so_locked); 3549 break; |
|
3550 case SCTP_NOTIFY_PARTIAL_DELVIERY_INDICATION: 3551 { 3552 uint32_t val; 3553 3554 val = *((uint32_t *) data); 3555 3556 sctp_notify_partial_delivery_indication(stcb, error, val, so_locked); 3557 break; --- 79 unchanged lines hidden (view full) --- 3637 default: 3638 SCTPDBG(SCTP_DEBUG_UTIL1, "%s: unknown notification %xh (%u)\n", 3639 __FUNCTION__, notification, notification); 3640 break; 3641 } /* end switch */ 3642} 3643 3644void | 3550 case SCTP_NOTIFY_PARTIAL_DELVIERY_INDICATION: 3551 { 3552 uint32_t val; 3553 3554 val = *((uint32_t *) data); 3555 3556 sctp_notify_partial_delivery_indication(stcb, error, val, so_locked); 3557 break; --- 79 unchanged lines hidden (view full) --- 3637 default: 3638 SCTPDBG(SCTP_DEBUG_UTIL1, "%s: unknown notification %xh (%u)\n", 3639 __FUNCTION__, notification, notification); 3640 break; 3641 } /* end switch */ 3642} 3643 3644void |
3645sctp_report_all_outbound(struct sctp_tcb *stcb, int holds_lock, int so_locked | 3645sctp_report_all_outbound(struct sctp_tcb *stcb, uint16_t error, int holds_lock, int so_locked |
3646#if !defined(__APPLE__) && !defined(SCTP_SO_LOCK_TESTING) 3647 SCTP_UNUSED 3648#endif 3649) 3650{ 3651 struct sctp_association *asoc; 3652 struct sctp_stream_out *outs; 3653 struct sctp_tmit_chunk *chk, *nchk; --- 18 unchanged lines hidden (view full) --- 3672 SCTP_TCB_SEND_LOCK(stcb); 3673 } 3674 /* sent queue SHOULD be empty */ 3675 TAILQ_FOREACH_SAFE(chk, &asoc->sent_queue, sctp_next, nchk) { 3676 TAILQ_REMOVE(&asoc->sent_queue, chk, sctp_next); 3677 asoc->sent_queue_cnt--; 3678 if (chk->data != NULL) { 3679 sctp_free_bufspace(stcb, asoc, chk, 1); | 3646#if !defined(__APPLE__) && !defined(SCTP_SO_LOCK_TESTING) 3647 SCTP_UNUSED 3648#endif 3649) 3650{ 3651 struct sctp_association *asoc; 3652 struct sctp_stream_out *outs; 3653 struct sctp_tmit_chunk *chk, *nchk; --- 18 unchanged lines hidden (view full) --- 3672 SCTP_TCB_SEND_LOCK(stcb); 3673 } 3674 /* sent queue SHOULD be empty */ 3675 TAILQ_FOREACH_SAFE(chk, &asoc->sent_queue, sctp_next, nchk) { 3676 TAILQ_REMOVE(&asoc->sent_queue, chk, sctp_next); 3677 asoc->sent_queue_cnt--; 3678 if (chk->data != NULL) { 3679 sctp_free_bufspace(stcb, asoc, chk, 1); |
3680 sctp_ulp_notify(SCTP_NOTIFY_DG_FAIL, stcb, 3681 SCTP_NOTIFY_DATAGRAM_SENT, chk, so_locked); | 3680 sctp_ulp_notify(SCTP_NOTIFY_SENT_DG_FAIL, stcb, 3681 error, chk, so_locked); |
3682 if (chk->data) { 3683 sctp_m_freem(chk->data); 3684 chk->data = NULL; 3685 } 3686 } 3687 sctp_free_a_chunk(stcb, chk, so_locked); 3688 /* sa_ignore FREED_MEMORY */ 3689 } 3690 /* pending send queue SHOULD be empty */ 3691 TAILQ_FOREACH_SAFE(chk, &asoc->send_queue, sctp_next, nchk) { 3692 TAILQ_REMOVE(&asoc->send_queue, chk, sctp_next); 3693 asoc->send_queue_cnt--; 3694 if (chk->data != NULL) { 3695 sctp_free_bufspace(stcb, asoc, chk, 1); | 3682 if (chk->data) { 3683 sctp_m_freem(chk->data); 3684 chk->data = NULL; 3685 } 3686 } 3687 sctp_free_a_chunk(stcb, chk, so_locked); 3688 /* sa_ignore FREED_MEMORY */ 3689 } 3690 /* pending send queue SHOULD be empty */ 3691 TAILQ_FOREACH_SAFE(chk, &asoc->send_queue, sctp_next, nchk) { 3692 TAILQ_REMOVE(&asoc->send_queue, chk, sctp_next); 3693 asoc->send_queue_cnt--; 3694 if (chk->data != NULL) { 3695 sctp_free_bufspace(stcb, asoc, chk, 1); |
3696 sctp_ulp_notify(SCTP_NOTIFY_DG_FAIL, stcb, 3697 SCTP_NOTIFY_DATAGRAM_UNSENT, chk, so_locked); | 3696 sctp_ulp_notify(SCTP_NOTIFY_UNSENT_DG_FAIL, stcb, 3697 error, chk, so_locked); |
3698 if (chk->data) { 3699 sctp_m_freem(chk->data); 3700 chk->data = NULL; 3701 } 3702 } 3703 sctp_free_a_chunk(stcb, chk, so_locked); 3704 /* sa_ignore FREED_MEMORY */ 3705 } 3706 for (i = 0; i < asoc->streamoutcnt; i++) { 3707 /* For each stream */ 3708 outs = &asoc->strmout[i]; 3709 /* clean up any sends there */ 3710 asoc->locked_on_sending = NULL; 3711 TAILQ_FOREACH_SAFE(sp, &outs->outqueue, next, nsp) { 3712 asoc->stream_queue_cnt--; 3713 TAILQ_REMOVE(&outs->outqueue, sp, next); 3714 sctp_free_spbufspace(stcb, asoc, sp); 3715 if (sp->data) { 3716 sctp_ulp_notify(SCTP_NOTIFY_SPECIAL_SP_FAIL, stcb, | 3698 if (chk->data) { 3699 sctp_m_freem(chk->data); 3700 chk->data = NULL; 3701 } 3702 } 3703 sctp_free_a_chunk(stcb, chk, so_locked); 3704 /* sa_ignore FREED_MEMORY */ 3705 } 3706 for (i = 0; i < asoc->streamoutcnt; i++) { 3707 /* For each stream */ 3708 outs = &asoc->strmout[i]; 3709 /* clean up any sends there */ 3710 asoc->locked_on_sending = NULL; 3711 TAILQ_FOREACH_SAFE(sp, &outs->outqueue, next, nsp) { 3712 asoc->stream_queue_cnt--; 3713 TAILQ_REMOVE(&outs->outqueue, sp, next); 3714 sctp_free_spbufspace(stcb, asoc, sp); 3715 if (sp->data) { 3716 sctp_ulp_notify(SCTP_NOTIFY_SPECIAL_SP_FAIL, stcb, |
3717 SCTP_NOTIFY_DATAGRAM_UNSENT, (void *)sp, so_locked); | 3717 error, (void *)sp, so_locked); |
3718 if (sp->data) { 3719 sctp_m_freem(sp->data); 3720 sp->data = NULL; 3721 } 3722 } 3723 if (sp->net) { 3724 sctp_free_remote_addr(sp->net); 3725 sp->net = NULL; --- 26 unchanged lines hidden (view full) --- 3752 stcb->sctp_ep->sctp_flags |= SCTP_PCB_FLAGS_WAS_ABORTED; 3753 } 3754 if ((stcb->sctp_ep->sctp_flags & SCTP_PCB_FLAGS_SOCKET_GONE) || 3755 (stcb->sctp_ep->sctp_flags & SCTP_PCB_FLAGS_SOCKET_ALLGONE) || 3756 (stcb->asoc.state & SCTP_STATE_CLOSED_SOCKET)) { 3757 return; 3758 } 3759 /* Tell them we lost the asoc */ | 3718 if (sp->data) { 3719 sctp_m_freem(sp->data); 3720 sp->data = NULL; 3721 } 3722 } 3723 if (sp->net) { 3724 sctp_free_remote_addr(sp->net); 3725 sp->net = NULL; --- 26 unchanged lines hidden (view full) --- 3752 stcb->sctp_ep->sctp_flags |= SCTP_PCB_FLAGS_WAS_ABORTED; 3753 } 3754 if ((stcb->sctp_ep->sctp_flags & SCTP_PCB_FLAGS_SOCKET_GONE) || 3755 (stcb->sctp_ep->sctp_flags & SCTP_PCB_FLAGS_SOCKET_ALLGONE) || 3756 (stcb->asoc.state & SCTP_STATE_CLOSED_SOCKET)) { 3757 return; 3758 } 3759 /* Tell them we lost the asoc */ |
3760 sctp_report_all_outbound(stcb, 1, so_locked); | 3760 sctp_report_all_outbound(stcb, error, 1, so_locked); |
3761 if (from_peer) { 3762 sctp_ulp_notify(SCTP_NOTIFY_ASSOC_REM_ABORTED, stcb, error, abort, so_locked); 3763 } else { 3764 sctp_ulp_notify(SCTP_NOTIFY_ASSOC_LOC_ABORTED, stcb, error, abort, so_locked); 3765 } 3766} 3767 3768void --- 881 unchanged lines hidden (view full) --- 4650 } 4651 } 4652} 4653 4654#endif 4655 4656int 4657sctp_release_pr_sctp_chunk(struct sctp_tcb *stcb, struct sctp_tmit_chunk *tp1, | 3761 if (from_peer) { 3762 sctp_ulp_notify(SCTP_NOTIFY_ASSOC_REM_ABORTED, stcb, error, abort, so_locked); 3763 } else { 3764 sctp_ulp_notify(SCTP_NOTIFY_ASSOC_LOC_ABORTED, stcb, error, abort, so_locked); 3765 } 3766} 3767 3768void --- 881 unchanged lines hidden (view full) --- 4650 } 4651 } 4652} 4653 4654#endif 4655 4656int 4657sctp_release_pr_sctp_chunk(struct sctp_tcb *stcb, struct sctp_tmit_chunk *tp1, |
4658 int reason, int so_locked | 4658 uint8_t sent, int so_locked |
4659#if !defined(__APPLE__) && !defined(SCTP_SO_LOCK_TESTING) 4660 SCTP_UNUSED 4661#endif 4662) 4663{ 4664 struct sctp_stream_out *strq; 4665 struct sctp_tmit_chunk *chk = NULL, *tp2; 4666 struct sctp_stream_queue_pending *sp; --- 10 unchanged lines hidden (view full) --- 4677 if (tp1->data != NULL) { 4678 if (tp1->sent < SCTP_DATAGRAM_RESEND) { 4679 sctp_flight_size_decrease(tp1); 4680 sctp_total_flight_decrease(stcb, tp1); 4681 } 4682 sctp_free_bufspace(stcb, &stcb->asoc, tp1, 1); 4683 stcb->asoc.peers_rwnd += tp1->send_size; 4684 stcb->asoc.peers_rwnd += SCTP_BASE_SYSCTL(sctp_peer_chunk_oh); | 4659#if !defined(__APPLE__) && !defined(SCTP_SO_LOCK_TESTING) 4660 SCTP_UNUSED 4661#endif 4662) 4663{ 4664 struct sctp_stream_out *strq; 4665 struct sctp_tmit_chunk *chk = NULL, *tp2; 4666 struct sctp_stream_queue_pending *sp; --- 10 unchanged lines hidden (view full) --- 4677 if (tp1->data != NULL) { 4678 if (tp1->sent < SCTP_DATAGRAM_RESEND) { 4679 sctp_flight_size_decrease(tp1); 4680 sctp_total_flight_decrease(stcb, tp1); 4681 } 4682 sctp_free_bufspace(stcb, &stcb->asoc, tp1, 1); 4683 stcb->asoc.peers_rwnd += tp1->send_size; 4684 stcb->asoc.peers_rwnd += SCTP_BASE_SYSCTL(sctp_peer_chunk_oh); |
4685 sctp_ulp_notify(SCTP_NOTIFY_DG_FAIL, stcb, reason, tp1, so_locked); | 4685 if (sent) { 4686 sctp_ulp_notify(SCTP_NOTIFY_SENT_DG_FAIL, stcb, 0, tp1, so_locked); 4687 } else { 4688 sctp_ulp_notify(SCTP_NOTIFY_UNSENT_DG_FAIL, stcb, 0, tp1, so_locked); 4689 } |
4686 if (tp1->data) { 4687 sctp_m_freem(tp1->data); 4688 tp1->data = NULL; 4689 } 4690 do_wakeup_routine = 1; 4691 if (PR_SCTP_BUF_ENABLED(tp1->flags)) { 4692 stcb->asoc.sent_queue_cnt_removeable--; 4693 } --- 30 unchanged lines hidden (view full) --- 4724 /* 4725 * save to chk in case we have some on stream out 4726 * queue. If so and we have an un-transmitted one we 4727 * don't have to fudge the TSN. 4728 */ 4729 chk = tp1; 4730 ret_sz += tp1->book_size; 4731 sctp_free_bufspace(stcb, &stcb->asoc, tp1, 1); | 4690 if (tp1->data) { 4691 sctp_m_freem(tp1->data); 4692 tp1->data = NULL; 4693 } 4694 do_wakeup_routine = 1; 4695 if (PR_SCTP_BUF_ENABLED(tp1->flags)) { 4696 stcb->asoc.sent_queue_cnt_removeable--; 4697 } --- 30 unchanged lines hidden (view full) --- 4728 /* 4729 * save to chk in case we have some on stream out 4730 * queue. If so and we have an un-transmitted one we 4731 * don't have to fudge the TSN. 4732 */ 4733 chk = tp1; 4734 ret_sz += tp1->book_size; 4735 sctp_free_bufspace(stcb, &stcb->asoc, tp1, 1); |
4732 sctp_ulp_notify(SCTP_NOTIFY_DG_FAIL, stcb, reason, tp1, so_locked); | 4736 if (sent) { 4737 sctp_ulp_notify(SCTP_NOTIFY_SENT_DG_FAIL, stcb, 0, tp1, so_locked); 4738 } else { 4739 sctp_ulp_notify(SCTP_NOTIFY_UNSENT_DG_FAIL, stcb, 0, tp1, so_locked); 4740 } |
4733 if (tp1->data) { 4734 sctp_m_freem(tp1->data); 4735 tp1->data = NULL; 4736 } 4737 /* No flight involved here book the size to 0 */ 4738 tp1->book_size = 0; 4739 if (tp1->rec.data.rcv_flags & SCTP_DATA_LAST_FRAG) { 4740 foundeom = 1; --- 2181 unchanged lines hidden --- | 4741 if (tp1->data) { 4742 sctp_m_freem(tp1->data); 4743 tp1->data = NULL; 4744 } 4745 /* No flight involved here book the size to 0 */ 4746 tp1->book_size = 0; 4747 if (tp1->rec.data.rcv_flags & SCTP_DATA_LAST_FRAG) { 4748 foundeom = 1; --- 2181 unchanged lines hidden --- |