1/* 2 * Copyright (c) 1982, 1986, 1988, 1990, 1993, 1994, 1995 3 * The Regents of the University of California. All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright --- 13 unchanged lines hidden (view full) --- 22 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 23 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 24 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 25 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 26 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 27 * SUCH DAMAGE. 28 * 29 * @(#)tcp_input.c 8.12 (Berkeley) 5/24/95 |
30 * $FreeBSD: head/sys/netinet/tcp_input.c 130480 2004-06-14 18:16:22Z rwatson $ |
31 */ 32 33#include "opt_ipfw.h" /* for ipfw_fwd */ 34#include "opt_inet.h" 35#include "opt_inet6.h" 36#include "opt_ipsec.h" 37#include "opt_mac.h" 38#include "opt_tcpdebug.h" --- 311 unchanged lines hidden (view full) --- 350 q = LIST_FIRST(&tp->t_segq); 351 if (!q || q->tqe_th->th_seq != tp->rcv_nxt) 352 return (0); 353 do { 354 tp->rcv_nxt += q->tqe_len; 355 flags = q->tqe_th->th_flags & TH_FIN; 356 nq = LIST_NEXT(q, tqe_q); 357 LIST_REMOVE(q, tqe_q); |
358 if (so->so_rcv.sb_state & SBS_CANTRCVMORE) |
359 m_freem(q->tqe_m); 360 else 361 sbappendstream(&so->so_rcv, q->tqe_m); 362 uma_zfree(tcp_reass_zone, q); 363 tp->t_segqlen--; 364 tcp_reass_qsize--; 365 q = nq; 366 } while (q && q->tqe_th->th_seq == tp->rcv_nxt); --- 865 unchanged lines hidden (view full) --- 1232 /* 1233#ifdef TCPDEBUG 1234 if (so->so_options & SO_DEBUG) 1235 tcp_trace(TA_INPUT, ostate, tp, 1236 (void *)tcp_saveipgen, &tcp_savetcp, 0); 1237#endif 1238 * Add data to socket buffer. 1239 */ |
1240 if (so->so_rcv.sb_state & SBS_CANTRCVMORE) { |
1241 m_freem(m); 1242 } else { 1243 m_adj(m, drop_hdrlen); /* delayed header drop */ 1244 sbappendstream(&so->so_rcv, m); 1245 } 1246 sorwakeup(so); 1247 if (DELAY_ACK(tp)) { 1248 tp->t_flags |= TF_DELACK; --- 889 unchanged lines hidden (view full) --- 2138 * Starting the timer is contrary to the 2139 * specification, but if we don't get a FIN 2140 * we'll hang forever. 2141 */ 2142 /* XXXjl 2143 * we should release the tp also, and use a 2144 * compressed state. 2145 */ |
2146 if (so->so_rcv.sb_state & SBS_CANTRCVMORE) { |
2147 soisdisconnected(so); 2148 callout_reset(tp->tt_2msl, tcp_maxidle, 2149 tcp_timer_2msl, tp); 2150 } 2151 tp->t_state = TCPS_FIN_WAIT_2; 2152 } 2153 break; 2154 --- 90 unchanged lines hidden (view full) --- 2245 * of data past the urgent section as the original 2246 * spec states (in one of two places). 2247 */ 2248 if (SEQ_GT(th->th_seq+th->th_urp, tp->rcv_up)) { 2249 tp->rcv_up = th->th_seq + th->th_urp; 2250 so->so_oobmark = so->so_rcv.sb_cc + 2251 (tp->rcv_up - tp->rcv_nxt) - 1; 2252 if (so->so_oobmark == 0) |
2253 so->so_rcv.sb_state |= SBS_RCVATMARK; |
2254 sohasoutofband(so); 2255 tp->t_oobflags &= ~(TCPOOB_HAVEDATA | TCPOOB_HADDATA); 2256 } 2257 /* 2258 * Remove out of band data so doesn't get presented to user. 2259 * This can happen independent of advancing the URG pointer, 2260 * but if two URG's are pending at once, some out-of-band 2261 * data may creep in... ick. --- 44 unchanged lines hidden (view full) --- 2306 tp->t_flags |= TF_DELACK; 2307 else 2308 tp->t_flags |= TF_ACKNOW; 2309 tp->rcv_nxt += tlen; 2310 thflags = th->th_flags & TH_FIN; 2311 tcpstat.tcps_rcvpack++; 2312 tcpstat.tcps_rcvbyte += tlen; 2313 ND6_HINT(tp); |
2314 if (so->so_rcv.sb_state & SBS_CANTRCVMORE) |
2315 m_freem(m); 2316 else 2317 sbappendstream(&so->so_rcv, m); 2318 sorwakeup(so); 2319 } else { 2320 thflags = tcp_reass(tp, th, &tlen, m); 2321 tp->t_flags |= TF_ACKNOW; 2322 } --- 920 unchanged lines hidden --- |