Lines Matching refs:chk

6213 	struct sctp_tmit_chunk *chk, *nchk;  in sctp_prune_prsctp()  local
6218 TAILQ_FOREACH(chk, &asoc->sent_queue, sctp_next) { in sctp_prune_prsctp()
6225 if (PR_SCTP_BUF_ENABLED(chk->flags)) { in sctp_prune_prsctp()
6230 if (chk->rec.data.timetodrop.tv_sec > (long)srcv->sinfo_timetolive) { in sctp_prune_prsctp()
6238 if (chk->data) { in sctp_prune_prsctp()
6246 if (chk->sent > SCTP_DATAGRAM_UNSENT) in sctp_prune_prsctp()
6250 ret_spc = sctp_release_pr_sctp_chunk(stcb, chk, in sctp_prune_prsctp()
6262 TAILQ_FOREACH_SAFE(chk, &asoc->send_queue, sctp_next, nchk) { in sctp_prune_prsctp()
6264 if (PR_SCTP_BUF_ENABLED(chk->flags)) { in sctp_prune_prsctp()
6265 if (chk->rec.data.timetodrop.tv_sec > (long)srcv->sinfo_timetolive) { in sctp_prune_prsctp()
6266 if (chk->data) { in sctp_prune_prsctp()
6273 ret_spc = sctp_release_pr_sctp_chunk(stcb, chk, in sctp_prune_prsctp()
6991 struct sctp_tmit_chunk *chk, *nchk; in sctp_toss_old_cookies() local
6993 TAILQ_FOREACH_SAFE(chk, &asoc->control_send_queue, sctp_next, nchk) { in sctp_toss_old_cookies()
6994 if (chk->rec.chunk_id.id == SCTP_COOKIE_ECHO) { in sctp_toss_old_cookies()
6995 TAILQ_REMOVE(&asoc->control_send_queue, chk, sctp_next); in sctp_toss_old_cookies()
6997 if (chk->data) { in sctp_toss_old_cookies()
6998 sctp_m_freem(chk->data); in sctp_toss_old_cookies()
6999 chk->data = NULL; in sctp_toss_old_cookies()
7001 sctp_free_a_chunk(stcb, chk, SCTP_SO_NOT_LOCKED); in sctp_toss_old_cookies()
7010 struct sctp_tmit_chunk *chk, *nchk; in sctp_toss_old_asconf() local
7014 TAILQ_FOREACH_SAFE(chk, &asoc->asconf_send_queue, sctp_next, nchk) { in sctp_toss_old_asconf()
7016 if (chk->rec.chunk_id.id == SCTP_ASCONF) { in sctp_toss_old_asconf()
7017 if (chk->data) { in sctp_toss_old_asconf()
7018 acp = mtod(chk->data, struct sctp_asconf_chunk *); in sctp_toss_old_asconf()
7024 TAILQ_REMOVE(&asoc->asconf_send_queue, chk, sctp_next); in sctp_toss_old_asconf()
7026 if (chk->data) { in sctp_toss_old_asconf()
7027 sctp_m_freem(chk->data); in sctp_toss_old_asconf()
7028 chk->data = NULL; in sctp_toss_old_asconf()
7030 sctp_free_a_chunk(stcb, chk, SCTP_SO_NOT_LOCKED); in sctp_toss_old_asconf()
7130 struct sctp_tmit_chunk *chk, *nchk; in sctp_clean_up_ctl() local
7132 TAILQ_FOREACH_SAFE(chk, &asoc->control_send_queue, sctp_next, nchk) { in sctp_clean_up_ctl()
7133 if ((chk->rec.chunk_id.id == SCTP_SELECTIVE_ACK) || in sctp_clean_up_ctl()
7134 (chk->rec.chunk_id.id == SCTP_NR_SELECTIVE_ACK) || /* EY */ in sctp_clean_up_ctl()
7135 (chk->rec.chunk_id.id == SCTP_HEARTBEAT_REQUEST) || in sctp_clean_up_ctl()
7136 (chk->rec.chunk_id.id == SCTP_HEARTBEAT_ACK) || in sctp_clean_up_ctl()
7137 (chk->rec.chunk_id.id == SCTP_FORWARD_CUM_TSN) || in sctp_clean_up_ctl()
7138 (chk->rec.chunk_id.id == SCTP_SHUTDOWN) || in sctp_clean_up_ctl()
7139 (chk->rec.chunk_id.id == SCTP_SHUTDOWN_ACK) || in sctp_clean_up_ctl()
7140 (chk->rec.chunk_id.id == SCTP_OPERATION_ERROR) || in sctp_clean_up_ctl()
7141 (chk->rec.chunk_id.id == SCTP_PACKET_DROPPED) || in sctp_clean_up_ctl()
7142 (chk->rec.chunk_id.id == SCTP_COOKIE_ACK) || in sctp_clean_up_ctl()
7143 (chk->rec.chunk_id.id == SCTP_ECN_CWR) || in sctp_clean_up_ctl()
7144 (chk->rec.chunk_id.id == SCTP_ASCONF_ACK)) { in sctp_clean_up_ctl()
7147 TAILQ_REMOVE(&asoc->control_send_queue, chk, sctp_next); in sctp_clean_up_ctl()
7149 if (chk->data) { in sctp_clean_up_ctl()
7150 sctp_m_freem(chk->data); in sctp_clean_up_ctl()
7151 chk->data = NULL; in sctp_clean_up_ctl()
7153 if (chk->rec.chunk_id.id == SCTP_FORWARD_CUM_TSN) { in sctp_clean_up_ctl()
7156 sctp_free_a_chunk(stcb, chk, so_locked); in sctp_clean_up_ctl()
7157 } else if (chk->rec.chunk_id.id == SCTP_STREAM_RESET) { in sctp_clean_up_ctl()
7159 if (chk != asoc->str_reset) { in sctp_clean_up_ctl()
7239 struct sctp_tmit_chunk *chk; in sctp_move_to_outqueue() local
7380 sctp_alloc_a_chunk(stcb, chk); in sctp_move_to_outqueue()
7381 if (chk == NULL) { in sctp_move_to_outqueue()
7399 memset(chk, 0, sizeof(*chk)); in sctp_move_to_outqueue()
7400 chk->rec.data.rcv_flags = rcv_flags; in sctp_move_to_outqueue()
7408 chk->data = sp->data; in sctp_move_to_outqueue()
7409 chk->last_mbuf = sp->tail_mbuf; in sctp_move_to_outqueue()
7416 chk->data = SCTP_M_COPYM(sp->data, 0, to_move, M_NOWAIT); in sctp_move_to_outqueue()
7417 chk->last_mbuf = NULL; in sctp_move_to_outqueue()
7418 if (chk->data == NULL) { in sctp_move_to_outqueue()
7420 sctp_free_a_chunk(stcb, chk, so_locked); in sctp_move_to_outqueue()
7427 sctp_log_mbc(chk->data, SCTP_MBUF_ICOPY); in sctp_move_to_outqueue()
7455 if (SCTP_BUF_IS_EXTENDED(chk->data)) { in sctp_move_to_outqueue()
7456 chk->copy_by_ref = 1; in sctp_move_to_outqueue()
7458 chk->copy_by_ref = 0; in sctp_move_to_outqueue()
7464 if (chk->last_mbuf == NULL) { in sctp_move_to_outqueue()
7465 chk->last_mbuf = chk->data; in sctp_move_to_outqueue()
7466 while (SCTP_BUF_NEXT(chk->last_mbuf) != NULL) { in sctp_move_to_outqueue()
7467 chk->last_mbuf = SCTP_BUF_NEXT(chk->last_mbuf); in sctp_move_to_outqueue()
7486 if (M_LEADINGSPACE(chk->data) < leading) { in sctp_move_to_outqueue()
7499 sp->data = chk->data; in sctp_move_to_outqueue()
7500 sp->tail_mbuf = chk->last_mbuf; in sctp_move_to_outqueue()
7506 sp->data = chk->data; in sctp_move_to_outqueue()
7507 SCTP_BUF_NEXT(chk->last_mbuf) = m_tmp; in sctp_move_to_outqueue()
7511 chk->data = NULL; in sctp_move_to_outqueue()
7513 sctp_free_a_chunk(stcb, chk, so_locked); in sctp_move_to_outqueue()
7518 SCTP_BUF_NEXT(m) = chk->data; in sctp_move_to_outqueue()
7519 chk->data = m; in sctp_move_to_outqueue()
7520 M_ALIGN(chk->data, 4); in sctp_move_to_outqueue()
7523 SCTP_BUF_PREPEND(chk->data, SCTP_DATA_CHUNK_OVERHEAD(stcb), M_NOWAIT); in sctp_move_to_outqueue()
7524 if (chk->data == NULL) { in sctp_move_to_outqueue()
7530 sctp_free_a_chunk(stcb, chk, so_locked); in sctp_move_to_outqueue()
7537 chk->book_size = chk->send_size = (uint16_t)(to_move + SCTP_DATA_CHUNK_OVERHEAD(stcb)); in sctp_move_to_outqueue()
7538 chk->book_size_scale = 0; in sctp_move_to_outqueue()
7539 chk->sent = SCTP_DATAGRAM_UNSENT; in sctp_move_to_outqueue()
7541 chk->flags = 0; in sctp_move_to_outqueue()
7542 chk->asoc = &stcb->asoc; in sctp_move_to_outqueue()
7543 chk->pad_inplace = 0; in sctp_move_to_outqueue()
7544 chk->no_fr_allowed = 0; in sctp_move_to_outqueue()
7548 chk->rec.data.mid = 0; in sctp_move_to_outqueue()
7550 chk->rec.data.mid = strq->next_mid_ordered; in sctp_move_to_outqueue()
7557 chk->rec.data.mid = strq->next_mid_unordered; in sctp_move_to_outqueue()
7562 chk->rec.data.mid = strq->next_mid_ordered; in sctp_move_to_outqueue()
7568 chk->rec.data.sid = sp->sid; in sctp_move_to_outqueue()
7569 chk->rec.data.ppid = sp->ppid; in sctp_move_to_outqueue()
7570 chk->rec.data.context = sp->context; in sctp_move_to_outqueue()
7571 chk->rec.data.doing_fast_retransmit = 0; in sctp_move_to_outqueue()
7573 chk->rec.data.timetodrop = sp->ts; in sctp_move_to_outqueue()
7574 chk->flags = sp->act_flags; in sctp_move_to_outqueue()
7577 chk->whoTo = sp->net; in sctp_move_to_outqueue()
7578 atomic_add_int(&chk->whoTo->ref_count, 1); in sctp_move_to_outqueue()
7580 chk->whoTo = NULL; in sctp_move_to_outqueue()
7583 chk->auth_keyid = sp->auth_keyid; in sctp_move_to_outqueue()
7584 sctp_auth_key_acquire(stcb, chk->auth_keyid); in sctp_move_to_outqueue()
7585 chk->holds_key_ref = 1; in sctp_move_to_outqueue()
7588 chk->rec.data.tsn = atomic_fetchadd_int(&asoc->sending_seq, 1); in sctp_move_to_outqueue()
7592 (uint32_t)((chk->rec.data.sid << 16) | (0x0000ffff & chk->rec.data.mid)), in sctp_move_to_outqueue()
7593 chk->rec.data.tsn); in sctp_move_to_outqueue()
7596 dchkh = mtod(chk->data, struct sctp_data_chunk *); in sctp_move_to_outqueue()
7598 ndchkh = mtod(chk->data, struct sctp_idata_chunk *); in sctp_move_to_outqueue()
7611 asoc->out_tsnlog[asoc->tsn_out_at].tsn = chk->rec.data.tsn; in sctp_move_to_outqueue()
7612 asoc->out_tsnlog[asoc->tsn_out_at].strm = chk->rec.data.sid; in sctp_move_to_outqueue()
7613 asoc->out_tsnlog[asoc->tsn_out_at].seq = chk->rec.data.mid; in sctp_move_to_outqueue()
7614 asoc->out_tsnlog[asoc->tsn_out_at].sz = chk->send_size; in sctp_move_to_outqueue()
7615 asoc->out_tsnlog[asoc->tsn_out_at].flgs = chk->rec.data.rcv_flags; in sctp_move_to_outqueue()
7623 dchkh->ch.chunk_flags = chk->rec.data.rcv_flags; in sctp_move_to_outqueue()
7624 dchkh->dp.tsn = htonl(chk->rec.data.tsn); in sctp_move_to_outqueue()
7626 dchkh->dp.ssn = htons((uint16_t)chk->rec.data.mid); in sctp_move_to_outqueue()
7627 dchkh->dp.ppid = chk->rec.data.ppid; in sctp_move_to_outqueue()
7628 dchkh->ch.chunk_length = htons(chk->send_size); in sctp_move_to_outqueue()
7631 ndchkh->ch.chunk_flags = chk->rec.data.rcv_flags; in sctp_move_to_outqueue()
7632 ndchkh->dp.tsn = htonl(chk->rec.data.tsn); in sctp_move_to_outqueue()
7635 ndchkh->dp.mid = htonl(chk->rec.data.mid); in sctp_move_to_outqueue()
7637 ndchkh->dp.ppid_fsn.ppid = chk->rec.data.ppid; in sctp_move_to_outqueue()
7641 ndchkh->ch.chunk_length = htons(chk->send_size); in sctp_move_to_outqueue()
7644 if (chk->send_size < SCTP_SIZE32(chk->book_size)) { in sctp_move_to_outqueue()
7649 pads = SCTP_SIZE32(chk->book_size) - chk->send_size; in sctp_move_to_outqueue()
7650 lm = sctp_pad_lastmbuf(chk->data, pads, chk->last_mbuf); in sctp_move_to_outqueue()
7652 chk->last_mbuf = lm; in sctp_move_to_outqueue()
7653 chk->pad_inplace = 1; in sctp_move_to_outqueue()
7655 chk->send_size += pads; in sctp_move_to_outqueue()
7657 if (PR_SCTP_ENABLED(chk->flags)) { in sctp_move_to_outqueue()
7690 TAILQ_INSERT_TAIL(&asoc->send_queue, chk, sctp_next); in sctp_move_to_outqueue()
7774 struct sctp_tmit_chunk *chk; in sctp_fix_ecn_echo() local
7776 TAILQ_FOREACH(chk, &asoc->control_send_queue, sctp_next) { in sctp_fix_ecn_echo()
7777 if (chk->rec.chunk_id.id == SCTP_ECN_ECHO) { in sctp_fix_ecn_echo()
7778 chk->sent = SCTP_DATAGRAM_UNSENT; in sctp_fix_ecn_echo()
7787 struct sctp_tmit_chunk *chk; in sctp_move_chunks_from_net() local
7803 TAILQ_FOREACH(chk, &asoc->send_queue, sctp_next) { in sctp_move_chunks_from_net()
7804 if (chk->whoTo == net) { in sctp_move_chunks_from_net()
7805 sctp_free_remote_addr(chk->whoTo); in sctp_move_chunks_from_net()
7806 chk->whoTo = NULL; in sctp_move_chunks_from_net()
7835 struct sctp_tmit_chunk *chk, *nchk; in sctp_med_chunk_output() local
7911 TAILQ_FOREACH(chk, &asoc->control_send_queue, sctp_next) { in sctp_med_chunk_output()
7912 if ((chk->rec.chunk_id.id == SCTP_SELECTIVE_ACK) || in sctp_med_chunk_output()
7913 (chk->rec.chunk_id.id == SCTP_NR_SELECTIVE_ACK)) { in sctp_med_chunk_output()
7914 sack_goes_to = chk->whoTo; in sctp_med_chunk_output()
7926 TAILQ_FOREACH(chk, &asoc->send_queue, sctp_next) { in sctp_med_chunk_output()
7927 if (chk->whoTo == NULL) { in sctp_med_chunk_output()
8011 TAILQ_FOREACH(chk, &asoc->control_send_queue, sctp_next) { in sctp_med_chunk_output()
8012 if (chk->whoTo == NULL) { in sctp_med_chunk_output()
8014 chk->whoTo = asoc->alternate; in sctp_med_chunk_output()
8016 chk->whoTo = asoc->primary_destination; in sctp_med_chunk_output()
8018 atomic_add_int(&chk->whoTo->ref_count, 1); in sctp_med_chunk_output()
8086 TAILQ_FOREACH_SAFE(chk, &asoc->asconf_send_queue, sctp_next, nchk) { in sctp_med_chunk_output()
8087 if (chk->rec.chunk_id.id != SCTP_ASCONF) { in sctp_med_chunk_output()
8090 if (chk->whoTo == NULL) { in sctp_med_chunk_output()
8101 if (chk->whoTo != net) { in sctp_med_chunk_output()
8105 if (chk->data == NULL) { in sctp_med_chunk_output()
8108 if (chk->sent != SCTP_DATAGRAM_UNSENT && in sctp_med_chunk_output()
8109 chk->sent != SCTP_DATAGRAM_RESEND) { in sctp_med_chunk_output()
8121 sctp_auth_is_required_chunk(chk->rec.chunk_id.id, in sctp_med_chunk_output()
8127 if ((chk->send_size < (int)(mtu - omtu)) || in sctp_med_chunk_output()
8128 (chk->flags & CHUNK_FLAGS_FRAGMENT_OK)) { in sctp_med_chunk_output()
8144 (sctp_auth_is_required_chunk(chk->rec.chunk_id.id, in sctp_med_chunk_output()
8151 chk->rec.chunk_id.id); in sctp_med_chunk_output()
8154 outchain = sctp_copy_mbufchain(chk->data, outchain, &endoutchain, in sctp_med_chunk_output()
8155 (int)chk->rec.chunk_id.can_take_data, in sctp_med_chunk_output()
8156 chk->send_size, chk->copy_by_ref); in sctp_med_chunk_output()
8164 if (mtu > (chk->send_size + omtu)) in sctp_med_chunk_output()
8165 mtu -= (chk->send_size + omtu); in sctp_med_chunk_output()
8168 to_out += (chk->send_size + omtu); in sctp_med_chunk_output()
8170 if (chk->flags & CHUNK_FLAGS_FRAGMENT_OK) { in sctp_med_chunk_output()
8173 if (chk->rec.chunk_id.can_take_data) in sctp_med_chunk_output()
8174 chk->data = NULL; in sctp_med_chunk_output()
8186 chk->sent = SCTP_DATAGRAM_SENT; in sctp_med_chunk_output()
8187 if (chk->whoTo == NULL) { in sctp_med_chunk_output()
8188 chk->whoTo = net; in sctp_med_chunk_output()
8191 chk->snd_count++; in sctp_med_chunk_output()
8289 TAILQ_FOREACH_SAFE(chk, &asoc->control_send_queue, sctp_next, nchk) { in sctp_med_chunk_output()
8291 (chk->rec.chunk_id.id == SCTP_ECN_ECHO) && in sctp_med_chunk_output()
8292 (chk->whoTo != sack_goes_to)) { in sctp_med_chunk_output()
8298 if (chk->whoTo == net) { in sctp_med_chunk_output()
8312 if (chk->whoTo == NULL) { in sctp_med_chunk_output()
8323 if (chk->whoTo != net) { in sctp_med_chunk_output()
8328 if (chk->data == NULL) { in sctp_med_chunk_output()
8331 if (chk->sent != SCTP_DATAGRAM_UNSENT) { in sctp_med_chunk_output()
8348 sctp_auth_is_required_chunk(chk->rec.chunk_id.id, in sctp_med_chunk_output()
8354 if ((chk->send_size <= (int)(mtu - omtu)) || in sctp_med_chunk_output()
8355 (chk->flags & CHUNK_FLAGS_FRAGMENT_OK)) { in sctp_med_chunk_output()
8371 (sctp_auth_is_required_chunk(chk->rec.chunk_id.id, in sctp_med_chunk_output()
8378 chk->rec.chunk_id.id); in sctp_med_chunk_output()
8381 outchain = sctp_copy_mbufchain(chk->data, outchain, &endoutchain, in sctp_med_chunk_output()
8382 (int)chk->rec.chunk_id.can_take_data, in sctp_med_chunk_output()
8383 chk->send_size, chk->copy_by_ref); in sctp_med_chunk_output()
8391 if (mtu > (chk->send_size + omtu)) in sctp_med_chunk_output()
8392 mtu -= (chk->send_size + omtu); in sctp_med_chunk_output()
8395 to_out += (chk->send_size + omtu); in sctp_med_chunk_output()
8397 if (chk->flags & CHUNK_FLAGS_FRAGMENT_OK) { in sctp_med_chunk_output()
8400 if (chk->rec.chunk_id.can_take_data) in sctp_med_chunk_output()
8401 chk->data = NULL; in sctp_med_chunk_output()
8403 if ((chk->rec.chunk_id.id == SCTP_SELECTIVE_ACK) || in sctp_med_chunk_output()
8404 (chk->rec.chunk_id.id == SCTP_NR_SELECTIVE_ACK) || /* EY */ in sctp_med_chunk_output()
8405 (chk->rec.chunk_id.id == SCTP_HEARTBEAT_REQUEST) || in sctp_med_chunk_output()
8406 (chk->rec.chunk_id.id == SCTP_HEARTBEAT_ACK) || in sctp_med_chunk_output()
8407 (chk->rec.chunk_id.id == SCTP_SHUTDOWN) || in sctp_med_chunk_output()
8408 (chk->rec.chunk_id.id == SCTP_SHUTDOWN_ACK) || in sctp_med_chunk_output()
8409 (chk->rec.chunk_id.id == SCTP_OPERATION_ERROR) || in sctp_med_chunk_output()
8410 (chk->rec.chunk_id.id == SCTP_COOKIE_ACK) || in sctp_med_chunk_output()
8411 (chk->rec.chunk_id.id == SCTP_ECN_CWR) || in sctp_med_chunk_output()
8412 (chk->rec.chunk_id.id == SCTP_PACKET_DROPPED) || in sctp_med_chunk_output()
8413 (chk->rec.chunk_id.id == SCTP_ASCONF_ACK)) { in sctp_med_chunk_output()
8414 if (chk->rec.chunk_id.id == SCTP_HEARTBEAT_REQUEST) { in sctp_med_chunk_output()
8418 if ((chk->rec.chunk_id.id == SCTP_SELECTIVE_ACK) || in sctp_med_chunk_output()
8419 (chk->rec.chunk_id.id == SCTP_NR_SELECTIVE_ACK)) { in sctp_med_chunk_output()
8436 if (chk->rec.chunk_id.id == SCTP_COOKIE_ECHO) { in sctp_med_chunk_output()
8439 } else if (chk->rec.chunk_id.id == SCTP_ECN_ECHO) { in sctp_med_chunk_output()
8454 chk->sent = SCTP_DATAGRAM_SENT; in sctp_med_chunk_output()
8455 if (chk->whoTo == NULL) { in sctp_med_chunk_output()
8456 chk->whoTo = net; in sctp_med_chunk_output()
8459 chk->snd_count++; in sctp_med_chunk_output()
8641 TAILQ_FOREACH_SAFE(chk, &asoc->send_queue, sctp_next, nchk) { in sctp_med_chunk_output()
8652 if ((chk->whoTo != NULL) && in sctp_med_chunk_output()
8653 (chk->whoTo != net)) { in sctp_med_chunk_output()
8661 (chk->whoTo == NULL)) { in sctp_med_chunk_output()
8665 (chk->whoTo == NULL)) { in sctp_med_chunk_output()
8669 if ((chk->send_size > omtu) && ((chk->flags & CHUNK_FLAGS_FRAGMENT_OK) == 0)) { in sctp_med_chunk_output()
8683 chk->send_size, mtu); in sctp_med_chunk_output()
8684 chk->flags |= CHUNK_FLAGS_FRAGMENT_OK; in sctp_med_chunk_output()
8690 dchkh = mtod(chk->data, struct sctp_data_chunk *); in sctp_med_chunk_output()
8693 if (((chk->send_size <= mtu) && (chk->send_size <= r_mtu)) || in sctp_med_chunk_output()
8694 ((chk->flags & CHUNK_FLAGS_FRAGMENT_OK) && (chk->send_size <= asoc->peers_rwnd))) { in sctp_med_chunk_output()
8710 auth_keyid = chk->auth_keyid; in sctp_med_chunk_output()
8718 auth_keyid = chk->auth_keyid; in sctp_med_chunk_output()
8720 } else if (auth_keyid != chk->auth_keyid) { in sctp_med_chunk_output()
8728 outchain = sctp_copy_mbufchain(chk->data, outchain, &endoutchain, 0, in sctp_med_chunk_output()
8729 chk->send_size, chk->copy_by_ref); in sctp_med_chunk_output()
8741 if (chk->flags & CHUNK_FLAGS_FRAGMENT_OK) { in sctp_med_chunk_output()
8745 if (mtu > chk->send_size) in sctp_med_chunk_output()
8746 mtu -= chk->send_size; in sctp_med_chunk_output()
8750 if (r_mtu > chk->send_size) in sctp_med_chunk_output()
8751 r_mtu -= chk->send_size; in sctp_med_chunk_output()
8755 to_out += chk->send_size; in sctp_med_chunk_output()
8764 chk->window_probe = 0; in sctp_med_chunk_output()
8765 data_list[bundle_at++] = chk; in sctp_med_chunk_output()
8769 if (chk->sent == SCTP_DATAGRAM_UNSENT) { in sctp_med_chunk_output()
8770 if ((chk->rec.data.rcv_flags & SCTP_DATA_UNORDERED) == 0) { in sctp_med_chunk_output()
8775 if (((chk->rec.data.rcv_flags & SCTP_DATA_LAST_FRAG) == SCTP_DATA_LAST_FRAG) && in sctp_med_chunk_output()
8776 ((chk->rec.data.rcv_flags & SCTP_DATA_FIRST_FRAG) == 0)) in sctp_med_chunk_output()
8959 struct sctp_tmit_chunk *chk; in sctp_queue_op_err() local
8991 sctp_alloc_a_chunk(stcb, chk); in sctp_queue_op_err()
8992 if (chk == NULL) { in sctp_queue_op_err()
8997 chk->copy_by_ref = 0; in sctp_queue_op_err()
8998 chk->rec.chunk_id.id = SCTP_OPERATION_ERROR; in sctp_queue_op_err()
8999 chk->rec.chunk_id.can_take_data = 0; in sctp_queue_op_err()
9000 chk->flags = 0; in sctp_queue_op_err()
9001 chk->send_size = (uint16_t)chunk_length; in sctp_queue_op_err()
9002 chk->sent = SCTP_DATAGRAM_UNSENT; in sctp_queue_op_err()
9003 chk->snd_count = 0; in sctp_queue_op_err()
9004 chk->asoc = &stcb->asoc; in sctp_queue_op_err()
9005 chk->data = op_err; in sctp_queue_op_err()
9006 chk->whoTo = NULL; in sctp_queue_op_err()
9010 hdr->chunk_length = htons(chk->send_size); in sctp_queue_op_err()
9011 TAILQ_INSERT_TAIL(&chk->asoc->control_send_queue, chk, sctp_next); in sctp_queue_op_err()
9012 chk->asoc->ctrl_queue_cnt++; in sctp_queue_op_err()
9029 struct sctp_tmit_chunk *chk; in sctp_send_cookie_echo() local
9081 sctp_alloc_a_chunk(stcb, chk); in sctp_send_cookie_echo()
9082 if (chk == NULL) { in sctp_send_cookie_echo()
9087 chk->copy_by_ref = 0; in sctp_send_cookie_echo()
9088 chk->rec.chunk_id.id = SCTP_COOKIE_ECHO; in sctp_send_cookie_echo()
9089 chk->rec.chunk_id.can_take_data = 0; in sctp_send_cookie_echo()
9090 chk->flags = CHUNK_FLAGS_FRAGMENT_OK; in sctp_send_cookie_echo()
9091 chk->send_size = SCTP_SIZE32(plen); in sctp_send_cookie_echo()
9092 chk->sent = SCTP_DATAGRAM_UNSENT; in sctp_send_cookie_echo()
9093 chk->snd_count = 0; in sctp_send_cookie_echo()
9094 chk->asoc = &stcb->asoc; in sctp_send_cookie_echo()
9095 chk->data = cookie; in sctp_send_cookie_echo()
9096 chk->whoTo = net; in sctp_send_cookie_echo()
9097 atomic_add_int(&chk->whoTo->ref_count, 1); in sctp_send_cookie_echo()
9098 TAILQ_INSERT_HEAD(&chk->asoc->control_send_queue, chk, sctp_next); in sctp_send_cookie_echo()
9099 chk->asoc->ctrl_queue_cnt++; in sctp_send_cookie_echo()
9115 struct sctp_tmit_chunk *chk; in sctp_send_heartbeat_ack() local
9137 sctp_alloc_a_chunk(stcb, chk); in sctp_send_heartbeat_ack()
9138 if (chk == NULL) { in sctp_send_heartbeat_ack()
9143 chk->copy_by_ref = 0; in sctp_send_heartbeat_ack()
9144 chk->rec.chunk_id.id = SCTP_HEARTBEAT_ACK; in sctp_send_heartbeat_ack()
9145 chk->rec.chunk_id.can_take_data = 1; in sctp_send_heartbeat_ack()
9146 chk->flags = 0; in sctp_send_heartbeat_ack()
9147 chk->send_size = chk_length; in sctp_send_heartbeat_ack()
9148 chk->sent = SCTP_DATAGRAM_UNSENT; in sctp_send_heartbeat_ack()
9149 chk->snd_count = 0; in sctp_send_heartbeat_ack()
9150 chk->asoc = &stcb->asoc; in sctp_send_heartbeat_ack()
9151 chk->data = outchain; in sctp_send_heartbeat_ack()
9152 chk->whoTo = net; in sctp_send_heartbeat_ack()
9153 atomic_add_int(&chk->whoTo->ref_count, 1); in sctp_send_heartbeat_ack()
9154 TAILQ_INSERT_TAIL(&chk->asoc->control_send_queue, chk, sctp_next); in sctp_send_heartbeat_ack()
9155 chk->asoc->ctrl_queue_cnt++; in sctp_send_heartbeat_ack()
9164 struct sctp_tmit_chunk *chk; in sctp_send_cookie_ack() local
9174 sctp_alloc_a_chunk(stcb, chk); in sctp_send_cookie_ack()
9175 if (chk == NULL) { in sctp_send_cookie_ack()
9180 chk->copy_by_ref = 0; in sctp_send_cookie_ack()
9181 chk->rec.chunk_id.id = SCTP_COOKIE_ACK; in sctp_send_cookie_ack()
9182 chk->rec.chunk_id.can_take_data = 1; in sctp_send_cookie_ack()
9183 chk->flags = 0; in sctp_send_cookie_ack()
9184 chk->send_size = sizeof(struct sctp_chunkhdr); in sctp_send_cookie_ack()
9185 chk->sent = SCTP_DATAGRAM_UNSENT; in sctp_send_cookie_ack()
9186 chk->snd_count = 0; in sctp_send_cookie_ack()
9187 chk->asoc = &stcb->asoc; in sctp_send_cookie_ack()
9188 chk->data = cookie_ack; in sctp_send_cookie_ack()
9189 if (chk->asoc->last_control_chunk_from != NULL) { in sctp_send_cookie_ack()
9190 chk->whoTo = chk->asoc->last_control_chunk_from; in sctp_send_cookie_ack()
9191 atomic_add_int(&chk->whoTo->ref_count, 1); in sctp_send_cookie_ack()
9193 chk->whoTo = NULL; in sctp_send_cookie_ack()
9198 hdr->chunk_length = htons(chk->send_size); in sctp_send_cookie_ack()
9199 SCTP_BUF_LEN(cookie_ack) = chk->send_size; in sctp_send_cookie_ack()
9200 TAILQ_INSERT_TAIL(&chk->asoc->control_send_queue, chk, sctp_next); in sctp_send_cookie_ack()
9201 chk->asoc->ctrl_queue_cnt++; in sctp_send_cookie_ack()
9211 struct sctp_tmit_chunk *chk; in sctp_send_shutdown_ack() local
9219 sctp_alloc_a_chunk(stcb, chk); in sctp_send_shutdown_ack()
9220 if (chk == NULL) { in sctp_send_shutdown_ack()
9225 chk->copy_by_ref = 0; in sctp_send_shutdown_ack()
9226 chk->rec.chunk_id.id = SCTP_SHUTDOWN_ACK; in sctp_send_shutdown_ack()
9227 chk->rec.chunk_id.can_take_data = 1; in sctp_send_shutdown_ack()
9228 chk->flags = 0; in sctp_send_shutdown_ack()
9229 chk->send_size = sizeof(struct sctp_chunkhdr); in sctp_send_shutdown_ack()
9230 chk->sent = SCTP_DATAGRAM_UNSENT; in sctp_send_shutdown_ack()
9231 chk->snd_count = 0; in sctp_send_shutdown_ack()
9232 chk->asoc = &stcb->asoc; in sctp_send_shutdown_ack()
9233 chk->data = m_shutdown_ack; in sctp_send_shutdown_ack()
9234 chk->whoTo = net; in sctp_send_shutdown_ack()
9235 if (chk->whoTo) { in sctp_send_shutdown_ack()
9236 atomic_add_int(&chk->whoTo->ref_count, 1); in sctp_send_shutdown_ack()
9241 ack_cp->ch.chunk_length = htons(chk->send_size); in sctp_send_shutdown_ack()
9242 SCTP_BUF_LEN(m_shutdown_ack) = chk->send_size; in sctp_send_shutdown_ack()
9243 TAILQ_INSERT_TAIL(&chk->asoc->control_send_queue, chk, sctp_next); in sctp_send_shutdown_ack()
9244 chk->asoc->ctrl_queue_cnt++; in sctp_send_shutdown_ack()
9254 struct sctp_tmit_chunk *chk; in sctp_send_shutdown() local
9256 TAILQ_FOREACH(chk, &stcb->asoc.control_send_queue, sctp_next) { in sctp_send_shutdown()
9257 if (chk->rec.chunk_id.id == SCTP_SHUTDOWN) { in sctp_send_shutdown()
9259 if (chk->whoTo) { in sctp_send_shutdown()
9260 sctp_free_remote_addr(chk->whoTo); in sctp_send_shutdown()
9261 chk->whoTo = NULL; in sctp_send_shutdown()
9266 if (chk == NULL) { in sctp_send_shutdown()
9273 sctp_alloc_a_chunk(stcb, chk); in sctp_send_shutdown()
9274 if (chk == NULL) { in sctp_send_shutdown()
9279 chk->copy_by_ref = 0; in sctp_send_shutdown()
9280 chk->rec.chunk_id.id = SCTP_SHUTDOWN; in sctp_send_shutdown()
9281 chk->rec.chunk_id.can_take_data = 1; in sctp_send_shutdown()
9282 chk->flags = 0; in sctp_send_shutdown()
9283 chk->send_size = sizeof(struct sctp_shutdown_chunk); in sctp_send_shutdown()
9284 chk->sent = SCTP_DATAGRAM_UNSENT; in sctp_send_shutdown()
9285 chk->snd_count = 0; in sctp_send_shutdown()
9286 chk->asoc = &stcb->asoc; in sctp_send_shutdown()
9287 chk->data = m_shutdown; in sctp_send_shutdown()
9288 chk->whoTo = net; in sctp_send_shutdown()
9289 if (chk->whoTo) { in sctp_send_shutdown()
9290 atomic_add_int(&chk->whoTo->ref_count, 1); in sctp_send_shutdown()
9295 shutdown_cp->ch.chunk_length = htons(chk->send_size); in sctp_send_shutdown()
9297 SCTP_BUF_LEN(m_shutdown) = chk->send_size; in sctp_send_shutdown()
9298 TAILQ_INSERT_TAIL(&chk->asoc->control_send_queue, chk, sctp_next); in sctp_send_shutdown()
9299 chk->asoc->ctrl_queue_cnt++; in sctp_send_shutdown()
9301 TAILQ_REMOVE(&stcb->asoc.control_send_queue, chk, sctp_next); in sctp_send_shutdown()
9302 chk->whoTo = net; in sctp_send_shutdown()
9303 if (chk->whoTo) { in sctp_send_shutdown()
9304 atomic_add_int(&chk->whoTo->ref_count, 1); in sctp_send_shutdown()
9306 shutdown_cp = mtod(chk->data, struct sctp_shutdown_chunk *); in sctp_send_shutdown()
9308 TAILQ_INSERT_TAIL(&stcb->asoc.control_send_queue, chk, sctp_next); in sctp_send_shutdown()
9320 struct sctp_tmit_chunk *chk; in sctp_send_asconf() local
9338 sctp_alloc_a_chunk(stcb, chk); in sctp_send_asconf()
9339 if (chk == NULL) { in sctp_send_asconf()
9345 chk->copy_by_ref = 0; in sctp_send_asconf()
9346 chk->rec.chunk_id.id = SCTP_ASCONF; in sctp_send_asconf()
9347 chk->rec.chunk_id.can_take_data = 0; in sctp_send_asconf()
9348 chk->flags = CHUNK_FLAGS_FRAGMENT_OK; in sctp_send_asconf()
9349 chk->data = m_asconf; in sctp_send_asconf()
9350 chk->send_size = len; in sctp_send_asconf()
9351 chk->sent = SCTP_DATAGRAM_UNSENT; in sctp_send_asconf()
9352 chk->snd_count = 0; in sctp_send_asconf()
9353 chk->asoc = &stcb->asoc; in sctp_send_asconf()
9354 chk->whoTo = net; in sctp_send_asconf()
9355 if (chk->whoTo) { in sctp_send_asconf()
9356 atomic_add_int(&chk->whoTo->ref_count, 1); in sctp_send_asconf()
9358 TAILQ_INSERT_TAIL(&chk->asoc->asconf_send_queue, chk, sctp_next); in sctp_send_asconf()
9359 chk->asoc->ctrl_queue_cnt++; in sctp_send_asconf()
9370 struct sctp_tmit_chunk *chk; in sctp_send_asconf_ack() local
9428 sctp_alloc_a_chunk(stcb, chk); in sctp_send_asconf_ack()
9429 if (chk == NULL) { in sctp_send_asconf_ack()
9435 chk->copy_by_ref = 0; in sctp_send_asconf_ack()
9436 chk->rec.chunk_id.id = SCTP_ASCONF_ACK; in sctp_send_asconf_ack()
9437 chk->rec.chunk_id.can_take_data = 1; in sctp_send_asconf_ack()
9438 chk->flags = CHUNK_FLAGS_FRAGMENT_OK; in sctp_send_asconf_ack()
9439 chk->whoTo = net; in sctp_send_asconf_ack()
9440 if (chk->whoTo) { in sctp_send_asconf_ack()
9441 atomic_add_int(&chk->whoTo->ref_count, 1); in sctp_send_asconf_ack()
9443 chk->data = m_ack; in sctp_send_asconf_ack()
9444 chk->send_size = ack->len; in sctp_send_asconf_ack()
9445 chk->sent = SCTP_DATAGRAM_UNSENT; in sctp_send_asconf_ack()
9446 chk->snd_count = 0; in sctp_send_asconf_ack()
9447 chk->asoc = &stcb->asoc; in sctp_send_asconf_ack()
9449 TAILQ_INSERT_TAIL(&chk->asoc->control_send_queue, chk, sctp_next); in sctp_send_asconf_ack()
9450 chk->asoc->ctrl_queue_cnt++; in sctp_send_asconf_ack()
9474 struct sctp_tmit_chunk *chk, *fwd; in sctp_chunk_retransmission() local
9510 TAILQ_FOREACH(chk, &asoc->control_send_queue, sctp_next) { in sctp_chunk_retransmission()
9511 if ((chk->rec.chunk_id.id == SCTP_COOKIE_ECHO) || in sctp_chunk_retransmission()
9512 (chk->rec.chunk_id.id == SCTP_STREAM_RESET) || in sctp_chunk_retransmission()
9513 (chk->rec.chunk_id.id == SCTP_FORWARD_CUM_TSN)) { in sctp_chunk_retransmission()
9514 if (chk->sent != SCTP_DATAGRAM_RESEND) { in sctp_chunk_retransmission()
9517 if (chk->rec.chunk_id.id == SCTP_STREAM_RESET) { in sctp_chunk_retransmission()
9518 if (chk != asoc->str_reset) { in sctp_chunk_retransmission()
9527 if (chk->rec.chunk_id.id == SCTP_FORWARD_CUM_TSN) { in sctp_chunk_retransmission()
9535 (sctp_auth_is_required_chunk(chk->rec.chunk_id.id, in sctp_chunk_retransmission()
9540 chk->rec.chunk_id.id); in sctp_chunk_retransmission()
9543 m = sctp_copy_mbufchain(chk->data, m, &endofchain, 0, chk->send_size, chk->copy_by_ref); in sctp_chunk_retransmission()
9559 if (chk->rec.chunk_id.id == SCTP_COOKIE_ECHO) { in sctp_chunk_retransmission()
9560 sctp_timer_start(SCTP_TIMER_TYPE_COOKIE, inp, stcb, chk->whoTo); in sctp_chunk_retransmission()
9562 } else if (chk->rec.chunk_id.id == SCTP_ASCONF) { in sctp_chunk_retransmission()
9564 sctp_timer_start(SCTP_TIMER_TYPE_ASCONF, inp, stcb, chk->whoTo); in sctp_chunk_retransmission()
9567 chk->snd_count++; /* update our count */ in sctp_chunk_retransmission()
9568 if ((error = sctp_lowlevel_chunk_output(inp, stcb, chk->whoTo, in sctp_chunk_retransmission()
9569 (struct sockaddr *)&chk->whoTo->ro._l_addr, m, in sctp_chunk_retransmission()
9573 chk->whoTo->port, NULL, in sctp_chunk_retransmission()
9595 chk->sent = SCTP_DATAGRAM_SENT; in sctp_chunk_retransmission()
9621 TAILQ_FOREACH(chk, &asoc->sent_queue, sctp_next) { in sctp_chunk_retransmission()
9622 if (chk->sent != SCTP_DATAGRAM_RESEND) { in sctp_chunk_retransmission()
9626 if (chk->data == NULL) { in sctp_chunk_retransmission()
9628 chk->rec.data.tsn, chk->snd_count, chk->sent); in sctp_chunk_retransmission()
9632 (chk->snd_count >= SCTP_BASE_SYSCTL(sctp_max_retran_chunk))) { in sctp_chunk_retransmission()
9637 chk->rec.data.tsn, chk->snd_count); in sctp_chunk_retransmission()
9648 net = chk->whoTo; in sctp_chunk_retransmission()
9671 if (tsn == chk->rec.data.tsn) { in sctp_chunk_retransmission()
9687 chk->window_probe = 1; in sctp_chunk_retransmission()
9688 chk->whoTo->window_probe = 1; in sctp_chunk_retransmission()
9697 if (chk->rec.data.doing_fast_retransmit == 0) { in sctp_chunk_retransmission()
9725 if ((chk->send_size <= (mtu - dmtu)) || in sctp_chunk_retransmission()
9726 (chk->flags & CHUNK_FLAGS_FRAGMENT_OK)) { in sctp_chunk_retransmission()
9736 auth_keyid = chk->auth_keyid; in sctp_chunk_retransmission()
9740 auth_keyid = chk->auth_keyid; in sctp_chunk_retransmission()
9742 } else if (chk->auth_keyid != auth_keyid) { in sctp_chunk_retransmission()
9747 m = sctp_copy_mbufchain(chk->data, m, &endofchain, 0, chk->send_size, chk->copy_by_ref); in sctp_chunk_retransmission()
9753 if (chk->flags & CHUNK_FLAGS_FRAGMENT_OK) { in sctp_chunk_retransmission()
9757 if (mtu > (chk->send_size + dmtu)) in sctp_chunk_retransmission()
9758 mtu -= (chk->send_size + dmtu); in sctp_chunk_retransmission()
9761 data_list[bundle_at++] = chk; in sctp_chunk_retransmission()
9771 for (fwd = TAILQ_NEXT(chk, sctp_next); fwd != NULL; fwd = TAILQ_NEXT(fwd, sctp_next)) { in sctp_chunk_retransmission()
10331 struct sctp_tmit_chunk *chk, *at, *tp1, *last; in send_forward_tsn() local
10341 TAILQ_FOREACH(chk, &asoc->control_send_queue, sctp_next) { in send_forward_tsn()
10342 if (chk->rec.chunk_id.id == SCTP_FORWARD_CUM_TSN) { in send_forward_tsn()
10344 chk->sent = SCTP_DATAGRAM_UNSENT; in send_forward_tsn()
10345 chk->snd_count = 0; in send_forward_tsn()
10347 if (chk->whoTo) { in send_forward_tsn()
10348 sctp_free_remote_addr(chk->whoTo); in send_forward_tsn()
10349 chk->whoTo = NULL; in send_forward_tsn()
10355 sctp_alloc_a_chunk(stcb, chk); in send_forward_tsn()
10356 if (chk == NULL) { in send_forward_tsn()
10360 chk->copy_by_ref = 0; in send_forward_tsn()
10366 chk->rec.chunk_id.id = SCTP_FORWARD_CUM_TSN; in send_forward_tsn()
10367 chk->rec.chunk_id.can_take_data = 0; in send_forward_tsn()
10368 chk->flags = 0; in send_forward_tsn()
10369 chk->asoc = asoc; in send_forward_tsn()
10370 chk->whoTo = NULL; in send_forward_tsn()
10371 chk->data = sctp_get_mbuf_for_msg(MCLBYTES, 0, M_NOWAIT, 1, MT_DATA); in send_forward_tsn()
10372 if (chk->data == NULL) { in send_forward_tsn()
10373 sctp_free_a_chunk(stcb, chk, SCTP_SO_NOT_LOCKED); in send_forward_tsn()
10376 SCTP_BUF_RESV_UF(chk->data, SCTP_MIN_OVERHEAD); in send_forward_tsn()
10377 chk->sent = SCTP_DATAGRAM_UNSENT; in send_forward_tsn()
10378 chk->snd_count = 0; in send_forward_tsn()
10379 TAILQ_INSERT_TAIL(&asoc->control_send_queue, chk, sctp_next); in send_forward_tsn()
10386 SCTP_BUF_LEN(chk->data) = 0; in send_forward_tsn()
10406 cnt_of_space = (unsigned int)M_TRAILINGSPACE(chk->data); in send_forward_tsn()
10474 chk->send_size = space_needed; in send_forward_tsn()
10476 fwdtsn = mtod(chk->data, struct sctp_forward_tsn_chunk *); in send_forward_tsn()
10477 fwdtsn->ch.chunk_length = htons(chk->send_size); in send_forward_tsn()
10485 SCTP_BUF_LEN(chk->data) = chk->send_size; in send_forward_tsn()
10551 struct sctp_tmit_chunk *chk, *a_chk; in sctp_send_sack() local
10584 TAILQ_FOREACH(chk, &asoc->control_send_queue, sctp_next) { in sctp_send_sack()
10585 if (chk->rec.chunk_id.id == type) { in sctp_send_sack()
10587 TAILQ_REMOVE(&asoc->control_send_queue, chk, sctp_next); in sctp_send_sack()
10589 a_chk = chk; in sctp_send_sack()
11373 struct sctp_tmit_chunk *chk; in sctp_send_hb() local
11394 sctp_alloc_a_chunk(stcb, chk); in sctp_send_hb()
11395 if (chk == NULL) { in sctp_send_hb()
11400 chk->copy_by_ref = 0; in sctp_send_hb()
11401 chk->rec.chunk_id.id = SCTP_HEARTBEAT_REQUEST; in sctp_send_hb()
11402 chk->rec.chunk_id.can_take_data = 1; in sctp_send_hb()
11403 chk->flags = 0; in sctp_send_hb()
11404 chk->asoc = &stcb->asoc; in sctp_send_hb()
11405 chk->send_size = sizeof(struct sctp_heartbeat_chunk); in sctp_send_hb()
11407 chk->data = sctp_get_mbuf_for_msg(chk->send_size, 0, M_NOWAIT, 1, MT_HEADER); in sctp_send_hb()
11408 if (chk->data == NULL) { in sctp_send_hb()
11409 sctp_free_a_chunk(stcb, chk, so_locked); in sctp_send_hb()
11412 SCTP_BUF_RESV_UF(chk->data, SCTP_MIN_OVERHEAD); in sctp_send_hb()
11413 SCTP_BUF_LEN(chk->data) = chk->send_size; in sctp_send_hb()
11414 chk->sent = SCTP_DATAGRAM_UNSENT; in sctp_send_hb()
11415 chk->snd_count = 0; in sctp_send_hb()
11416 chk->whoTo = net; in sctp_send_hb()
11417 atomic_add_int(&chk->whoTo->ref_count, 1); in sctp_send_hb()
11419 hb = mtod(chk->data, struct sctp_heartbeat_chunk *); in sctp_send_hb()
11424 hb->ch.chunk_length = htons(chk->send_size); in sctp_send_hb()
11460 if (chk->data) { in sctp_send_hb()
11461 sctp_m_freem(chk->data); in sctp_send_hb()
11462 chk->data = NULL; in sctp_send_hb()
11464 sctp_free_a_chunk(stcb, chk, so_locked); in sctp_send_hb()
11469 TAILQ_INSERT_TAIL(&stcb->asoc.control_send_queue, chk, sctp_next); in sctp_send_hb()
11481 struct sctp_tmit_chunk *chk; in sctp_send_ecn_echo() local
11488 TAILQ_FOREACH(chk, &asoc->control_send_queue, sctp_next) { in sctp_send_ecn_echo()
11489 if ((chk->rec.chunk_id.id == SCTP_ECN_ECHO) && (net == chk->whoTo)) { in sctp_send_ecn_echo()
11493 ecne = mtod(chk->data, struct sctp_ecne_chunk *); in sctp_send_ecn_echo()
11506 sctp_alloc_a_chunk(stcb, chk); in sctp_send_ecn_echo()
11507 if (chk == NULL) { in sctp_send_ecn_echo()
11511 chk->copy_by_ref = 0; in sctp_send_ecn_echo()
11512 chk->rec.chunk_id.id = SCTP_ECN_ECHO; in sctp_send_ecn_echo()
11513 chk->rec.chunk_id.can_take_data = 0; in sctp_send_ecn_echo()
11514 chk->flags = 0; in sctp_send_ecn_echo()
11515 chk->asoc = &stcb->asoc; in sctp_send_ecn_echo()
11516 chk->send_size = sizeof(struct sctp_ecne_chunk); in sctp_send_ecn_echo()
11517 chk->data = sctp_get_mbuf_for_msg(chk->send_size, 0, M_NOWAIT, 1, MT_HEADER); in sctp_send_ecn_echo()
11518 if (chk->data == NULL) { in sctp_send_ecn_echo()
11519 sctp_free_a_chunk(stcb, chk, SCTP_SO_NOT_LOCKED); in sctp_send_ecn_echo()
11522 SCTP_BUF_RESV_UF(chk->data, SCTP_MIN_OVERHEAD); in sctp_send_ecn_echo()
11523 SCTP_BUF_LEN(chk->data) = chk->send_size; in sctp_send_ecn_echo()
11524 chk->sent = SCTP_DATAGRAM_UNSENT; in sctp_send_ecn_echo()
11525 chk->snd_count = 0; in sctp_send_ecn_echo()
11526 chk->whoTo = net; in sctp_send_ecn_echo()
11527 atomic_add_int(&chk->whoTo->ref_count, 1); in sctp_send_ecn_echo()
11530 ecne = mtod(chk->data, struct sctp_ecne_chunk *); in sctp_send_ecn_echo()
11536 TAILQ_INSERT_HEAD(&stcb->asoc.control_send_queue, chk, sctp_next); in sctp_send_ecn_echo()
11546 struct sctp_tmit_chunk *chk; in sctp_send_packet_dropped() local
11569 sctp_alloc_a_chunk(stcb, chk); in sctp_send_packet_dropped()
11570 if (chk == NULL) { in sctp_send_packet_dropped()
11573 chk->copy_by_ref = 0; in sctp_send_packet_dropped()
11574 chk->rec.chunk_id.id = SCTP_PACKET_DROPPED; in sctp_send_packet_dropped()
11575 chk->rec.chunk_id.can_take_data = 1; in sctp_send_packet_dropped()
11576 chk->flags = 0; in sctp_send_packet_dropped()
11578 chk->send_size = len; in sctp_send_packet_dropped()
11599 sctp_free_a_chunk(stcb, chk, SCTP_SO_NOT_LOCKED); in sctp_send_packet_dropped()
11618 chk->asoc = &stcb->asoc; in sctp_send_packet_dropped()
11619 chk->data = sctp_get_mbuf_for_msg(MCLBYTES, 0, M_NOWAIT, 1, MT_DATA); in sctp_send_packet_dropped()
11620 if (chk->data == NULL) { in sctp_send_packet_dropped()
11622 sctp_free_a_chunk(stcb, chk, SCTP_SO_NOT_LOCKED); in sctp_send_packet_dropped()
11625 SCTP_BUF_RESV_UF(chk->data, SCTP_MIN_OVERHEAD); in sctp_send_packet_dropped()
11626 drp = mtod(chk->data, struct sctp_pktdrop_chunk *); in sctp_send_packet_dropped()
11628 sctp_m_freem(chk->data); in sctp_send_packet_dropped()
11629 chk->data = NULL; in sctp_send_packet_dropped()
11632 chk->book_size = SCTP_SIZE32((chk->send_size + sizeof(struct sctp_pktdrop_chunk) + in sctp_send_packet_dropped()
11634 chk->book_size_scale = 0; in sctp_send_packet_dropped()
11642 chk->send_size = (uint16_t)(len - sizeof(struct sctp_pktdrop_chunk)); in sctp_send_packet_dropped()
11643 len = chk->send_size; in sctp_send_packet_dropped()
11652 chk->send_size += sizeof(struct sctp_pktdrop_chunk); in sctp_send_packet_dropped()
11653 SCTP_BUF_LEN(chk->data) = chk->send_size; in sctp_send_packet_dropped()
11654 chk->sent = SCTP_DATAGRAM_UNSENT; in sctp_send_packet_dropped()
11655 chk->snd_count = 0; in sctp_send_packet_dropped()
11658 chk->whoTo = net; in sctp_send_packet_dropped()
11659 atomic_add_int(&chk->whoTo->ref_count, 1); in sctp_send_packet_dropped()
11661 chk->whoTo = NULL; in sctp_send_packet_dropped()
11664 drp->ch.chunk_length = htons(chk->send_size); in sctp_send_packet_dropped()
11685 TAILQ_INSERT_TAIL(&stcb->asoc.control_send_queue, chk, sctp_next); in sctp_send_packet_dropped()
11694 struct sctp_tmit_chunk *chk; in sctp_send_cwr() local
11701 TAILQ_FOREACH(chk, &asoc->control_send_queue, sctp_next) { in sctp_send_cwr()
11702 if ((chk->rec.chunk_id.id == SCTP_ECN_CWR) && (net == chk->whoTo)) { in sctp_send_cwr()
11709 cwr = mtod(chk->data, struct sctp_cwr_chunk *); in sctp_send_cwr()
11721 sctp_alloc_a_chunk(stcb, chk); in sctp_send_cwr()
11722 if (chk == NULL) { in sctp_send_cwr()
11725 chk->copy_by_ref = 0; in sctp_send_cwr()
11726 chk->rec.chunk_id.id = SCTP_ECN_CWR; in sctp_send_cwr()
11727 chk->rec.chunk_id.can_take_data = 1; in sctp_send_cwr()
11728 chk->flags = 0; in sctp_send_cwr()
11729 chk->asoc = asoc; in sctp_send_cwr()
11730 chk->send_size = sizeof(struct sctp_cwr_chunk); in sctp_send_cwr()
11731 chk->data = sctp_get_mbuf_for_msg(chk->send_size, 0, M_NOWAIT, 1, MT_HEADER); in sctp_send_cwr()
11732 if (chk->data == NULL) { in sctp_send_cwr()
11733 sctp_free_a_chunk(stcb, chk, SCTP_SO_NOT_LOCKED); in sctp_send_cwr()
11736 SCTP_BUF_RESV_UF(chk->data, SCTP_MIN_OVERHEAD); in sctp_send_cwr()
11737 SCTP_BUF_LEN(chk->data) = chk->send_size; in sctp_send_cwr()
11738 chk->sent = SCTP_DATAGRAM_UNSENT; in sctp_send_cwr()
11739 chk->snd_count = 0; in sctp_send_cwr()
11740 chk->whoTo = net; in sctp_send_cwr()
11741 atomic_add_int(&chk->whoTo->ref_count, 1); in sctp_send_cwr()
11742 cwr = mtod(chk->data, struct sctp_cwr_chunk *); in sctp_send_cwr()
11747 TAILQ_INSERT_TAIL(&asoc->control_send_queue, chk, sctp_next); in sctp_send_cwr()
11752 sctp_add_stream_reset_out(struct sctp_tcb *stcb, struct sctp_tmit_chunk *chk, in sctp_add_stream_reset_out() argument
11761 ch = mtod(chk->data, struct sctp_chunkhdr *); in sctp_add_stream_reset_out()
11817 chk->book_size = len + old_len; in sctp_add_stream_reset_out()
11818 chk->book_size_scale = 0; in sctp_add_stream_reset_out()
11819 chk->send_size = SCTP_SIZE32(chk->book_size); in sctp_add_stream_reset_out()
11820 SCTP_BUF_LEN(chk->data) = chk->send_size; in sctp_add_stream_reset_out()
11825 sctp_add_stream_reset_in(struct sctp_tmit_chunk *chk, in sctp_add_stream_reset_in() argument
11833 ch = mtod(chk->data, struct sctp_chunkhdr *); in sctp_add_stream_reset_in()
11858 chk->book_size = len + old_len; in sctp_add_stream_reset_in()
11859 chk->book_size_scale = 0; in sctp_add_stream_reset_in()
11860 chk->send_size = SCTP_SIZE32(chk->book_size); in sctp_add_stream_reset_in()
11861 SCTP_BUF_LEN(chk->data) = chk->send_size; in sctp_add_stream_reset_in()
11866 sctp_add_stream_reset_tsn(struct sctp_tmit_chunk *chk, in sctp_add_stream_reset_tsn() argument
11873 ch = mtod(chk->data, struct sctp_chunkhdr *); in sctp_add_stream_reset_tsn()
11886 chk->send_size = len + old_len; in sctp_add_stream_reset_tsn()
11887 chk->book_size = SCTP_SIZE32(chk->send_size); in sctp_add_stream_reset_tsn()
11888 chk->book_size_scale = 0; in sctp_add_stream_reset_tsn()
11889 SCTP_BUF_LEN(chk->data) = SCTP_SIZE32(chk->send_size); in sctp_add_stream_reset_tsn()
11894 sctp_add_stream_reset_result(struct sctp_tmit_chunk *chk, in sctp_add_stream_reset_result() argument
11901 ch = mtod(chk->data, struct sctp_chunkhdr *); in sctp_add_stream_reset_result()
11915 chk->book_size = len + old_len; in sctp_add_stream_reset_result()
11916 chk->book_size_scale = 0; in sctp_add_stream_reset_result()
11917 chk->send_size = SCTP_SIZE32(chk->book_size); in sctp_add_stream_reset_result()
11918 SCTP_BUF_LEN(chk->data) = chk->send_size; in sctp_add_stream_reset_result()
11928 struct sctp_tmit_chunk *chk; in sctp_send_deferred_reset_response() local
11942 sctp_alloc_a_chunk(stcb, chk); in sctp_send_deferred_reset_response()
11943 if (chk == NULL) { in sctp_send_deferred_reset_response()
11947 chk->copy_by_ref = 0; in sctp_send_deferred_reset_response()
11948 chk->rec.chunk_id.id = SCTP_STREAM_RESET; in sctp_send_deferred_reset_response()
11949 chk->rec.chunk_id.can_take_data = 0; in sctp_send_deferred_reset_response()
11950 chk->flags = 0; in sctp_send_deferred_reset_response()
11951 chk->asoc = &stcb->asoc; in sctp_send_deferred_reset_response()
11952 chk->book_size = sizeof(struct sctp_chunkhdr); in sctp_send_deferred_reset_response()
11953 chk->send_size = SCTP_SIZE32(chk->book_size); in sctp_send_deferred_reset_response()
11954 chk->book_size_scale = 0; in sctp_send_deferred_reset_response()
11955 chk->data = sctp_get_mbuf_for_msg(MCLBYTES, 0, M_NOWAIT, 1, MT_DATA); in sctp_send_deferred_reset_response()
11956 if (chk->data == NULL) { in sctp_send_deferred_reset_response()
11957 sctp_free_a_chunk(stcb, chk, SCTP_SO_LOCKED); in sctp_send_deferred_reset_response()
11961 SCTP_BUF_RESV_UF(chk->data, SCTP_MIN_OVERHEAD); in sctp_send_deferred_reset_response()
11963 chk->sent = SCTP_DATAGRAM_UNSENT; in sctp_send_deferred_reset_response()
11964 chk->snd_count = 0; in sctp_send_deferred_reset_response()
11966 chk->whoTo = stcb->asoc.alternate; in sctp_send_deferred_reset_response()
11968 chk->whoTo = stcb->asoc.primary_destination; in sctp_send_deferred_reset_response()
11970 ch = mtod(chk->data, struct sctp_chunkhdr *); in sctp_send_deferred_reset_response()
11973 ch->chunk_length = htons(chk->book_size); in sctp_send_deferred_reset_response()
11974 atomic_add_int(&chk->whoTo->ref_count, 1); in sctp_send_deferred_reset_response()
11975 SCTP_BUF_LEN(chk->data) = chk->send_size; in sctp_send_deferred_reset_response()
11976 sctp_add_stream_reset_result(chk, ent->seq, response); in sctp_send_deferred_reset_response()
11979 chk, in sctp_send_deferred_reset_response()
11985 sctp_add_stream_reset_result_tsn(struct sctp_tmit_chunk *chk, in sctp_add_stream_reset_result_tsn() argument
11993 ch = mtod(chk->data, struct sctp_chunkhdr *); in sctp_add_stream_reset_result_tsn()
12009 chk->book_size = len + old_len; in sctp_add_stream_reset_result_tsn()
12010 chk->send_size = SCTP_SIZE32(chk->book_size); in sctp_add_stream_reset_result_tsn()
12011 chk->book_size_scale = 0; in sctp_add_stream_reset_result_tsn()
12012 SCTP_BUF_LEN(chk->data) = chk->send_size; in sctp_add_stream_reset_result_tsn()
12017 sctp_add_an_out_stream(struct sctp_tmit_chunk *chk, in sctp_add_an_out_stream() argument
12025 ch = mtod(chk->data, struct sctp_chunkhdr *); in sctp_add_an_out_stream()
12042 chk->send_size = len + old_len; in sctp_add_an_out_stream()
12043 chk->book_size = SCTP_SIZE32(chk->send_size); in sctp_add_an_out_stream()
12044 chk->book_size_scale = 0; in sctp_add_an_out_stream()
12045 SCTP_BUF_LEN(chk->data) = SCTP_SIZE32(chk->send_size); in sctp_add_an_out_stream()
12050 sctp_add_an_in_stream(struct sctp_tmit_chunk *chk, in sctp_add_an_in_stream() argument
12058 ch = mtod(chk->data, struct sctp_chunkhdr *); in sctp_add_an_in_stream()
12074 chk->send_size = len + old_len; in sctp_add_an_in_stream()
12075 chk->book_size = SCTP_SIZE32(chk->send_size); in sctp_add_an_in_stream()
12076 chk->book_size_scale = 0; in sctp_add_an_in_stream()
12077 SCTP_BUF_LEN(chk->data) = SCTP_SIZE32(chk->send_size); in sctp_add_an_in_stream()
12085 struct sctp_tmit_chunk *chk; in sctp_send_stream_reset_out_if_possible() local
12094 sctp_alloc_a_chunk(stcb, chk); in sctp_send_stream_reset_out_if_possible()
12095 if (chk == NULL) { in sctp_send_stream_reset_out_if_possible()
12099 chk->copy_by_ref = 0; in sctp_send_stream_reset_out_if_possible()
12100 chk->rec.chunk_id.id = SCTP_STREAM_RESET; in sctp_send_stream_reset_out_if_possible()
12101 chk->rec.chunk_id.can_take_data = 0; in sctp_send_stream_reset_out_if_possible()
12102 chk->flags = 0; in sctp_send_stream_reset_out_if_possible()
12103 chk->asoc = &stcb->asoc; in sctp_send_stream_reset_out_if_possible()
12104 chk->book_size = sizeof(struct sctp_chunkhdr); in sctp_send_stream_reset_out_if_possible()
12105 chk->send_size = SCTP_SIZE32(chk->book_size); in sctp_send_stream_reset_out_if_possible()
12106 chk->book_size_scale = 0; in sctp_send_stream_reset_out_if_possible()
12107 chk->data = sctp_get_mbuf_for_msg(MCLBYTES, 0, M_NOWAIT, 1, MT_DATA); in sctp_send_stream_reset_out_if_possible()
12108 if (chk->data == NULL) { in sctp_send_stream_reset_out_if_possible()
12109 sctp_free_a_chunk(stcb, chk, so_locked); in sctp_send_stream_reset_out_if_possible()
12113 SCTP_BUF_RESV_UF(chk->data, SCTP_MIN_OVERHEAD); in sctp_send_stream_reset_out_if_possible()
12116 chk->sent = SCTP_DATAGRAM_UNSENT; in sctp_send_stream_reset_out_if_possible()
12117 chk->snd_count = 0; in sctp_send_stream_reset_out_if_possible()
12119 chk->whoTo = stcb->asoc.alternate; in sctp_send_stream_reset_out_if_possible()
12121 chk->whoTo = stcb->asoc.primary_destination; in sctp_send_stream_reset_out_if_possible()
12123 ch = mtod(chk->data, struct sctp_chunkhdr *); in sctp_send_stream_reset_out_if_possible()
12126 ch->chunk_length = htons(chk->book_size); in sctp_send_stream_reset_out_if_possible()
12127 atomic_add_int(&chk->whoTo->ref_count, 1); in sctp_send_stream_reset_out_if_possible()
12128 SCTP_BUF_LEN(chk->data) = chk->send_size; in sctp_send_stream_reset_out_if_possible()
12130 …if (sctp_add_stream_reset_out(stcb, chk, seq, (stcb->asoc.str_reset_seq_in - 1), (stcb->asoc.sendi… in sctp_send_stream_reset_out_if_possible()
12134 m_freem(chk->data); in sctp_send_stream_reset_out_if_possible()
12135 chk->data = NULL; in sctp_send_stream_reset_out_if_possible()
12136 sctp_free_a_chunk(stcb, chk, so_locked); in sctp_send_stream_reset_out_if_possible()
12139 asoc->str_reset = chk; in sctp_send_stream_reset_out_if_possible()
12142 chk, in sctp_send_stream_reset_out_if_possible()
12149 sctp_timer_start(SCTP_TIMER_TYPE_STRRESET, stcb->sctp_ep, stcb, chk->whoTo); in sctp_send_stream_reset_out_if_possible()
12163 struct sctp_tmit_chunk *chk; in sctp_send_str_reset_req() local
12199 sctp_alloc_a_chunk(stcb, chk); in sctp_send_str_reset_req()
12200 if (chk == NULL) { in sctp_send_str_reset_req()
12204 chk->copy_by_ref = 0; in sctp_send_str_reset_req()
12205 chk->rec.chunk_id.id = SCTP_STREAM_RESET; in sctp_send_str_reset_req()
12206 chk->rec.chunk_id.can_take_data = 0; in sctp_send_str_reset_req()
12207 chk->flags = 0; in sctp_send_str_reset_req()
12208 chk->asoc = &stcb->asoc; in sctp_send_str_reset_req()
12209 chk->book_size = sizeof(struct sctp_chunkhdr); in sctp_send_str_reset_req()
12210 chk->send_size = SCTP_SIZE32(chk->book_size); in sctp_send_str_reset_req()
12211 chk->book_size_scale = 0; in sctp_send_str_reset_req()
12212 chk->data = sctp_get_mbuf_for_msg(MCLBYTES, 0, M_NOWAIT, 1, MT_DATA); in sctp_send_str_reset_req()
12213 if (chk->data == NULL) { in sctp_send_str_reset_req()
12214 sctp_free_a_chunk(stcb, chk, SCTP_SO_LOCKED); in sctp_send_str_reset_req()
12218 SCTP_BUF_RESV_UF(chk->data, SCTP_MIN_OVERHEAD); in sctp_send_str_reset_req()
12221 chk->sent = SCTP_DATAGRAM_UNSENT; in sctp_send_str_reset_req()
12222 chk->snd_count = 0; in sctp_send_str_reset_req()
12224 chk->whoTo = stcb->asoc.alternate; in sctp_send_str_reset_req()
12226 chk->whoTo = stcb->asoc.primary_destination; in sctp_send_str_reset_req()
12228 atomic_add_int(&chk->whoTo->ref_count, 1); in sctp_send_str_reset_req()
12229 ch = mtod(chk->data, struct sctp_chunkhdr *); in sctp_send_str_reset_req()
12232 ch->chunk_length = htons(chk->book_size); in sctp_send_str_reset_req()
12233 SCTP_BUF_LEN(chk->data) = chk->send_size; in sctp_send_str_reset_req()
12239 …ret = sctp_add_stream_reset_out(stcb, chk, seq, (stcb->asoc.str_reset_seq_in - 1), (stcb->asoc.sen… in sctp_send_str_reset_req()
12331 sctp_add_an_out_stream(chk, seq, adding_o); in sctp_send_str_reset_req()
12336 sctp_add_an_in_stream(chk, seq, adding_i); in sctp_send_str_reset_req()
12341 sctp_add_stream_reset_in(chk, number_entries, list, seq); in sctp_send_str_reset_req()
12346 sctp_add_stream_reset_tsn(chk, seq); in sctp_send_str_reset_req()
12349 asoc->str_reset = chk; in sctp_send_str_reset_req()
12352 chk, in sctp_send_str_reset_req()
12358 sctp_timer_start(SCTP_TIMER_TYPE_STRRESET, stcb->sctp_ep, stcb, chk->whoTo); in sctp_send_str_reset_req()