| 3867 | } |
| 3868 | |
| 3869 | void |
| 3870 | sctp_notify_stream_reset_tsn(struct sctp_tcb *stcb, uint32_t sending_tsn, uint32_t recv_tsn, int flag) |
| 3871 | { |
| 3872 | struct mbuf *m_notify; |
| 3873 | struct sctp_queued_to_read *control; |
| 3874 | struct sctp_assoc_reset_event *strasoc; |
| 3875 | |
| 3876 | if ((stcb == NULL) || |
| 3877 | (sctp_stcb_is_feature_off(stcb->sctp_ep, stcb, SCTP_PCB_FLAGS_ASSOC_RESETEVNT))) { |
| 3878 | /* event not enabled */ |
| 3879 | return; |
| 3880 | } |
| 3881 | m_notify = sctp_get_mbuf_for_msg(sizeof(struct sctp_assoc_reset_event), 0, M_NOWAIT, 1, MT_DATA); |
| 3882 | if (m_notify == NULL) |
| 3883 | /* no space left */ |
| 3884 | return; |
| 3885 | SCTP_BUF_LEN(m_notify) = 0; |
| 3886 | strasoc = mtod(m_notify, struct sctp_assoc_reset_event *); |
| 3887 | memset(strasoc, 0, sizeof(struct sctp_assoc_reset_event)); |
| 3888 | strasoc->assocreset_type = SCTP_ASSOC_RESET_EVENT; |
| 3889 | strasoc->assocreset_flags = flag; |
| 3890 | strasoc->assocreset_length = sizeof(struct sctp_assoc_reset_event); |
| 3891 | strasoc->assocreset_assoc_id = sctp_get_associd(stcb); |
| 3892 | strasoc->assocreset_local_tsn = sending_tsn; |
| 3893 | strasoc->assocreset_remote_tsn = recv_tsn; |
| 3894 | SCTP_BUF_LEN(m_notify) = sizeof(struct sctp_assoc_reset_event); |
| 3895 | SCTP_BUF_NEXT(m_notify) = NULL; |
| 3896 | if (sctp_sbspace(&stcb->asoc, &stcb->sctp_socket->so_rcv) < SCTP_BUF_LEN(m_notify)) { |
| 3897 | /* no space */ |
| 3898 | sctp_m_freem(m_notify); |
| 3899 | return; |
| 3900 | } |
| 3901 | /* append to socket */ |
| 3902 | control = sctp_build_readq_entry(stcb, stcb->asoc.primary_destination, |
| 3903 | 0, 0, stcb->asoc.context, 0, 0, 0, |
| 3904 | m_notify); |
| 3905 | if (control == NULL) { |
| 3906 | /* no memory */ |
| 3907 | sctp_m_freem(m_notify); |
| 3908 | return; |
| 3909 | } |
| 3910 | control->length = SCTP_BUF_LEN(m_notify); |
| 3911 | control->spec_flags = M_NOTIFICATION; |
| 3912 | /* not that we need this */ |
| 3913 | control->tail_mbuf = m_notify; |
| 3914 | sctp_add_to_readq(stcb->sctp_ep, stcb, |
| 3915 | control, |
| 3916 | &stcb->sctp_socket->so_rcv, 1, SCTP_READ_LOCK_NOT_HELD, SCTP_SO_NOT_LOCKED); |
| 3917 | } |
| 3918 | |
| 3919 | static void |
| 3920 | sctp_notify_stream_reset(struct sctp_tcb *stcb, |
no test coverage detected