| 3711 | } |
| 3712 | |
| 3713 | static void |
| 3714 | sctp_notify_shutdown_event(struct sctp_tcb *stcb) |
| 3715 | { |
| 3716 | struct mbuf *m_notify; |
| 3717 | struct sctp_shutdown_event *sse; |
| 3718 | struct sctp_queued_to_read *control; |
| 3719 | |
| 3720 | /* |
| 3721 | * For TCP model AND UDP connected sockets we will send an error up |
| 3722 | * when an SHUTDOWN completes |
| 3723 | */ |
| 3724 | if ((stcb->sctp_ep->sctp_flags & SCTP_PCB_FLAGS_TCPTYPE) || |
| 3725 | (stcb->sctp_ep->sctp_flags & SCTP_PCB_FLAGS_IN_TCPPOOL)) { |
| 3726 | /* mark socket closed for read/write and wakeup! */ |
| 3727 | socantsendmore(stcb->sctp_socket); |
| 3728 | } |
| 3729 | if (sctp_stcb_is_feature_off(stcb->sctp_ep, stcb, SCTP_PCB_FLAGS_RECVSHUTDOWNEVNT)) { |
| 3730 | /* event not enabled */ |
| 3731 | return; |
| 3732 | } |
| 3733 | |
| 3734 | m_notify = sctp_get_mbuf_for_msg(sizeof(struct sctp_shutdown_event), 0, M_NOWAIT, 1, MT_DATA); |
| 3735 | if (m_notify == NULL) |
| 3736 | /* no space left */ |
| 3737 | return; |
| 3738 | sse = mtod(m_notify, struct sctp_shutdown_event *); |
| 3739 | memset(sse, 0, sizeof(struct sctp_shutdown_event)); |
| 3740 | sse->sse_type = SCTP_SHUTDOWN_EVENT; |
| 3741 | sse->sse_flags = 0; |
| 3742 | sse->sse_length = sizeof(struct sctp_shutdown_event); |
| 3743 | sse->sse_assoc_id = sctp_get_associd(stcb); |
| 3744 | |
| 3745 | SCTP_BUF_LEN(m_notify) = sizeof(struct sctp_shutdown_event); |
| 3746 | SCTP_BUF_NEXT(m_notify) = NULL; |
| 3747 | |
| 3748 | /* append to socket */ |
| 3749 | control = sctp_build_readq_entry(stcb, stcb->asoc.primary_destination, |
| 3750 | 0, 0, stcb->asoc.context, 0, 0, 0, |
| 3751 | m_notify); |
| 3752 | if (control == NULL) { |
| 3753 | /* no memory */ |
| 3754 | sctp_m_freem(m_notify); |
| 3755 | return; |
| 3756 | } |
| 3757 | control->length = SCTP_BUF_LEN(m_notify); |
| 3758 | control->spec_flags = M_NOTIFICATION; |
| 3759 | /* not that we need this */ |
| 3760 | control->tail_mbuf = m_notify; |
| 3761 | sctp_add_to_readq(stcb->sctp_ep, stcb, |
| 3762 | control, |
| 3763 | &stcb->sctp_socket->so_rcv, 1, SCTP_READ_LOCK_NOT_HELD, SCTP_SO_NOT_LOCKED); |
| 3764 | } |
| 3765 | |
| 3766 | static void |
| 3767 | sctp_notify_sender_dry_event(struct sctp_tcb *stcb, |
no test coverage detected