Lines Matching +full:fail +full:- +full:fast

1 /*-
55 if (CC_ALGO(tp)->after_idle != NULL) in cc_after_idle()
56 CC_ALGO(tp)->after_idle(tp->ccv); in cc_after_idle()
80 int t = ((tp->t_srtt >> 2) + tp->t_rttvar) >> 1; in tcp_setpersist()
83 tp->t_flags &= ~TF_PREVVALID; in tcp_setpersist()
89 TCPT_RANGESET(tt, t * tcp_backoff[tp->t_rxtshift], in tcp_setpersist()
92 if (tp->t_rxtshift < TCP_MAXRXTSHIFT) in tcp_setpersist()
93 tp->t_rxtshift++; in tcp_setpersist()
134 if (IS_FASTOPEN(tp->t_flags) && in tcp_output()
135 ((tp->t_state == TCPS_SYN_SENT) || in tcp_output()
136 (tp->t_state == TCPS_SYN_RECEIVED)) && in tcp_output()
137 SEQ_GT(tp->snd_max, tp->snd_una) && /* initial SYN or SYN|ACK sent */ in tcp_output()
138 (tp->snd_nxt != tp->snd_una)) /* not a retransmit */ in tcp_output()
147 idle = (tp->t_flags & TF_LASTIDLE) || (tp->snd_max == tp->snd_una); in tcp_output()
148 if (idle && ticks - tp->t_rcvtime >= tp->t_rxtcur) in tcp_output()
151 tp->t_flags &= ~TF_LASTIDLE; in tcp_output()
153 if (tp->t_flags & TF_MORETOCOME) { in tcp_output()
154 tp->t_flags |= TF_LASTIDLE; in tcp_output()
160 …CP output %u %d %d", (unsigned int) tcplp_sys_get_millis(), (int) tp->snd_wnd, (int) tp->snd_cwnd); in tcp_output()
169 if ((tp->t_flags & TF_SACK_PERMIT) && in tcp_output()
170 SEQ_LT(tp->snd_nxt, tp->snd_max)) in tcp_output()
175 off = tp->snd_nxt - tp->snd_una; in tcp_output()
176 sendwin = min(tp->snd_wnd, tp->snd_cwnd); in tcp_output()
178 flags = tcp_outflags[tp->t_state]; in tcp_output()
180 * Send any SACK-generated retransmissions. If we're explicitly trying in tcp_output()
182 * If we retransmit in fast recovery mode, decrement snd_cwnd, since in tcp_output()
193 if ((tp->t_flags & TF_SACK_PERMIT) && IN_FASTRECOVERY(tp->t_flags) && in tcp_output()
197 cwin = min(tp->snd_wnd, tp->snd_cwnd) - sack_bytes_rxmt; in tcp_output()
201 if (SEQ_GT(p->end, tp->snd_recover)) { in tcp_output()
207 if (SEQ_GEQ(p->rxmit, tp->snd_recover)) { in tcp_output()
212 * moves past p->rxmit. in tcp_output()
219 tp->snd_recover - p->rxmit)); in tcp_output()
221 len = ((long)ulmin(cwin, p->end - p->rxmit)); in tcp_output()
222 off = p->rxmit - tp->snd_una; in tcp_output()
235 if (tp->t_flags & TF_NEEDFIN) in tcp_output()
237 if (tp->t_flags & TF_NEEDSYN) in tcp_output()
246 if (tp->t_flags & TF_FORCEDATA) { in tcp_output()
265 * samkumar: Replaced call to sbused(&so->so_snd) with the call to in tcp_output()
268 if (off < lbuf_used_space(&tp->sendbuf)) in tcp_output()
273 tp->t_rxtshift = 0; in tcp_output()
282 * acks after fast-retransmit because TCP will reset snd_nxt in tcp_output()
283 * to snd_max after the fast-retransmit. in tcp_output()
285 * In the normal retransmit-FIN-only case, however, snd_nxt will in tcp_output()
295 * samkumar: Replaced sbavail(&so->so_snd) with this call to in tcp_output()
298 len = ((long)ulmin(lbuf_used_space(&tp->sendbuf), sendwin) - in tcp_output()
309 * samkumar: Replaced sbavail(&so->so_snd) with this call to in tcp_output()
312 len = ((long)ulmin(lbuf_used_space(&tp->sendbuf), tp->snd_wnd) - in tcp_output()
318 * optimization issue - to force gcc to compute in tcp_output()
323 cwin = tp->snd_cwnd - in tcp_output()
324 (tp->snd_nxt - tp->sack_newdata) - in tcp_output()
335 * is SYN-SENT state and if segment contains data and if we don't in tcp_output()
338 if ((flags & TH_SYN) && SEQ_GT(tp->snd_nxt, tp->snd_una)) { in tcp_output()
339 if (tp->t_state != TCPS_SYN_RECEIVED) in tcp_output()
345 if (IS_FASTOPEN(tp->t_flags) && in tcp_output()
346 (tp->t_state == TCPS_SYN_RECEIVED)) in tcp_output()
348 off--, len++; in tcp_output()
356 if ((flags & TH_SYN) && (tp->t_flags & TF_NOOPT)) { in tcp_output()
364 * - When retransmitting SYN|ACK on a passively-created socket in tcp_output()
366 * - When retransmitting SYN on an actively created socket in tcp_output()
368 * - When sending a zero-length cookie (cookie request) on an in tcp_output()
371 * - When the socket is in the CLOSED state (RST is being sent) in tcp_output()
378 if (IS_FASTOPEN(tp->t_flags) && in tcp_output()
379 (((flags & TH_SYN) && (tp->t_rxtshift > 0)) || in tcp_output()
380 /*((tp->t_state == TCPS_SYN_SENT) && in tcp_output()
381 (tp->t_tfo_client_cookie_len == 0)) ||*/ in tcp_output()
397 * to send, but a 0-byte window. This makes sure in tcp_output()
403 * samkumar: Replaced sbavail(&so->so_snd) with this call to in tcp_output()
406 if ((sendwin == 0) && (TCPS_HAVEESTABLISHED(tp->t_state)) && in tcp_output()
407 (off < (int) lbuf_used_space(&tp->sendbuf))) { in tcp_output()
409 tp->t_rxtshift = 0; in tcp_output()
410 tp->snd_nxt = tp->snd_una; in tcp_output()
426 * delay (eg. trans-continental/oceanic links). Setting the in tcp_output()
444 * and does at most one step per received ACK. This fast in tcp_output()
449 * of available bandwith (the non-use of it) for wasting some in tcp_output()
461 * this, as the send buffer doesn't have a well-defined size (and even if in tcp_output()
462 * we were to use a circular buffer, it would be a fixed-size buffer in tcp_output()
474 * samkumar: Replaced sbused(&so->so_snd) with this call to in tcp_output()
477 if (SEQ_LT(p->rxmit + len, tp->snd_una + lbuf_used_space(&tp->sendbuf))) in tcp_output()
480 if (SEQ_LT(tp->snd_nxt + len, tp->snd_una + in tcp_output()
482 * samkumar: Replaced sbused(&so->so_snd) with this call to in tcp_output()
485 lbuf_used_space(&tp->sendbuf))) in tcp_output()
490 * samkumar: Replaced sbspace(&so->so_rcv) with this call to in tcp_output()
493 recwin = cbuf_free_space(&tp->recvbuf); in tcp_output()
497 * conditions when len is non-zero: in tcp_output()
499 * - We have a full segment (or more with TSO) in tcp_output()
500 * - This is the last buffer in a write()/send() and we are in tcp_output()
502 * - we've timed out (e.g. persist timer) in tcp_output()
503 * - we have more then 1/2 the maximum send window's worth of in tcp_output()
505 * - we need to retransmit in tcp_output()
508 if (len >= tp->t_maxseg) in tcp_output()
518 * samkumar: Replaced sbavail(&so->so_snd) with this call to in tcp_output()
521 if (!(tp->t_flags & TF_MORETOCOME) && /* normal case */ in tcp_output()
522 (idle || (tp->t_flags & TF_NODELAY)) && in tcp_output()
523 len + off >= lbuf_used_space(&tp->sendbuf) && in tcp_output()
524 (tp->t_flags & TF_NOPUSH) == 0) { in tcp_output()
527 if (tp->t_flags & TF_FORCEDATA) /* typ. timeout case */ in tcp_output()
529 if (len >= tp->max_sndwnd / 2 && tp->max_sndwnd > 0) in tcp_output()
531 if (SEQ_LT(tp->snd_nxt, tp->snd_max)) /* retransmit case */ in tcp_output()
561 * ACK is pending (it will get piggy-backed on it) or the in tcp_output()
562 * remote side already has done a half-close and won't send in tcp_output()
564 * half-open state. in tcp_output()
566 if (recwin > 0 && !(tp->t_flags & TF_NEEDSYN) && in tcp_output()
567 !(tp->t_flags & TF_DELACK) && in tcp_output()
568 !TCPS_HAVERCVDFIN(tp->t_state)) { in tcp_output()
572 * TCP_MAXWIN << tp->rcv_scale. in tcp_output()
577 adv = min(recwin, (long)TCP_MAXWIN << tp->rcv_scale); in tcp_output()
578 if (SEQ_GT(tp->rcv_adv, tp->rcv_nxt)) { in tcp_output()
579 oldwin = (tp->rcv_adv - tp->rcv_nxt); in tcp_output()
580 adv -= oldwin; in tcp_output()
588 if (oldwin >> tp->rcv_scale == (adv + oldwin) >> tp->rcv_scale) in tcp_output()
605 * (checking if adv >= (long)(2 * tp->t_maxseg)) wasn't included; this in tcp_output()
614 * note that so->so_rcv.sb_hiwat in FreeBSD corresponds roughly to in tcp_output()
615 * cbuf_size(&tp->recvbuf) in TCPlp. in tcp_output()
618 if (adv >= (long)(2 * tp->t_maxseg) && in tcp_output()
619 (adv >= (long)(so->so_rcv.sb_hiwat / 4) || in tcp_output()
620 recwin <= (long)(so->so_rcv.sb_hiwat / 8) || in tcp_output()
621 so->so_rcv.sb_hiwat <= 8 * tp->t_maxseg)) in tcp_output()
624 if (adv >= (long)(2 * tp->t_maxseg) || in tcp_output()
625 adv >= (long)cbuf_size(&tp->recvbuf) / 4) in tcp_output()
632 * is also a catch-all for the retransmit timer timeout case. in tcp_output()
634 if (tp->t_flags & TF_ACKNOW) { in tcp_output()
638 ((flags & TH_SYN) && (tp->t_flags & TF_NEEDSYN) == 0)) in tcp_output()
640 if (SEQ_GT(tp->snd_up, tp->snd_una)) in tcp_output()
647 ((tp->t_flags & TF_SENTFIN) == 0 || tp->snd_nxt == tp->snd_una)) in tcp_output()
650 * In SACK, it is possible for tcp_output to fail to send a segment in tcp_output()
654 if ((tp->t_flags & TF_SACK_PERMIT) && in tcp_output()
655 SEQ_GT(tp->snd_max, tp->snd_una) && in tcp_output()
658 tcp_timer_activate(tp, TT_REXMT, tp->t_rxtcur); in tcp_output()
672 * (tp->t_flags & TF_FORCEDATA) in tcp_output()
685 * samkumar: Replaced sbavail(&so->so_snd) with this call to in tcp_output()
688 if (lbuf_used_space(&tp->sendbuf) && !tcp_timer_active(tp, TT_REXMT) && in tcp_output()
690 tp->t_rxtshift = 0; in tcp_output()
702 if (len >= tp->t_maxseg) in tcp_output()
703 tp->t_flags2 |= TF2_PLPMTU_MAXSEGSNT; in tcp_output()
705 tp->t_flags2 &= ~TF2_PLPMTU_MAXSEGSNT; in tcp_output()
721 * segments. Options for SYN-ACK segments are handled in TCP in tcp_output()
726 * seems that the existing logic works fine for SYN-ACK as in tcp_output()
730 if ((tp->t_flags & TF_NOOPT) == 0) { in tcp_output()
733 tp->snd_nxt = tp->iss; in tcp_output()
744 if (IS_FASTOPEN(tp->t_flags) && in tcp_output()
745 (tp->t_rxtshift == 0)) { in tcp_output()
746 if (tp->t_state == TCPS_SYN_RECEIVED) { in tcp_output()
749 (u_int8_t *)&tp->t_tfo_cookie.server; in tcp_output()
752 } else if (tp->t_state == TCPS_SYN_SENT) { in tcp_output()
754 tp->t_tfo_client_cookie_len; in tcp_output()
756 tp->t_tfo_cookie.client; in tcp_output()
771 if ((flags & TH_SYN) && (tp->t_flags & TF_REQ_SCALE)) { in tcp_output()
772 to.to_wscale = tp->request_r_scale; in tcp_output()
776 if ((tp->t_flags & TF_RCVD_TSTMP) || in tcp_output()
777 ((flags & TH_SYN) && (tp->t_flags & TF_REQ_TSTMP))) { in tcp_output()
778 to.to_tsval = tcp_ts_getticks() + tp->ts_offset; in tcp_output()
779 to.to_tsecr = tp->ts_recent; in tcp_output()
782 * samkumar: I removed the code to set the timestamp tp->rfbuf_ts in tcp_output()
789 if (tp->t_flags & TF_SACK_PERMIT) { in tcp_output()
792 else if (TCPS_HAVEESTABLISHED(tp->t_state) && in tcp_output()
793 (tp->t_flags & TF_SACK_PERMIT) && in tcp_output()
794 tp->rcv_numsacks > 0) { in tcp_output()
796 to.to_nsacks = tp->rcv_numsacks; in tcp_output()
797 to.to_sacks = (uint8_t *)tp->sackblks; in tcp_output()
812 if (IS_FASTOPEN(tp->t_flags) && wanted_cookie && in tcp_output()
817 * samkumar: This used to be set to ip6_optlen(tp->t_inpcb), instead of 0, in tcp_output()
830 if (len + optlen + ipoptlen > tp->t_maxopd) { in tcp_output()
835 len = tp->t_maxopd - optlen - ipoptlen; in tcp_output()
869 if ((tp->t_flags & TF_FORCEDATA) && len == 1) in tcp_output()
871 else if (SEQ_LT(tp->snd_nxt, tp->snd_max) || sack_rxmit) { in tcp_output()
872 tp->t_sndrexmitpack++; in tcp_output()
887 SOCKBUF_UNLOCK(&so->so_snd); in tcp_output()
893 m->m_data += max_linkhdr; in tcp_output()
894 m->m_len = hdrlen; in tcp_output()
900 mb = sbsndptr(&so->so_snd, off, len, &moff); in tcp_output()
902 if (len <= MHLEN - hdrlen - max_linkhdr) { in tcp_output()
905 m->m_len += len; in tcp_output()
907 m->m_next = m_copy(mb, moff, (int)len); in tcp_output()
908 if (m->m_next == NULL) { in tcp_output()
909 SOCKBUF_UNLOCK(&so->so_snd); in tcp_output()
923 if (off + len == sbused(&so->so_snd)) in tcp_output()
925 SOCKBUF_UNLOCK(&so->so_snd); in tcp_output()
927 SOCKBUF_UNLOCK(&so->so_snd); in tcp_output()
928 if (tp->t_flags & TF_ACKNOW) in tcp_output()
932 else if (SEQ_GT(tp->snd_up, tp->snd_una)) in tcp_output()
949 m->m_data += max_linkhdr; in tcp_output()
950 m->m_len = hdrlen; in tcp_output()
956 otMessage* message = tcplp_sys_new_message(tp->instance); in tcp_output()
963 tcplp_sys_free_message(tp->instance, message); in tcp_output()
969 uint32_t used_space = lbuf_used_space(&tp->sendbuf); in tcp_output()
989 int rv = lbuf_getrange(&tp->sendbuf, off, len, &start, &start_offset, &end, &end_offset); in tcp_output()
992 for (curr = start; curr != end->mNext; curr = curr->mNext) { in tcp_output()
993 const uint8_t* data_to_copy = curr->mData; in tcp_output()
994 size_t length_to_copy = curr->mLength; in tcp_output()
997 length_to_copy -= start_offset; in tcp_output()
1000 length_to_copy -= end_offset; in tcp_output()
1013 /* samkumar: Replaced call to sbused(&so->so_snd) with used_space. */ in tcp_output()
1033 if (flags & TH_FIN && tp->t_flags & TF_SENTFIN && in tcp_output()
1034 tp->snd_nxt == tp->snd_max) in tcp_output()
1035 tp->snd_nxt--; in tcp_output()
1042 if (tp->t_state == TCPS_SYN_SENT && V_tcp_do_ecn) { in tcp_output()
1043 if (tp->t_rxtshift >= 1) { in tcp_output()
1044 if (tp->t_rxtshift <= V_tcp_ecn_maxretries) in tcp_output()
1051 * samkumar: Make tcp_output reply with ECE flag in the SYN-ACK for in tcp_output()
1052 * ECN-enabled connections. The existing code in FreeBSD didn't have to do in tcp_output()
1053 * this, because it didn't use tcp_output to send the SYN-ACK; it in tcp_output()
1054 * constructed the SYN-ACK segment manually. Yet another consequnce of in tcp_output()
1057 if (tp->t_state == TCPS_SYN_RECEIVED && tp->t_flags & TF_ECN_PERMIT && in tcp_output()
1062 if (tp->t_state == TCPS_ESTABLISHED && in tcp_output()
1063 (tp->t_flags & TF_ECN_PERMIT)) { in tcp_output()
1069 if (len > 0 && SEQ_GEQ(tp->snd_nxt, tp->snd_max) && in tcp_output()
1070 !((tp->t_flags & TF_FORCEDATA) && len == 1)) { in tcp_output()
1072 * samkumar: Replaced ip6->ip6_flow |= htonl(IPTOS_ECN_ECT0 << 20); in tcp_output()
1082 if (tp->t_flags & TF_ECN_SND_CWR) { in tcp_output()
1084 tp->t_flags &= ~TF_ECN_SND_CWR; in tcp_output()
1086 if (tp->t_flags & TF_ECN_SND_ECE) in tcp_output()
1106 th->th_seq = htonl(tp->snd_nxt); in tcp_output()
1108 th->th_seq = htonl(tp->snd_max); in tcp_output()
1110 th->th_seq = htonl(p->rxmit); in tcp_output()
1111 p->rxmit += len; in tcp_output()
1112 tp->sackhint.sack_bytes_rexmit += len; in tcp_output()
1122 if (len > 0 && !tcp_timer_active(tp, TT_PERSIST) && SEQ_LT(ntohl(th->th_seq), tp->snd_max)) { in tcp_output()
1127 th->th_ack = htonl(tp->rcv_nxt); in tcp_output()
1130 th->th_off_x2 = ((sizeof (struct tcphdr) + optlen) >> 2) << TH_OFF_SHIFT; in tcp_output()
1132 th->th_flags = flags; in tcp_output()
1137 /* samkumar: Replaced so->so_rcv.sb_hiwat with this call to cbuf_size. */ in tcp_output()
1138 if (recwin < (long)(cbuf_size(&tp->recvbuf) / 4) && in tcp_output()
1139 recwin < (long)tp->t_maxseg) in tcp_output()
1141 if (SEQ_GT(tp->rcv_adv, tp->rcv_nxt) && in tcp_output()
1142 recwin < (long)(tp->rcv_adv - tp->rcv_nxt)) in tcp_output()
1143 recwin = (long)(tp->rcv_adv - tp->rcv_nxt); in tcp_output()
1144 if (recwin > (long)TCP_MAXWIN << tp->rcv_scale) in tcp_output()
1145 recwin = (long)TCP_MAXWIN << tp->rcv_scale; in tcp_output()
1153 th->th_win = htons((uint16_t) in tcp_output()
1154 (min(cbuf_size(&tp->recvbuf), TCP_MAXWIN))); in tcp_output()
1156 th->th_win = htons((uint16_t)(recwin >> tp->rcv_scale)); in tcp_output()
1159 * Adjust the RXWIN0SENT flag - indicate that we have advertised in tcp_output()
1166 if (th->th_win == 0) { in tcp_output()
1167 tp->t_flags |= TF_RXWIN0SENT; in tcp_output()
1169 tp->t_flags &= ~TF_RXWIN0SENT; in tcp_output()
1170 if (SEQ_GT(tp->snd_up, tp->snd_nxt)) { in tcp_output()
1171 th->th_urp = htons((uint16_t)(tp->snd_up - tp->snd_nxt)); in tcp_output()
1172 th->th_flags |= TH_URG; in tcp_output()
1180 tp->snd_up = tp->snd_una; /* drag it along */ in tcp_output()
1197 /* samkumar: Removed mbuf-specific assertions an debug code. */ in tcp_output()
1205 * m->m_pkthdr.len should have been set before checksum calculation, in tcp_output()
1215 tcplp_sys_send_message(tp->instance, message, &ip6info); in tcp_output()
1222 if ((tp->t_flags & TF_FORCEDATA) == 0 || in tcp_output()
1224 tcp_seq startseq = tp->snd_nxt; in tcp_output()
1231 tp->snd_nxt++; in tcp_output()
1233 tp->snd_nxt++; in tcp_output()
1234 tp->t_flags |= TF_SENTFIN; in tcp_output()
1239 tp->snd_nxt += len; in tcp_output()
1240 if (SEQ_GT(tp->snd_nxt, tp->snd_max)) { in tcp_output()
1241 tp->snd_max = tp->snd_nxt; in tcp_output()
1246 if (tp->t_rtttime == 0) { in tcp_output()
1247 tp->t_rtttime = ticks; in tcp_output()
1248 tp->t_rtseq = startseq; in tcp_output()
1254 * and not doing a pure ack or a keep-alive probe. in tcp_output()
1256 * round-trip time + 2 * round-trip time variance. in tcp_output()
1262 ((sack_rxmit && tp->snd_nxt != tp->snd_max) || in tcp_output()
1263 (tp->snd_nxt != tp->snd_una))) { in tcp_output()
1266 tp->t_rxtshift = 0; in tcp_output()
1268 tcp_timer_activate(tp, TT_REXMT, tp->t_rxtcur); in tcp_output()
1270 * samkumar: Replaced sbavail(&so->so_snd) with this call to in tcp_output()
1273 } else if (len == 0 && lbuf_used_space(&tp->sendbuf) && in tcp_output()
1279 * 1) A -> B: packet with enough data to fill the window in tcp_output()
1280 * 2) B -> A: ACK for #1 + new data (0 window in tcp_output()
1282 * 3) A -> B: ACK for #2, 0 len packet in tcp_output()
1290 * So, if you send a 0-length packet, but there is data in tcp_output()
1295 tp->t_rxtshift = 0; in tcp_output()
1308 tp->t_flags |= TF_SENTFIN; in tcp_output()
1310 if (SEQ_GT(tp->snd_nxt + xlen, tp->snd_max)) in tcp_output()
1311 tp->snd_max = tp->snd_nxt + len; in tcp_output()
1329 if (((tp->t_flags & TF_FORCEDATA) == 0 || in tcp_output()
1334 p->rxmit -= len; in tcp_output()
1335 tp->sackhint.sack_bytes_rexmit -= len; in tcp_output()
1336 KASSERT(tp->sackhint.sack_bytes_rexmit >= 0, in tcp_output()
1339 tp->snd_nxt -= len; in tcp_output()
1343 tp->t_softerror = error; in tcp_output()
1348 tcp_timer_activate(tp, TT_REXMT, tp->t_rxtcur); in tcp_output()
1349 tp->snd_cwnd = tp->t_maxseg; in tcp_output()
1351 tcplp_sys_log("TCP ALLOCFAIL %u %d", (unsigned int) tcplp_sys_get_millis(), (int) tp->snd_cwnd); in tcp_output()
1366 tcp_mss_update(tp, -1, mtu, NULL, NULL); in tcp_output()
1374 if (TCPS_HAVERCVDSYN(tp->t_state)) { in tcp_output()
1375 tp->t_softerror = error; in tcp_output()
1390 if (recwin >= 0 && SEQ_GT(tp->rcv_nxt + recwin, tp->rcv_adv)) in tcp_output()
1391 tp->rcv_adv = tp->rcv_nxt + recwin; in tcp_output()
1392 tp->last_ack_sent = tp->rcv_nxt; in tcp_output()
1393 tp->t_flags &= ~(TF_ACKNOW | TF_DELACK); in tcp_output()
1404 * is that if delayed-acks are turned on on the receiver, this code in tcp_output()
1408 if (sendalot && --maxburst) in tcp_output()
1423 * The optimal order for a SYN/SYN-ACK segment is:
1431 * we only have 10 bytes for SACK options (40 - (12 + 18)).
1439 if ((to->to_flags & mask) != mask) in tcp_addoptions()
1443 switch (to->to_flags & mask) { in tcp_addoptions()
1449 if (TCP_MAXOLEN - optlen < TCPOLEN_MAXSEG) in tcp_addoptions()
1454 to->to_mss = htons(to->to_mss); in tcp_addoptions()
1455 bcopy((uint8_t *)&to->to_mss, optp, sizeof(to->to_mss)); in tcp_addoptions()
1456 optp += sizeof(to->to_mss); in tcp_addoptions()
1463 if (TCP_MAXOLEN - optlen < TCPOLEN_WINDOW) in tcp_addoptions()
1468 *optp++ = to->to_wscale; in tcp_addoptions()
1475 if (TCP_MAXOLEN - optlen < TCPOLEN_SACK_PERMITTED) in tcp_addoptions()
1486 if (TCP_MAXOLEN - optlen < TCPOLEN_TIMESTAMP) in tcp_addoptions()
1491 to->to_tsval = htonl(to->to_tsval); in tcp_addoptions()
1492 to->to_tsecr = htonl(to->to_tsecr); in tcp_addoptions()
1493 bcopy((uint8_t *)&to->to_tsval, optp, sizeof(to->to_tsval)); in tcp_addoptions()
1494 optp += sizeof(to->to_tsval); in tcp_addoptions()
1495 bcopy((uint8_t *)&to->to_tsecr, optp, sizeof(to->to_tsecr)); in tcp_addoptions()
1496 optp += sizeof(to->to_tsecr); in tcp_addoptions()
1500 int siglen = TCPOLEN_SIGNATURE - 2; in tcp_addoptions()
1506 if (TCP_MAXOLEN - optlen < TCPOLEN_SIGNATURE) in tcp_addoptions()
1511 to->to_signature = optp; in tcp_addoptions()
1512 while (siglen--) in tcp_addoptions()
1519 struct sackblk *sack = (struct sackblk *)to->to_sacks; in tcp_addoptions()
1526 if (TCP_MAXOLEN - optlen < TCPOLEN_SACKHDR + TCPOLEN_SACK) in tcp_addoptions()
1530 sackblks = min(to->to_nsacks, in tcp_addoptions()
1531 (TCP_MAXOLEN - optlen) / TCPOLEN_SACK); in tcp_addoptions()
1533 while (sackblks--) { in tcp_addoptions()
1534 sack_seq = htonl(sack->start); in tcp_addoptions()
1537 sack_seq = htonl(sack->end); in tcp_addoptions()
1551 total_len = TCPOLEN_FAST_OPEN_EMPTY + to->to_tfo_len; in tcp_addoptions()
1552 if (TCP_MAXOLEN - optlen < total_len) { in tcp_addoptions()
1553 to->to_flags &= ~TOF_FASTOPEN; in tcp_addoptions()
1558 if (to->to_tfo_len > 0) { in tcp_addoptions()
1559 bcopy(to->to_tfo_cookie, optp, to->to_tfo_len); in tcp_addoptions()
1560 optp += to->to_tfo_len; in tcp_addoptions()
1578 * "The content of the header beyond the End-of-Option option in tcp_addoptions()