Lines Matching defs:chk

2010 	     struct sctp_tmit_chunk *chk)
2027 if (chk == NULL)
2048 if (chk != NULL)
2050 chk->rec.data.ect_nonce = SCTP_ECT1_BIT;
2069 struct sctp_tmit_chunk *chk,
2141 sctp_get_ect(stcb, chk));
2334 tosBottom = (((in6p_flowinfo(inp) & 0x0c) | sctp_get_ect(stcb, chk)) << 4);
3915 struct sctp_tmit_chunk *chk, *nchk;
3917 TAILQ_FOREACH(chk, &asoc->sent_queue, sctp_next) {
3924 if ((chk->flags & (SCTP_PR_SCTP_ENABLED |
3931 if (chk->rec.data.timetodrop.tv_sec >= (long)srcv->sinfo_timetolive) {
3939 if (chk->data) {
3946 if (chk->sent > SCTP_DATAGRAM_UNSENT)
3950 ret_spc = sctp_release_pr_sctp_chunk(stcb, chk,
3962 chk = TAILQ_FIRST(&asoc->send_queue);
3963 while (chk) {
3964 nchk = TAILQ_NEXT(chk, sctp_next);
3966 if ((chk->flags & (SCTP_PR_SCTP_ENABLED |
3969 if (chk->rec.data.timetodrop.tv_sec >= (long)srcv->sinfo_timetolive) {
3970 if (chk->data) {
3976 ret_spc = sctp_release_pr_sctp_chunk(stcb, chk,
3984 } /* end if chk->data */
3986 } /* end if chk pr-sctp */
3987 chk = nchk;
3988 } /* end while (chk) */
4131 struct sctp_tmit_chunk *chk;
4333 chk = (struct sctp_tmit_chunk *)SCTP_ZONE_GET(sctppcbinfo.ipi_zone_chunk);
4334 if (chk == NULL) {
4338 sctp_prepare_chunk(chk, stcb, srcv, strq, net);
4339 chk->whoTo->ref_count++;
4340 chk->rec.data.rcv_flags |= SCTP_DATA_NOT_FRAG;
4346 chk->data = m;
4349 for (mm = chk->data; mm; mm = mm->m_next) {
4352 mbcnt += chk->data->m_ext.ext_size;
4356 chk->send_size = dataout;
4357 chk->book_size = chk->send_size;
4358 chk->mbcnt = mbcnt;
4364 chk->data->m_nextpkt = 0;
4366 TAILQ_INSERT_TAIL(&strq->outqueue, chk, sctp_next);
4413 chk = (struct sctp_tmit_chunk *)SCTP_ZONE_GET(sctppcbinfo.ipi_zone_chunk);
4414 if (chk == NULL) {
4420 chk = TAILQ_FIRST(&tmp);
4421 while (chk) {
4422 TAILQ_REMOVE(&tmp, chk, sctp_next);
4423 SCTP_ZONE_FREE(sctppcbinfo.ipi_zone_chunk, chk);
4430 chk = TAILQ_FIRST(&tmp);
4439 *chk = template;
4440 chk->whoTo->ref_count++;
4441 chk->data = n;
4444 for (mm = chk->data; mm; mm = mm->m_next) {
4447 mbcnt_e += chk->data->m_ext.ext_size;
4450 /* now fix the chk->send_size */
4451 if (chk->data->m_flags & M_PKTHDR) {
4452 chk->send_size = chk->data->m_pkthdr.len;
4455 chk->send_size = 0;
4456 for (nn = chk->data; nn; nn = nn->m_next) {
4457 chk->send_size += nn->m_len;
4460 chk->book_size = chk->send_size;
4461 chk->mbcnt = mbcnt_e;
4463 if (chk->flags & SCTP_PR_SCTP_BUFFER) {
4467 TAILQ_INSERT_TAIL(&tmp, chk, sctp_next);
4482 chk = TAILQ_FIRST(&tmp);
4483 chk->rec.data.rcv_flags |= SCTP_DATA_FIRST_FRAG;
4484 chk = TAILQ_LAST(&tmp, sctpchunk_listhead);
4485 chk->rec.data.rcv_flags |= SCTP_DATA_LAST_FRAG;
4489 chk = TAILQ_FIRST(&tmp);
4490 while (chk) {
4491 chk->data->m_nextpkt = 0;
4492 TAILQ_REMOVE(&tmp, chk, sctp_next);
4494 TAILQ_INSERT_TAIL(&strq->outqueue, chk, sctp_next);
4495 chk = TAILQ_FIRST(&tmp);
4830 struct sctp_tmit_chunk *chk, *nchk;
4831 chk = TAILQ_FIRST(&asoc->control_send_queue);
4832 while (chk) {
4833 nchk = TAILQ_NEXT(chk, sctp_next);
4834 if (chk->rec.chunk_id == SCTP_COOKIE_ECHO) {
4835 TAILQ_REMOVE(&asoc->control_send_queue, chk, sctp_next);
4836 sctp_m_freem(chk->data);
4837 chk->data = NULL;
4839 if (chk->whoTo)
4840 sctp_free_remote_addr(chk->whoTo);
4841 SCTP_ZONE_FREE(sctppcbinfo.ipi_zone_chunk, chk);
4848 chk = nchk;
4856 struct sctp_tmit_chunk *chk, *chk_tmp;
4859 for (chk = TAILQ_FIRST(&asoc->control_send_queue); chk != NULL;
4860 chk = chk_tmp) {
4861 /* get next chk */
4862 chk_tmp = TAILQ_NEXT(chk, sctp_next);
4864 if (chk->rec.chunk_id == SCTP_ASCONF) {
4865 TAILQ_REMOVE(&asoc->control_send_queue, chk, sctp_next);
4866 sctp_m_freem(chk->data);
4867 chk->data = NULL;
4869 if (chk->whoTo)
4870 sctp_free_remote_addr(chk->whoTo);
4871 SCTP_ZONE_FREE(sctppcbinfo.ipi_zone_chunk, chk);
4949 struct sctp_tmit_chunk *chk, *nchk;
4950 for (chk = TAILQ_FIRST(&asoc->control_send_queue);
4951 chk; chk = nchk) {
4952 nchk = TAILQ_NEXT(chk, sctp_next);
4953 if ((chk->rec.chunk_id == SCTP_SELECTIVE_ACK) ||
4954 (chk->rec.chunk_id == SCTP_HEARTBEAT_REQUEST) ||
4955 (chk->rec.chunk_id == SCTP_HEARTBEAT_ACK) ||
4956 (chk->rec.chunk_id == SCTP_SHUTDOWN) ||
4957 (chk->rec.chunk_id == SCTP_SHUTDOWN_ACK) ||
4958 (chk->rec.chunk_id == SCTP_OPERATION_ERROR) ||
4959 (chk->rec.chunk_id == SCTP_PACKET_DROPPED) ||
4960 (chk->rec.chunk_id == SCTP_COOKIE_ACK) ||
4961 (chk->rec.chunk_id == SCTP_ECN_CWR) ||
4962 (chk->rec.chunk_id == SCTP_ASCONF_ACK)) {
4965 TAILQ_REMOVE(&asoc->control_send_queue, chk, sctp_next);
4966 sctp_m_freem(chk->data);
4967 chk->data = NULL;
4969 sctp_free_remote_addr(chk->whoTo);
4970 SCTP_ZONE_FREE(sctppcbinfo.ipi_zone_chunk, chk);
4976 } else if (chk->rec.chunk_id == SCTP_STREAM_RESET) {
4979 strreq = mtod(chk->data, struct sctp_stream_reset_req *);
4996 struct sctp_tmit_chunk *chk, *nchk;
5003 chk = TAILQ_FIRST(&strq->outqueue);
5004 while (chk) {
5005 nchk = TAILQ_NEXT(chk, sctp_next);
5007 orig = chk->data;
5008 M_PREPEND(chk->data, sizeof(struct sctp_data_chunk), M_DONTWAIT);
5009 if (chk->data == NULL) {
5014 if (orig != chk->data) {
5028 chk->mbcnt += MSIZE;
5030 chk->send_size += sizeof(struct sctp_data_chunk);
5034 if (!failed && ((size_t)chk->data->m_len < sizeof(struct sctp_data_chunk))) {
5035 m_pullup(chk->data, sizeof(struct sctp_data_chunk));
5036 if (chk->data == NULL) {
5041 dchkh = mtod(chk->data, struct sctp_data_chunk *);
5042 dchkh->ch.chunk_length = htons(chk->send_size);
5044 padval = chk->send_size % 4;
5049 if (sctp_pad_lastmbuf(chk->data, (4 - padval))) {
5054 chk->send_size += (4 - padval);
5057 TAILQ_REMOVE(&strq->outqueue, chk, sctp_next);
5059 TAILQ_INSERT_TAIL(&tmp, chk, sctp_next);
5061 if (chk->rec.data.rcv_flags & SCTP_DATA_LAST_FRAG) {
5065 chk = nchk;
5069 chk = TAILQ_FIRST(&tmp);
5070 while (chk) {
5071 nchk = TAILQ_NEXT(chk, sctp_next);
5072 TAILQ_REMOVE(&tmp, chk, sctp_next);
5076 chk);
5078 sctp_m_freem(chk->data);
5079 chk->data = NULL;
5080 if (chk->whoTo) {
5081 sctp_free_remote_addr(chk->whoTo);
5082 chk->whoTo = NULL;
5084 SCTP_ZONE_FREE(sctppcbinfo.ipi_zone_chunk, chk);
5090 chk = nchk;
5095 chk = TAILQ_FIRST(&tmp);
5096 while (chk) {
5097 nchk = TAILQ_NEXT(chk, sctp_next);
5099 TAILQ_REMOVE(&tmp, chk, sctp_next);
5100 TAILQ_INSERT_TAIL(&asoc->send_queue, chk, sctp_next);
5103 chk->rec.data.TSN_seq = asoc->sending_seq++;
5105 dchkh = mtod(chk->data, struct sctp_data_chunk *);
5111 dchkh->ch.chunk_flags = chk->rec.data.rcv_flags;
5112 dchkh->dp.tsn = htonl(chk->rec.data.TSN_seq);
5114 dchkh->dp.stream_sequence = htons(chk->rec.data.stream_seq);
5115 dchkh->dp.protocol_id = chk->rec.data.payloadtype;
5117 tot_moved += chk->send_size;
5118 chk = nchk;
5128 struct sctp_tmit_chunk *chk;
5181 if ((chk = TAILQ_FIRST(&strq->outqueue)) == NULL) {
5191 if (chk->whoTo != net) {
5219 struct sctp_tmit_chunk *chk;
5220 TAILQ_FOREACH(chk, &asoc->control_send_queue, sctp_next) {
5221 if (chk->rec.chunk_id == SCTP_ECN_ECHO) {
5222 chk->sent = SCTP_DATAGRAM_UNSENT;
5232 struct sctp_tmit_chunk *chk;
5243 TAILQ_FOREACH(chk, &asoc->send_queue, sctp_next) {
5244 if (chk->whoTo == net) {
5246 sctp_free_remote_addr(chk->whoTo);
5247 chk->whoTo = a_net;
5277 struct sctp_tmit_chunk *chk, *nchk;
5367 TAILQ_FOREACH(chk, &asoc->send_queue, sctp_next) {
5372 TAILQ_FOREACH(chk, &asoc->sent_queue, sctp_next) {
5376 TAILQ_FOREACH(chk, &asoc->control_send_queue, sctp_next) {
5463 for (chk = TAILQ_FIRST(&asoc->control_send_queue);
5464 chk; chk = nchk) {
5465 nchk = TAILQ_NEXT(chk, sctp_next);
5466 if (chk->whoTo != net) {
5473 if (chk->data == NULL) {
5476 if ((chk->data->m_flags & M_PKTHDR) == 0) {
5478 * NOTE: the chk queue MUST have the PKTHDR
5485 if (chk->sent != SCTP_DATAGRAM_UNSENT) {
5494 if ((chk->data->m_pkthdr.len < (int)mtu) ||
5495 (chk->flags & CHUNK_FLAGS_FRAGMENT_OK)) {
5498 * the chk->data for control but the problem
5505 outchain = sctp_copy_mbufchain(chk->data,
5511 if (mtu > chk->data->m_pkthdr.len)
5512 mtu -= chk->data->m_pkthdr.len;
5516 if (chk->flags & CHUNK_FLAGS_FRAGMENT_OK) {
5520 if ((chk->rec.chunk_id == SCTP_SELECTIVE_ACK) ||
5521 (chk->rec.chunk_id == SCTP_HEARTBEAT_REQUEST) ||
5522 (chk->rec.chunk_id == SCTP_HEARTBEAT_ACK) ||
5523 (chk->rec.chunk_id == SCTP_SHUTDOWN) ||
5524 (chk->rec.chunk_id == SCTP_SHUTDOWN_ACK) ||
5525 (chk->rec.chunk_id == SCTP_OPERATION_ERROR) ||
5526 (chk->rec.chunk_id == SCTP_COOKIE_ACK) ||
5527 (chk->rec.chunk_id == SCTP_ECN_CWR) ||
5528 (chk->rec.chunk_id == SCTP_PACKET_DROPPED) ||
5529 (chk->rec.chunk_id == SCTP_ASCONF_ACK)) {
5531 if (chk->rec.chunk_id == SCTP_HEARTBEAT_REQUEST)
5534 if (chk->rec.chunk_id == SCTP_SELECTIVE_ACK) {
5550 if (chk->rec.chunk_id == SCTP_COOKIE_ECHO) {
5553 } else if (chk->rec.chunk_id == SCTP_ASCONF) {
5561 chk->sent = SCTP_DATAGRAM_SENT;
5562 chk->snd_count++;
5698 for (chk = TAILQ_FIRST(&asoc->send_queue); chk; chk = nchk) {
5720 nchk = TAILQ_NEXT(chk, sctp_next);
5721 if (chk->whoTo != net) {
5725 printf("chk->whoTo:%p not %p\n",
5726 chk->whoTo, net);
5737 if ((chk->send_size > omtu) && ((chk->flags & CHUNK_FLAGS_FRAGMENT_OK) == 0)) {
5747 chk->send_size, mtu);
5749 chk->flags |= CHUNK_FLAGS_FRAGMENT_OK;
5752 if (((chk->send_size <= mtu) && (chk->send_size <= r_mtu)) ||
5753 ((chk->flags & CHUNK_FLAGS_FRAGMENT_OK) && (chk->send_size <= asoc->peers_rwnd))) {
5760 outchain = sctp_copy_mbufchain(chk->data, outchain);
5774 if (chk->flags & CHUNK_FLAGS_FRAGMENT_OK) {
5777 mtu -= chk->send_size;
5778 r_mtu -= chk->send_size;
5779 data_list[bundle_at++] = chk;
5799 printf("ok no more chk:%d > mtu:%d || < r_mtu:%d\n",
5800 chk->send_size, mtu, r_mtu);
5981 struct sctp_tmit_chunk *chk;
5984 chk = (struct sctp_tmit_chunk *)SCTP_ZONE_GET(sctppcbinfo.ipi_zone_chunk);
5985 if (chk == NULL) {
5994 SCTP_ZONE_FREE(sctppcbinfo.ipi_zone_chunk, chk);
6002 chk->send_size = 0;
6005 chk->send_size += mat->m_len;
6008 chk->rec.chunk_id = SCTP_OPERATION_ERROR;
6009 chk->sent = SCTP_DATAGRAM_UNSENT;
6010 chk->snd_count = 0;
6011 chk->flags = 0;
6012 chk->asoc = &stcb->asoc;
6013 chk->data = op_err;
6014 chk->whoTo = chk->asoc->primary_destination;
6015 chk->whoTo->ref_count++;
6019 hdr->chunk_length = htons(chk->send_size);
6020 TAILQ_INSERT_TAIL(&chk->asoc->control_send_queue,
6021 chk,
6023 chk->asoc->ctrl_queue_cnt++;
6040 struct sctp_tmit_chunk *chk;
6093 chk = (struct sctp_tmit_chunk *)SCTP_ZONE_GET(sctppcbinfo.ipi_zone_chunk);
6094 if (chk == NULL) {
6101 chk->send_size = cookie->m_pkthdr.len;
6102 chk->rec.chunk_id = SCTP_COOKIE_ECHO;
6103 chk->sent = SCTP_DATAGRAM_UNSENT;
6104 chk->snd_count = 0;
6105 chk->flags = 0;
6106 chk->asoc = &stcb->asoc;
6107 chk->data = cookie;
6108 chk->whoTo = chk->asoc->primary_destination;
6109 chk->whoTo->ref_count++;
6110 TAILQ_INSERT_HEAD(&chk->asoc->control_send_queue, chk, sctp_next);
6111 chk->asoc->ctrl_queue_cnt++;
6127 struct sctp_tmit_chunk *chk;
6162 chk = (struct sctp_tmit_chunk *)SCTP_ZONE_GET(sctppcbinfo.ipi_zone_chunk);
6163 if (chk == NULL) {
6171 chk->send_size = chk_length;
6172 chk->rec.chunk_id = SCTP_HEARTBEAT_ACK;
6173 chk->sent = SCTP_DATAGRAM_UNSENT;
6174 chk->snd_count = 0;
6175 chk->flags = 0;
6176 chk->asoc = &stcb->asoc;
6177 chk->data = outchain;
6178 chk->whoTo = net;
6179 chk->whoTo->ref_count++;
6180 TAILQ_INSERT_TAIL(&chk->asoc->control_send_queue, chk, sctp_next);
6181 chk->asoc->ctrl_queue_cnt++;
6189 struct sctp_tmit_chunk *chk;
6198 chk = (struct sctp_tmit_chunk *)SCTP_ZONE_GET(sctppcbinfo.ipi_zone_chunk);
6199 if (chk == NULL) {
6207 chk->send_size = sizeof(struct sctp_chunkhdr);
6208 chk->rec.chunk_id = SCTP_COOKIE_ACK;
6209 chk->sent = SCTP_DATAGRAM_UNSENT;
6210 chk->snd_count = 0;
6211 chk->flags = 0;
6212 chk->asoc = &stcb->asoc;
6213 chk->data = cookie_ack;
6214 if (chk->asoc->last_control_chunk_from != NULL) {
6215 chk->whoTo = chk->asoc->last_control_chunk_from;
6217 chk->whoTo = chk->asoc->primary_destination;
6219 chk->whoTo->ref_count++;
6223 hdr->chunk_length = htons(chk->send_size);
6224 cookie_ack->m_pkthdr.len = cookie_ack->m_len = chk->send_size;
6226 TAILQ_INSERT_TAIL(&chk->asoc->control_send_queue, chk, sctp_next);
6227 chk->asoc->ctrl_queue_cnt++;
6238 struct sctp_tmit_chunk *chk;
6247 chk = (struct sctp_tmit_chunk *)SCTP_ZONE_GET(sctppcbinfo.ipi_zone_chunk);
6248 if (chk == NULL) {
6256 chk->send_size = sizeof(struct sctp_chunkhdr);
6257 chk->rec.chunk_id = SCTP_SHUTDOWN_ACK;
6258 chk->sent = SCTP_DATAGRAM_UNSENT;
6259 chk->snd_count = 0;
6260 chk->flags = 0;
6261 chk->asoc = &stcb->asoc;
6262 chk->data = m_shutdown_ack;
6263 chk->whoTo = net;
6269 ack_cp->ch.chunk_length = htons(chk->send_size);
6270 m_shutdown_ack->m_pkthdr.len = m_shutdown_ack->m_len = chk->send_size;
6272 TAILQ_INSERT_TAIL(&chk->asoc->control_send_queue, chk, sctp_next);
6273 chk->asoc->ctrl_queue_cnt++;
6283 struct sctp_tmit_chunk *chk;
6292 chk = (struct sctp_tmit_chunk *)SCTP_ZONE_GET(sctppcbinfo.ipi_zone_chunk);
6293 if (chk == NULL) {
6301 chk->send_size = sizeof(struct sctp_shutdown_chunk);
6302 chk->rec.chunk_id = SCTP_SHUTDOWN;
6303 chk->sent = SCTP_DATAGRAM_UNSENT;
6304 chk->snd_count = 0;
6305 chk->flags = 0;
6306 chk->asoc = &stcb->asoc;
6307 chk->data = m_shutdown;
6308 chk->whoTo = net;
6314 shutdown_cp->ch.chunk_length = htons(chk->send_size);
6316 m_shutdown->m_pkthdr.len = m_shutdown->m_len = chk->send_size;
6318 TAILQ_INSERT_TAIL(&chk->asoc->control_send_queue, chk, sctp_next);
6319 chk->asoc->ctrl_queue_cnt++;
6336 struct sctp_tmit_chunk *chk;
6344 chk = (struct sctp_tmit_chunk *)SCTP_ZONE_GET(sctppcbinfo.ipi_zone_chunk);
6345 if (chk == NULL) {
6353 chk->data = m_asconf;
6354 chk->send_size = m_asconf->m_pkthdr.len;
6355 chk->rec.chunk_id = SCTP_ASCONF;
6356 chk->sent = SCTP_DATAGRAM_UNSENT;
6357 chk->snd_count = 0;
6358 chk->flags = 0;
6359 chk->asoc = &stcb->asoc;
6360 chk->whoTo = chk->asoc->primary_destination;
6361 chk->whoTo->ref_count++;
6362 TAILQ_INSERT_TAIL(&chk->asoc->control_send_queue, chk, sctp_next);
6363 chk->asoc->ctrl_queue_cnt++;
6374 struct sctp_tmit_chunk *chk;
6400 chk = (struct sctp_tmit_chunk *)SCTP_ZONE_GET(sctppcbinfo.ipi_zone_chunk);
6401 if (chk == NULL) {
6414 chk->whoTo = NULL;
6417 chk->whoTo = sctp_find_alternate_net(stcb, stcb->asoc.last_control_chunk_from);
6420 if (chk->whoTo == NULL) {
6423 chk->whoTo = stcb->asoc.primary_destination;
6425 chk->whoTo = stcb->asoc.last_control_chunk_from;
6431 chk->whoTo = stcb->asoc.primary_destination;
6433 chk->whoTo = stcb->asoc.last_control_chunk_from;
6436 chk->data = m_ack;
6437 chk->send_size = m_ack->m_pkthdr.len;
6438 chk->rec.chunk_id = SCTP_ASCONF_ACK;
6439 chk->sent = SCTP_DATAGRAM_UNSENT;
6440 chk->snd_count = 0;
6441 chk->flags = 0;
6442 chk->asoc = &stcb->asoc;
6443 chk->whoTo->ref_count++;
6444 TAILQ_INSERT_TAIL(&chk->asoc->control_send_queue, chk, sctp_next);
6445 chk->asoc->ctrl_queue_cnt++;
6470 struct sctp_tmit_chunk *chk, *fwd;
6499 TAILQ_FOREACH(chk, &asoc->control_send_queue, sctp_next) {
6500 if (chk->sent != SCTP_DATAGRAM_RESEND) {
6504 if ((chk->rec.chunk_id == SCTP_COOKIE_ECHO) ||
6505 (chk->rec.chunk_id == SCTP_ASCONF) ||
6506 (chk->rec.chunk_id == SCTP_STREAM_RESET) ||
6507 (chk->rec.chunk_id == SCTP_FORWARD_CUM_TSN)) {
6508 if (chk->rec.chunk_id == SCTP_STREAM_RESET) {
6513 strreq = mtod(chk->data, struct sctp_stream_reset_req *);
6519 if (chk->rec.chunk_id == SCTP_ASCONF) {
6523 if (chk->rec.chunk_id == SCTP_FORWARD_CUM_TSN) {
6525 fwd = chk;
6527 m = sctp_copy_mbufchain(chk->data, m);
6536 if (chk->rec.chunk_id == SCTP_COOKIE_ECHO) {
6537 sctp_timer_start(SCTP_TIMER_TYPE_COOKIE, inp, stcb, chk->whoTo);
6538 } else if (chk->rec.chunk_id == SCTP_ASCONF)
6539 sctp_timer_start(SCTP_TIMER_TYPE_ASCONF, inp, stcb, chk->whoTo);
6558 chk->snd_count++; /* update our count */
6560 if ((error = sctp_lowlevel_chunk_output(inp, stcb, chk->whoTo,
6561 rtcache_getdst(&chk->whoTo->ro), m,
6570 /* SCTP_GETTIME_TIMEVAL(&chk->whoTo->last_sent_time);*/
6572 chk->sent = SCTP_DATAGRAM_SENT;
6604 TAILQ_FOREACH(chk, &asoc->sent_queue, sctp_next) {
6605 if (chk->sent != SCTP_DATAGRAM_RESEND) {
6611 net = chk->whoTo;
6622 if (tsn == chk->rec.data.TSN_seq) {
6650 if (chk->rec.data.doing_fast_retransmit == 0) {
6665 if ((chk->send_size <= mtu) || (chk->flags & CHUNK_FLAGS_FRAGMENT_OK)) {
6667 m = sctp_copy_mbufchain(chk->data, m);
6673 if (chk->flags & CHUNK_FLAGS_FRAGMENT_OK) {
6676 mtu -= chk->send_size;
6677 data_list[bundle_at++] = chk;
6680 chk->rec.data.state_flags |= SCTP_WINDOW_PROBE;
6684 /* now are there anymore forward from chk to pick up?*/
6685 fwd = TAILQ_NEXT(chk, sctp_next);
7498 struct sctp_tmit_chunk *chk;
7501 TAILQ_FOREACH(chk, &asoc->control_send_queue, sctp_next) {
7502 if (chk->rec.chunk_id == SCTP_FORWARD_CUM_TSN) {
7504 chk->sent = SCTP_DATAGRAM_UNSENT;
7505 chk->snd_count = 0;
7507 if (chk->whoTo != asoc->primary_destination) {
7508 sctp_free_remote_addr(chk->whoTo);
7509 chk->whoTo = asoc->primary_destination;
7510 chk->whoTo->ref_count++;
7516 chk = (struct sctp_tmit_chunk *)SCTP_ZONE_GET(sctppcbinfo.ipi_zone_chunk);
7517 if (chk == NULL) {
7522 chk->rec.chunk_id = SCTP_FORWARD_CUM_TSN;
7523 chk->asoc = asoc;
7524 MGETHDR(chk->data, M_DONTWAIT, MT_DATA);
7525 if (chk->data == NULL) {
7526 chk->whoTo->ref_count--;
7527 SCTP_ZONE_FREE(sctppcbinfo.ipi_zone_chunk, chk);
7535 chk->data->m_data += SCTP_MIN_OVERHEAD;
7536 chk->sent = SCTP_DATAGRAM_UNSENT;
7537 chk->snd_count = 0;
7538 chk->whoTo = asoc->primary_destination;
7539 chk->whoTo->ref_count++;
7540 TAILQ_INSERT_TAIL(&asoc->control_send_queue, chk, sctp_next);
7546 chk->data->m_pkthdr.len = chk->data->m_len = 0;
7566 if ((M_TRAILINGSPACE(chk->data) < (int)space_needed) &&
7567 ((chk->data->m_flags & M_EXT) == 0)) {
7571 MCLGET(chk->data, M_DONTWAIT);
7573 cnt_of_space = M_TRAILINGSPACE(chk->data);
7604 chk->send_size = space_needed;
7606 fwdtsn = mtod(chk->data, struct sctp_forward_tsn_chunk *);
7607 fwdtsn->ch.chunk_length = htons(chk->send_size);
7611 chk->send_size = (sizeof(struct sctp_forward_tsn_chunk) +
7613 chk->data->m_pkthdr.len = chk->data->m_len = chk->send_size;
7659 struct sctp_tmit_chunk *chk, *a_chk;
7676 TAILQ_FOREACH(chk, &asoc->control_send_queue, sctp_next) {
7677 if (chk->rec.chunk_id == SCTP_SELECTIVE_ACK) {
7679 TAILQ_REMOVE(&asoc->control_send_queue, chk, sctp_next);
7681 a_chk = chk;
8251 struct sctp_tmit_chunk *chk;
8309 chk = (struct sctp_tmit_chunk *)SCTP_ZONE_GET(sctppcbinfo.ipi_zone_chunk);
8310 if (chk == NULL) {
8320 chk->rec.chunk_id = SCTP_HEARTBEAT_REQUEST;
8321 chk->asoc = &stcb->asoc;
8322 chk->send_size = sizeof(struct sctp_heartbeat_chunk);
8323 MGETHDR(chk->data, M_DONTWAIT, MT_DATA);
8324 if (chk->data == NULL) {
8325 SCTP_ZONE_FREE(sctppcbinfo.ipi_zone_chunk, chk);
8333 chk->data->m_data += SCTP_MIN_OVERHEAD;
8334 chk->data->m_pkthdr.len = chk->data->m_len = chk->send_size;
8335 chk->sent = SCTP_DATAGRAM_UNSENT;
8336 chk->snd_count = 0;
8337 chk->whoTo = net;
8338 chk->whoTo->ref_count++;
8340 hb = mtod(chk->data, struct sctp_heartbeat_chunk *);
8345 hb->ch.chunk_length = htons(chk->send_size);
8391 sctp_m_freem(chk->data);
8392 chk->data = NULL;
8393 SCTP_ZONE_FREE(sctppcbinfo.ipi_zone_chunk, chk);
8408 TAILQ_INSERT_TAIL(&stcb->asoc.control_send_queue, chk, sctp_next);
8430 struct sctp_tmit_chunk *chk;
8432 TAILQ_FOREACH(chk, &asoc->control_send_queue, sctp_next) {
8433 if (chk->rec.chunk_id == SCTP_ECN_ECHO) {
8435 ecne = mtod(chk->data, struct sctp_ecne_chunk *);
8441 chk = (struct sctp_tmit_chunk *)SCTP_ZONE_GET(sctppcbinfo.ipi_zone_chunk);
8442 if (chk == NULL) {
8448 chk->rec.chunk_id = SCTP_ECN_ECHO;
8449 chk->asoc = &stcb->asoc;
8450 chk->send_size = sizeof(struct sctp_ecne_chunk);
8451 MGETHDR(chk->data, M_DONTWAIT, MT_DATA);
8452 if (chk->data == NULL) {
8453 SCTP_ZONE_FREE(sctppcbinfo.ipi_zone_chunk, chk);
8461 chk->data->m_data += SCTP_MIN_OVERHEAD;
8462 chk->data->m_pkthdr.len = chk->data->m_len = chk->send_size;
8463 chk->sent = SCTP_DATAGRAM_UNSENT;
8464 chk->snd_count = 0;
8465 chk->whoTo = net;
8466 chk->whoTo->ref_count++;
8467 ecne = mtod(chk->data, struct sctp_ecne_chunk *);
8472 TAILQ_INSERT_TAIL(&stcb->asoc.control_send_queue, chk, sctp_next);
8482 struct sctp_tmit_chunk *chk;
8496 chk = (struct sctp_tmit_chunk *)SCTP_ZONE_GET(sctppcbinfo.ipi_zone_chunk);
8497 if (chk == NULL) {
8510 len = chk->send_size = iph->ip_len;
8512 len = chk->send_size = (iph->ip_len - iphlen);
8518 len = chk->send_size = htons(ip6h->ip6_plen);
8522 chk->send_size = len = m->m_pkthdr.len - iphlen;
8524 chk->asoc = &stcb->asoc;
8525 MGETHDR(chk->data, M_DONTWAIT, MT_DATA);
8526 if (chk->data == NULL) {
8528 SCTP_ZONE_FREE(sctppcbinfo.ipi_zone_chunk, chk);
8536 if ((chk->send_size+sizeof(struct sctp_pktdrop_chunk)+SCTP_MIN_OVERHEAD) > MHLEN) {
8537 MCLGET(chk->data, M_DONTWAIT);
8538 if ((chk->data->m_flags & M_EXT) == 0) {
8540 sctp_m_freem(chk->data);
8541 chk->data = NULL;
8545 chk->data->m_data += SCTP_MIN_OVERHEAD;
8546 drp = mtod(chk->data, struct sctp_pktdrop_chunk *);
8548 sctp_m_freem(chk->data);
8549 chk->data = NULL;
8557 chk->book_size = (chk->send_size + sizeof(struct sctp_pktdrop_chunk) +
8559 if (chk->book_size > small_one) {
8561 drp->trunc_len = htons(chk->send_size);
8562 chk->send_size = small_one - (SCTP_MED_OVERHEAD +
8565 len = chk->send_size;
8574 chk->send_size += sizeof(struct sctp_pktdrop_chunk);
8575 chk->data->m_pkthdr.len = chk->data->m_len = chk->send_size;
8576 chk->sent = SCTP_DATAGRAM_UNSENT;
8577 chk->snd_count = 0;
8580 chk->whoTo = net;
8582 chk->whoTo = asoc->primary_destination;
8584 chk->whoTo->ref_count++;
8585 chk->rec.chunk_id = SCTP_PACKET_DROPPED;
8587 drp->ch.chunk_length = htons(chk->send_size);
8601 TAILQ_INSERT_TAIL(&stcb->asoc.control_send_queue, chk, sctp_next);
8610 struct sctp_tmit_chunk *chk;
8613 TAILQ_FOREACH(chk, &asoc->control_send_queue, sctp_next) {
8614 if (chk->rec.chunk_id == SCTP_ECN_CWR) {
8616 cwr = mtod(chk->data, struct sctp_cwr_chunk *);
8625 chk = (struct sctp_tmit_chunk *)SCTP_ZONE_GET(sctppcbinfo.ipi_zone_chunk);
8626 if (chk == NULL) {
8631 chk->rec.chunk_id = SCTP_ECN_CWR;
8632 chk->asoc = &stcb->asoc;
8633 chk->send_size = sizeof(struct sctp_cwr_chunk);
8634 MGETHDR(chk->data, M_DONTWAIT, MT_DATA);
8635 if (chk->data == NULL) {
8636 SCTP_ZONE_FREE(sctppcbinfo.ipi_zone_chunk, chk);
8644 chk->data->m_data += SCTP_MIN_OVERHEAD;
8645 chk->data->m_pkthdr.len = chk->data->m_len = chk->send_size;
8646 chk->sent = SCTP_DATAGRAM_UNSENT;
8647 chk->snd_count = 0;
8648 chk->whoTo = net;
8649 chk->whoTo->ref_count++;
8650 cwr = mtod(chk->data, struct sctp_cwr_chunk *);
8655 TAILQ_INSERT_TAIL(&stcb->asoc.control_send_queue, chk, sctp_next);
8686 struct sctp_tmit_chunk *chk;
8698 chk = (struct sctp_tmit_chunk *)SCTP_ZONE_GET(sctppcbinfo.ipi_zone_chunk);
8699 if (chk == NULL) {
8704 chk->rec.chunk_id = SCTP_STREAM_RESET;
8705 chk->asoc = &stcb->asoc;
8706 chk->send_size = sizeof(struct sctp_stream_reset_resp) + (number_entries * sizeof(uint16_t));
8707 MGETHDR(chk->data, M_DONTWAIT, MT_DATA);
8708 if (chk->data == NULL) {
8710 SCTP_ZONE_FREE(sctppcbinfo.ipi_zone_chunk, chk);
8718 chk->data->m_data += SCTP_MIN_OVERHEAD;
8719 chk->data->m_pkthdr.len = chk->data->m_len = SCTP_SIZE32(chk->send_size);
8720 if (M_TRAILINGSPACE(chk->data) < (int)SCTP_SIZE32(chk->send_size)) {
8721 MCLGET(chk->data, M_DONTWAIT);
8722 if ((chk->data->m_flags & M_EXT) == 0) {
8724 sctp_m_freem(chk->data);
8725 chk->data = NULL;
8728 chk->data->m_data += SCTP_MIN_OVERHEAD;
8730 if (M_TRAILINGSPACE(chk->data) < (int)SCTP_SIZE32(chk->send_size)) {
8733 sctp_m_freem(chk->data);
8734 chk->data = NULL;
8738 chk->sent = SCTP_DATAGRAM_UNSENT;
8739 chk->snd_count = 0;
8740 chk->whoTo = asoc->primary_destination;
8741 chk->whoTo->ref_count++;
8742 strack = mtod(chk->data, struct sctp_stream_reset_resp *);
8746 strack->ch.chunk_length = htons(chk->send_size);
8751 strack->sr_resp.ph.param_length = htons((chk->send_size - sizeof(struct sctp_chunkhdr)));
8755 if (chk->send_size % 4) {
8759 end = (uint8_t *)((vaddr_t)strack + chk->send_size);
8760 pad = chk->send_size % 4;
8764 chk->send_size += pad;
8811 chk,
8836 struct sctp_tmit_chunk *chk;
8852 chk = (struct sctp_tmit_chunk *)SCTP_ZONE_GET(sctppcbinfo.ipi_zone_chunk);
8853 if (chk == NULL) {
8858 chk->rec.chunk_id = SCTP_STREAM_RESET;
8859 chk->asoc = &stcb->asoc;
8860 chk->send_size = sizeof(struct sctp_stream_reset_req) + (number_entrys * sizeof(uint16_t));
8861 MGETHDR(chk->data, M_DONTWAIT, MT_DATA);
8862 if (chk->data == NULL) {
8864 SCTP_ZONE_FREE(sctppcbinfo.ipi_zone_chunk, chk);
8872 chk->data->m_data += SCTP_MIN_OVERHEAD;
8873 chk->data->m_pkthdr.len = chk->data->m_len = SCTP_SIZE32(chk->send_size);
8874 if (M_TRAILINGSPACE(chk->data) < (int)SCTP_SIZE32(chk->send_size)) {
8875 MCLGET(chk->data, M_DONTWAIT);
8876 if ((chk->data->m_flags & M_EXT) == 0) {
8878 sctp_m_freem(chk->data);
8879 chk->data = NULL;
8882 chk->data->m_data += SCTP_MIN_OVERHEAD;
8884 if (M_TRAILINGSPACE(chk->data) < (int)SCTP_SIZE32(chk->send_size)) {
8887 sctp_m_freem(chk->data);
8888 chk->data = NULL;
8891 chk->sent = SCTP_DATAGRAM_UNSENT;
8892 chk->snd_count = 0;
8893 chk->whoTo = asoc->primary_destination;
8894 chk->whoTo->ref_count++;
8896 strreq = mtod(chk->data, struct sctp_stream_reset_req *);
8899 strreq->ch.chunk_length = htons(chk->send_size);
8902 strreq->sr_req.ph.param_length = htons((chk->send_size - sizeof(struct sctp_chunkhdr)));
8904 if (chk->send_size % 4) {
8908 end = (uint8_t *)((vaddr_t)strreq + chk->send_size);
8909 pad = chk->send_size % 4;
8913 chk->send_size += pad;
8939 chk,
8942 sctp_timer_start(SCTP_TIMER_TYPE_STRRESET, stcb->sctp_ep, stcb, chk->whoTo);
9294 struct sctp_tmit_chunk *chk;
9302 chk = NULL;
9531 chk = (struct sctp_tmit_chunk *)SCTP_ZONE_GET(sctppcbinfo.ipi_zone_chunk);
9532 if (chk == NULL) {
9547 sctp_prepare_chunk(chk, stcb, srcv, strq, net);
9548 chk->mbcnt = mbcnt_e;
9552 chk->data = mm;
9556 chk->rec.data.rcv_flags |= SCTP_DATA_NOT_FRAG;
9557 chk->whoTo->ref_count++;
9560 chk->send_size = tot_out;
9561 chk->book_size = chk->send_size;
9567 if (chk->flags & SCTP_PR_SCTP_BUFFER) {
9581 TAILQ_INSERT_TAIL(&strq->outqueue, chk, sctp_next);
9593 SCTP_ZONE_FREE(sctppcbinfo.ipi_zone_chunk, chk);
9614 chk = (struct sctp_tmit_chunk *)SCTP_ZONE_GET(sctppcbinfo.ipi_zone_chunk);
9615 if (chk == NULL) {
9627 *chk = template;
9628 chk->whoTo->ref_count++;
9629 MGETHDR(chk->data, M_WAIT, MT_DATA);
9630 if (chk->data == NULL) {
9635 error = sctp_copy_one(chk->data, uio, tot_demand , resv_in_first, &mbcnt_e);
9638 /* now fix the chk->send_size */
9639 chk->mbcnt = mbcnt_e;
9642 chk->send_size = tot_demand;
9643 chk->data->m_pkthdr.len = tot_demand;
9644 chk->book_size = chk->send_size;
9645 if (chk->flags & SCTP_PR_SCTP_BUFFER) {
9648 TAILQ_INSERT_TAIL(&tmp, chk, sctp_next);
9659 chk = TAILQ_FIRST(&tmp);
9660 chk->rec.data.rcv_flags |= SCTP_DATA_FIRST_FRAG;
9661 chk = TAILQ_LAST(&tmp, sctpchunk_listhead);
9662 chk->rec.data.rcv_flags |= SCTP_DATA_LAST_FRAG;
9676 chk = TAILQ_FIRST(&tmp);
9677 while (chk) {
9678 chk->data->m_nextpkt = 0;
9679 TAILQ_REMOVE(&tmp, chk, sctp_next);
9681 TAILQ_INSERT_TAIL(&strq->outqueue, chk, sctp_next);
9682 chk = TAILQ_FIRST(&tmp);
9696 chk = TAILQ_FIRST(&tmp);
9697 while (chk) {
9698 sctp_m_freem(chk->data);
9699 chk->data = NULL;
9700 TAILQ_REMOVE(&tmp, chk, sctp_next);
9701 SCTP_ZONE_FREE(sctppcbinfo.ipi_zone_chunk, chk);
9708 chk = TAILQ_FIRST(&tmp);