| 3499 | } |
| 3500 | |
| 3501 | static void |
| 3502 | sctp_notify_send_failed2(struct sctp_tcb *stcb, uint32_t error, |
| 3503 | struct sctp_stream_queue_pending *sp, int so_locked) |
| 3504 | { |
| 3505 | struct mbuf *m_notify; |
| 3506 | struct sctp_send_failed *ssf; |
| 3507 | struct sctp_send_failed_event *ssfe; |
| 3508 | struct sctp_queued_to_read *control; |
| 3509 | int notifhdr_len; |
| 3510 | |
| 3511 | if ((stcb == NULL) || |
| 3512 | (sctp_stcb_is_feature_off(stcb->sctp_ep, stcb, SCTP_PCB_FLAGS_RECVSENDFAILEVNT) && |
| 3513 | sctp_stcb_is_feature_off(stcb->sctp_ep, stcb, SCTP_PCB_FLAGS_RECVNSENDFAILEVNT))) { |
| 3514 | /* event not enabled */ |
| 3515 | return; |
| 3516 | } |
| 3517 | if (sctp_stcb_is_feature_on(stcb->sctp_ep, stcb, SCTP_PCB_FLAGS_RECVNSENDFAILEVNT)) { |
| 3518 | notifhdr_len = sizeof(struct sctp_send_failed_event); |
| 3519 | } else { |
| 3520 | notifhdr_len = sizeof(struct sctp_send_failed); |
| 3521 | } |
| 3522 | m_notify = sctp_get_mbuf_for_msg(notifhdr_len, 0, M_NOWAIT, 1, MT_DATA); |
| 3523 | if (m_notify == NULL) { |
| 3524 | /* no space left */ |
| 3525 | return; |
| 3526 | } |
| 3527 | SCTP_BUF_LEN(m_notify) = notifhdr_len; |
| 3528 | if (sctp_stcb_is_feature_on(stcb->sctp_ep, stcb, SCTP_PCB_FLAGS_RECVNSENDFAILEVNT)) { |
| 3529 | ssfe = mtod(m_notify, struct sctp_send_failed_event *); |
| 3530 | memset(ssfe, 0, notifhdr_len); |
| 3531 | ssfe->ssfe_type = SCTP_SEND_FAILED_EVENT; |
| 3532 | ssfe->ssfe_flags = SCTP_DATA_UNSENT; |
| 3533 | ssfe->ssfe_length = (uint32_t)(notifhdr_len + sp->length); |
| 3534 | ssfe->ssfe_error = error; |
| 3535 | /* not exactly what the user sent in, but should be close :) */ |
| 3536 | ssfe->ssfe_info.snd_sid = sp->sid; |
| 3537 | if (sp->some_taken) { |
| 3538 | ssfe->ssfe_info.snd_flags = SCTP_DATA_LAST_FRAG; |
| 3539 | } else { |
| 3540 | ssfe->ssfe_info.snd_flags = SCTP_DATA_NOT_FRAG; |
| 3541 | } |
| 3542 | ssfe->ssfe_info.snd_ppid = sp->ppid; |
| 3543 | ssfe->ssfe_info.snd_context = sp->context; |
| 3544 | ssfe->ssfe_info.snd_assoc_id = sctp_get_associd(stcb); |
| 3545 | ssfe->ssfe_assoc_id = sctp_get_associd(stcb); |
| 3546 | } else { |
| 3547 | ssf = mtod(m_notify, struct sctp_send_failed *); |
| 3548 | memset(ssf, 0, notifhdr_len); |
| 3549 | ssf->ssf_type = SCTP_SEND_FAILED; |
| 3550 | ssf->ssf_flags = SCTP_DATA_UNSENT; |
| 3551 | ssf->ssf_length = (uint32_t)(notifhdr_len + sp->length); |
| 3552 | ssf->ssf_error = error; |
| 3553 | /* not exactly what the user sent in, but should be close :) */ |
| 3554 | ssf->ssf_info.sinfo_stream = sp->sid; |
| 3555 | ssf->ssf_info.sinfo_ssn = 0; |
| 3556 | if (sp->some_taken) { |
| 3557 | ssf->ssf_info.sinfo_flags = SCTP_DATA_LAST_FRAG; |
| 3558 | } else { |
no test coverage detected