Lines Matching defs:to

7  * as defined in and that are subject to the Apple Public Source License
9 * compliance with the License. The rights granted to you under the License
10 * may not be used to create, or enable the creation or redistribution of,
11 * unlawful or unlicensed copies of an Apple operating system, or to
45 * may be used to endorse or promote products derived from this software
64 * NOTICE: This file was modified by SPARTA, Inc. in 2005 to introduce
167 "Delay ACK to try and piggyback it onto a data packet");
246 &sw_lro, 0, "Used to coalesce TCP packets");
250 &lrodebug, 0, "Used to debug SW LRO");
270 * to accommodate an application reading slowly. When the amount of
284 lck_spin_t *tcp_uptime_lock; /* Used to sychronize updates to tcp_now */
310 struct tcpopt *to, u_int32_t tlen);
342 if ( (log_in_vain == 3 ) && (fw_verbose == 2)) { /* Apple logging, log to ipfw.log */ \
355 &tcp_rcvsspktcnt, 0, "packets to be seen before receiver stretches acks");
424 * receive window to a minimum of MIN_IAJ_WIN packets
446 * is used to quietly gloss over the first few packets.
527 * Call with th==0 after become established to
528 * force pre-ESTABLISHED data up to user socket.
533 /* If the reassembly queue already has entries or if we are going to add
540 /* When the connection reaches a loss state, we need to send more acks
555 * Limit the number of segments in the reassembly queue to prevent
556 * holding on to too many segments (and thus running out of mbufs).
557 * Make sure to let the missing segment through which caused this
558 * queue. Always keep one global queue entry spare to be able to
595 /* conversion to int (in i) handles seq wraparound */
611 * Try to present any queued data
612 * at the left window edge to the user.
668 * Present data to user, advancing rcv_nxt through
740 * defined a hook for tasks to run
774 * draft-itojun-ipv6-tcp-to-anycast
775 * better place to put this in?
805 * will return true or false. This is used to determine if a socket
861 * This function is used to grow a receive socket buffer. It
863 * bandwidth available on the link to make a decision.
867 struct tcpopt *to, u_int32_t pktlen) {
889 * If the connection reached a state to indicate that
890 * the receive socket buffer needs to grow, increase
904 } else if (to->to_tsecr != 0) {
911 * than half of sb_hiwat, this will help to scale the
912 * buffer according to the bandwidth on the link.
915 * will help to accommodate an application reading slowly.
917 if (TSTMP_GEQ(to->to_tsecr, tp->rfbuf_ts)) {
931 * socket buffer to be twice the bandwidth delay
952 /* This function will trim the excess space added to the socket buffer
953 * to help a slow-reading app. The ideal-size of a socket buffer depends
954 * on the link bandwidth or it is set by an application and we aim to
972 * 2. if possible, leave 1/16 of bandwidth*delay to
991 /* We may need to trim the send socket buffer size for two reasons:
993 * want to fill the buffers any more.
995 * to hold more mbufs for that connection than what the cwnd will allow.
1021 * resizing, just give more space to the receive socket buffer.
1037 * to see if it can reduce ack traffic. The receiver will start
1039 * 1. tcp_delack_enabled is set to 3
1043 * 4. If the connection has seen enough packets to let the slow-start
1052 * tcp_rcvsspktcnt to cover slow-start and tcp_maxrcvidle to identify idle
1067 /* Reset the state related to stretch-ack algorithm. This will make
1069 * will start re-evaluating the rate at which packets come to decide
1104 struct tcpopt to; /* options in this segment */
1127 /* Grab info from PACKET_TAG_IPFORWARD tag prepended to the chain. */
1153 bzero((char *)&to, sizeof(to));
1209 * As we use all-zero to indicate unbounded/unconnected pcb,
1210 * unspecified IPv6 address can be used to confuse us.
1372 to.to_flags |= TOF_TS;
1373 to.to_tsval = ntohl(*(u_int32_t *)(void *)(optp + 4));
1374 to.to_tsecr = ntohl(*(u_int32_t *)(void *)(optp + 8));
1401 * Because ip6_savecontrol() is going to parse the mbuf to
1402 * search for data to be passed up to user-land, it wants mbuf
1403 * parameters to be unchanged.
1415 * hint about which route and interface to use for sending in the
1425 * Convert TCP protocol specific fields to host format.
1450 * Diverted. Pretend to be the destination.
1495 * If the PCB is present and the socket isn't allowed to use
1558 "Connection attempt to TCP %s:%d from %s:%d\n",
1565 "Connection attempt to TCP %s:%d from %s:%d flags:0x%x\n",
1580 "Stealth Mode connection attempt to TCP %s:%d from %s:%d\n",
1613 * if inp_state isn't set to INPCB_STATE_DEAD
1683 /* Get listener's bound-to-interface, if any */
1755 * we do not accept SYN to deprecated interface
1756 * address to prevent any new inbound connection from
1761 * to send a RST, and RST will be the final packet
1769 * communication is okay - "SHOULD continue to be
1843 /* Point "inp" and "tp" in tandem to new socket */
1854 * committed to keeping it. The code at
1856 * flag dropsocket to see if the temporary
1859 * we're committed to it below in TCPS_LISTEN.
1861 * have to drop the temporary socket.
1867 * can only be set to a non-zero value earlier if
1903 * Undo the assignments above if we failed to
1924 * previously received options and is used to
1927 * to a user.
1929 * not be able to receive options just after
1947 /* Is it a security hole here to silently fail to copy the policy? */
1987 * a wakeup to the process connected to our socket). We can reasonable
1988 * expect this to be small packet DoS attack to exhaust our CPU
1991 * Care has to be taken for the minimum packet overload value. This
1993 * start to worry. This must not be too low to avoid killing for
1997 * Setting either tcp_minmssoverload or tcp_minmss to "0" disables
2009 * Setting either tcp_minmssoverload or tcp_minmss to "0" disables
2038 /* Evaluate the rate of arrival of packets to see if the
2039 * receiver can reduce the ack traffic. The algorithm to
2068 Explicit Congestion Notification - Flag that we need to send ECT if
2101 * Try to determine if we are receiving a packet after a long time.
2102 * Use our own approximation of idletime to roughly measure remote
2104 * we want to avoid doing LRO if the remote end is not up to date
2125 tcp_dooptions(tp, optp, optlen, th, &to, ifscope);
2128 if (to.to_flags & TOF_SCALE) {
2130 tp->requested_s_scale = to.to_requested_s_scale;
2134 if (to.to_flags & TOF_TS) {
2136 tp->ts_recent = to.to_tsval;
2139 if (to.to_flags & TOF_MSS)
2140 tcp_mss(tp, to.to_mss, ifscope);
2142 if (!(to.to_flags & TOF_SACK))
2150 /* Compute inter-packet arrival jitter. According to RFC 3550, inter-packet
2152 * receiver compared to the sender for a pair of packets. When two packets
2155 * sender and use them as a pair to compute inter-packet arrival jitter.
2157 * to queuing in edge/access routers.
2162 ((to.to_flags & TOF_TS) == 0 ||
2163 TSTMP_GEQ(to.to_tsval, tp->ts_recent)) &&
2176 /* State related to inter-arrival jitter is uninitialized
2177 * or we are trying to find a good first packet to start
2194 * we try to learn the iaj_size again.
2222 * (the reassembly queue is empty), add the data to
2231 ((to.to_flags & TOF_TS) == 0 ||
2232 TSTMP_GEQ(to.to_tsval, tp->ts_recent)) &&
2240 * NOTE that the test is modified according to the latest
2243 if ((to.to_flags & TOF_TS) != 0 &&
2246 tp->ts_recent = to.to_tsval;
2260 (tp->sack_enable && to.to_nsacks == 0 &&
2295 if (((to.to_flags & TOF_TS) != 0) && (to.to_tsecr != 0) &&
2296 TSTMP_GEQ(tcp_now, to.to_tsecr)) {
2298 tcp_now - to.to_tsecr);
2327 * pull snd_wl2 up to prevent seq wrap relative
2328 * to th_ack.
2341 * are ready to send, let tcp_output
2352 sowwakeup(so); /* has to be done with socket lock held */
2368 * we have enough buffer space to take it.
2373 * coalescing packets belonging to this flow.
2401 * Pull snd_wl1 up to prevent seq wrap relative to
2406 * Pull rcv_up up to prevent seq wrap relative to
2423 tcp_sbrcv_grow(tp, &so->so_rcv, &to, tlen);
2426 * Add data to socket buffer.
2476 else { /* clip rcv window to 4K for modems */
2489 * Also initialize tp->snd_nxt to tp->iss+1 and tp->snd_una to tp->iss.
2546 tcp_dooptions(tp, optp, optlen, th, &to, ifscope);
2549 if (!(to.to_flags & TOF_SACK))
2577 dropsocket = 0; /* committed to socket */
2625 * if SYN has been acked change to ESTABLISHED else SYN_RCVD state
2626 * arrange for segment to be acked (eventually)
2737 * Advance th->th_seq to correspond to first data byte.
2738 * If data, trim to stay within window,
2754 * If the remote host used T/TCP to validate the SYN,
2766 * NB: Leftover from RFC1644 T/TCP. Cases to be reused later.
2790 * to fall though and be processed (which gives forged reset
2800 * If the RST bit is set, check the sequence number to see
2811 * of our receive window, and we have to handle this case.
2815 * only accepting RSTs where the sequence number is equal to
2819 * segment sequence numbers will be to the left of last_ack_sent,
2821 * In any case, it never made sense to trim reset segments to
2825 * A TCP SHOULD allow a received RST segment to include data.
2836 * If passive open, return to LISTEN state.
2907 if ((to.to_flags & TOF_TS) != 0 && tp->ts_recent &&
2908 TSTMP_LT(to.to_tsval, tp->ts_recent)) {
2910 /* Check to see if ts_recent is over 24 days old. */
2916 * ts_recent to zero will at least satisfy the
2920 * because we don't want out-of-order segments to be
2941 * In the SYN-RECEIVED state, validate that the packet belongs to
2942 * this connection before trimming the data to fit the receive
2973 * Any valid FIN must be to the left of the window.
2980 * Send an ACK to resynchronize and drop any data.
3054 * window edge, and have to drop data and PUSH from
3056 * remember to ack. Otherwise, drop segment
3080 * 3) That we modify the segment boundary check to be
3084 * This modified check allows us to overcome RFC1323's
3089 if ((to.to_flags & TOF_TS) != 0 &&
3094 tp->ts_recent = to.to_tsval;
3171 * later; if not, do so now to pass queued data to user.
3186 * then advance tp->snd_una to th->th_ack and drop
3188 * more up to date window information we update our window information.
3202 (to.to_nsacks > 0 || !TAILQ_EMPTY(&tp->snd_holes)))
3203 tcp_sack_doack(tp, &to, th->th_ack);
3221 * (set ssthresh to half the current window
3222 * and pull our congestion window back to
3228 * to keep a constant cwnd packets in the
3265 * If we're doing sack, check to
3268 * check to see if we're in newreno
3286 * defined a hook for tasks to run
3327 * If the congestion window was inflated to account
3367 * synchronized). Go to non-starred state,
3389 * to do the retransmit in the first place. Recover our
3390 * original cwnd and ssthresh, and proceed to transmit where
3427 if (((to.to_flags & TOF_TS) != 0) && (to.to_tsecr != 0) &&
3428 TSTMP_GEQ(tcp_now, to.to_tsecr)) {
3429 tcp_xmit_timer(tp, tcp_now - to.to_tsecr);
3436 * timer and remember to restart (more output or persist).
3437 * If there is more data to be acked, restart retransmit
3469 * The specifics of how this is achieved are up to the
3523 * In FIN_WAIT_1 STATE in addition to the processing
3532 * Starting the timer is contrary to the
3550 * In CLOSING STATE in addition to the processing for
3574 * In LAST_ACK, we may still be waiting for data to drain
3575 * and/or to be acked, as well as for the ack of our FIN.
3626 * soreceive. It's hard to imagine someone
3627 * actually wanting to send this much urgent data.
3641 * According to RFC961 (Assigned Protocols),
3642 * the urgent pointer points to the last octet
3644 * to consider it to indicate the first octet
3660 * Remove out of band data so doesn't get presented to user.
3693 /* Let's check the state of pcb just to make sure that it did not get closed
3705 * is presented to the user (this happens in tcp_usrreq.c,
3716 * with control block tp. Set thflags to whether reassembly now
3718 * inline (segment is the next to be received on an established
3754 tcp_sbrcv_grow(tp, &so->so_rcv, &to, tlen);
3896 * paths to this code happen after packets containing
3925 /* Don't need to check timer state as we should have done it during tcp_output */
3934 * Make ACK acceptable to originator of segment.
3935 * Don't bother to respond if destination was broadcast/multicast.
4012 tcp_dooptions(tp, cp, cnt, th, to, input_ifscope)
4020 struct tcpopt *to;
4069 to->to_flags |= TOF_TS;
4071 (char *)&to->to_tsval, sizeof(to->to_tsval));
4074 NTOHL(to->to_tsval);
4078 (char *)&to->to_tsecr, sizeof(to->to_tsecr));
4081 NTOHL(to->to_tsecr);
4086 * it ok to send timestamp requests and replies.
4090 tp->ts_recent = to->to_tsval;
4099 to->to_flags |= TOF_SACK;
4104 to->to_nsacks = (optlen - 2) / TCPOLEN_SACK;
4105 to->to_sacks = cp + 2;
4126 int off; /* delayed to be droped hdrlen */
4204 * is equivalent to the smoothing algorithm in rfc793 with
4208 * Freebsd adjusts rtt to origin 0 by subtracting 1 from the provided
4210 * initiailised to 1 before. Since we changed t_rtttime to be based on
4222 * timer to smoothed rtt + 4 times the smoothed variance.
4225 * equivalent to rfc793 smoothing with an alpha of .75
4240 * Set the variance to half the rtt (so our first
4259 * statistical, we have to test that we don't drop below
4268 * it is probably safe to discard any error indications we've
4319 * interface without forcing IP to fragment; if bigger than
4320 * an mbuf cluster (MCLBYTES), round down to nearest multiple of MCLBYTES
4321 * to utilize large mbufs. If no route is found, route has no mtu,
4326 * window to be a single segment if the destination isn't local.
4331 * send regularly. Make maxseg shorter by that amount to assure
4406 * believed to be on a serial modem (speed <128Kbps). Excludes 9600bps as
4435 * to at least minmss.
4440 * enough to allow some data on segments even is the
4451 * to scaled multiples of the slow timeout timer.
4481 * segment. We need to store this value (maxopd) apart
4498 * Calculate corrected value for sb_max; ensure to upgrade the
4505 * buffer to that size only if it's bigger than the current
4542 * buffer limit on the path. Use this to set
4544 * threshold to no less than 2*mss.
4568 * Determine the MSS option to send on an outgoing SYN.
4605 * believed to be on a serial modem (speed <128Kbps). Excludes 9600bps as
4626 * By setting snd_nxt to th_ack, this forces retransmission timer to
4640 * Set snd_cwnd to one segment beyond acknowledged offset
4729 /* do not try to lock the inp in in_pcb_checkstate
4742 /* Makes sure socket is still in the right state to be discarded */
4769 * we are holding the lock. This pcb will have to
4777 /* Unlock this socket and leave the reference on. We need to
4778 * acquire the pcbinfo lock in order to fully dispose it off
4792 * socket will have to be garbage collected later
4891 * for delay in sending a packet is due to flow
4893 * to backoff retransmit timer.
4938 * to consider for TCP fast retransmit
4939 * to either 2 or 3