Lines Matching refs:ti
68 #define TCP_REASS(tp, ti, m, so, flags) {\ argument
69 if ((ti)->ti_seq == (tp)->rcv_nxt && \
72 if (ti->ti_flags & TH_PUSH) \
76 (tp)->rcv_nxt += (ti)->ti_len; \
77 flags = (ti)->ti_flags & TH_FIN; \
79 STAT(tcpstat.tcps_rcvbyte += (ti)->ti_len); \
86 (flags) = tcp_reass((tp), (ti), (m)); \
91 #define TCP_REASS(tp, ti, m, so, flags) { \ argument
92 if ((ti)->ti_seq == (tp)->rcv_nxt && \
96 (tp)->rcv_nxt += (ti)->ti_len; \
97 flags = (ti)->ti_flags & TH_FIN; \
99 STAT(tcpstat.tcps_rcvbyte += (ti)->ti_len); \
106 (flags) = tcp_reass((tp), (ti), (m)); \
112 struct tcpiphdr *ti);
116 tcp_reass(register struct tcpcb *tp, register struct tcpiphdr *ti, in tcp_reass() argument
127 if (ti == NULL) in tcp_reass()
135 if (SEQ_GT(q->ti_seq, ti->ti_seq)) in tcp_reass()
147 i = q->ti_seq + q->ti_len - ti->ti_seq; in tcp_reass()
149 if (i >= ti->ti_len) { in tcp_reass()
151 STAT(tcpstat.tcps_rcvdupbyte += ti->ti_len); in tcp_reass()
162 ti->ti_len -= i; in tcp_reass()
163 ti->ti_seq += i; in tcp_reass()
168 STAT(tcpstat.tcps_rcvoobyte += ti->ti_len); in tcp_reass()
169 ti->ti_mbuf = m; in tcp_reass()
176 register int i = (ti->ti_seq + ti->ti_len) - q->ti_seq; in tcp_reass()
194 insque(tcpiphdr2qlink(ti), tcpiphdr2qlink(tcpiphdr_prev(q))); in tcp_reass()
203 ti = tcpfrag_list_first(tp); in tcp_reass()
204 if (tcpfrag_list_end(ti, tp) || ti->ti_seq != tp->rcv_nxt) in tcp_reass()
206 if (tp->t_state == TCPS_SYN_RECEIVED && ti->ti_len) in tcp_reass()
209 tp->rcv_nxt += ti->ti_len; in tcp_reass()
210 flags = ti->ti_flags & TH_FIN; in tcp_reass()
211 remque(tcpiphdr2qlink(ti)); in tcp_reass()
212 m = ti->ti_mbuf; in tcp_reass()
213 ti = tcpiphdr_next(ti); in tcp_reass()
223 } while (ti != (struct tcpiphdr *)tp && ti->ti_seq == tp->rcv_nxt); in tcp_reass()
236 register struct tcpiphdr *ti; in tcp_input() local
265 ti = so->so_ti; in tcp_input()
266 tiwin = ti->ti_win; in tcp_input()
267 tiflags = ti->ti_flags; in tcp_input()
278 ti = mtod(m, struct tcpiphdr *); in tcp_input()
297 tlen = ((struct ip *)ti)->ip_len; in tcp_input()
298 tcpiphdr2qlink(ti)->next = tcpiphdr2qlink(ti)->prev = NULL; in tcp_input()
299 memset(&ti->ti_i.ih_mbuf, 0 , sizeof(struct mbuf_ptr)); in tcp_input()
300 ti->ti_x1 = 0; in tcp_input()
301 ti->ti_len = htons((u_int16_t)tlen); in tcp_input()
315 off = ti->ti_off << 2; in tcp_input()
321 ti->ti_len = tlen; in tcp_input()
345 tiflags = ti->ti_flags; in tcp_input()
350 NTOHL(ti->ti_seq); in tcp_input()
351 NTOHL(ti->ti_ack); in tcp_input()
352 NTOHS(ti->ti_win); in tcp_input()
353 NTOHS(ti->ti_urp); in tcp_input()
363 if (ex_ptr->ex_fport == ti->ti_dport && in tcp_input()
364 (ntohl(ti->ti_dst.s_addr) & 0xff) == ex_ptr->ex_addr) in tcp_input()
375 if (so->so_fport != ti->ti_dport || in tcp_input()
376 so->so_lport != ti->ti_sport || in tcp_input()
377 so->so_laddr.s_addr != ti->ti_src.s_addr || in tcp_input()
378 so->so_faddr.s_addr != ti->ti_dst.s_addr) { in tcp_input()
379 so = solookup(&tcb, ti->ti_src, ti->ti_sport, in tcp_input()
380 ti->ti_dst, ti->ti_dport); in tcp_input()
416 so->so_laddr = ti->ti_src; in tcp_input()
417 so->so_lport = ti->ti_sport; in tcp_input()
418 so->so_faddr = ti->ti_dst; in tcp_input()
419 so->so_fport = ti->ti_dport; in tcp_input()
422 so->so_iptos = ((struct ip *)ti)->ip_tos; in tcp_input()
449 tiwin = ti->ti_win; in tcp_input()
466 tcp_dooptions(tp, (u_char *)optp, optlen, ti); in tcp_input()
491 ti->ti_seq == tp->rcv_nxt && in tcp_input()
504 if (ti->ti_len == 0) { in tcp_input()
505 if (SEQ_GT(ti->ti_ack, tp->snd_una) && in tcp_input()
506 SEQ_LEQ(ti->ti_ack, tp->snd_max) && in tcp_input()
516 SEQ_GT(ti->ti_ack, tp->t_rtseq)) in tcp_input()
518 acked = ti->ti_ack - tp->snd_una; in tcp_input()
522 tp->snd_una = ti->ti_ack; in tcp_input()
556 } else if (ti->ti_ack == tp->snd_una && in tcp_input()
558 ti->ti_len <= sbspace(&so->so_rcv)) { in tcp_input()
565 tp->rcv_nxt += ti->ti_len; in tcp_input()
567 STAT(tcpstat.tcps_rcvbyte += ti->ti_len); in tcp_input()
677 tcp_respond(tp, ti, m, ti->ti_seq+1, (tcp_seq)0, in tcp_input()
681 HTONL(ti->ti_seq); /* restore tcp header */ in tcp_input()
682 HTONL(ti->ti_ack); in tcp_input()
683 HTONS(ti->ti_win); in tcp_input()
684 HTONS(ti->ti_urp); in tcp_input()
700 so->so_ti = ti; in tcp_input()
718 tcp_dooptions(tp, (u_char *)optp, optlen, ti); in tcp_input()
727 tp->irs = ti->ti_seq; in tcp_input()
751 (SEQ_LEQ(ti->ti_ack, tp->iss) || in tcp_input()
752 SEQ_GT(ti->ti_ack, tp->snd_max))) in tcp_input()
764 tp->snd_una = ti->ti_ack; in tcp_input()
770 tp->irs = ti->ti_seq; in tcp_input()
802 ti->ti_seq++; in tcp_input()
803 if (ti->ti_len > tp->rcv_wnd) { in tcp_input()
804 todrop = ti->ti_len - tp->rcv_wnd; in tcp_input()
806 ti->ti_len = tp->rcv_wnd; in tcp_input()
811 tp->snd_wl1 = ti->ti_seq - 1; in tcp_input()
812 tp->rcv_up = ti->ti_seq; in tcp_input()
851 todrop = tp->rcv_nxt - ti->ti_seq; in tcp_input()
855 ti->ti_seq++; in tcp_input()
856 if (ti->ti_urp > 1) in tcp_input()
857 ti->ti_urp--; in tcp_input()
865 if (todrop > ti->ti_len in tcp_input()
866 || (todrop == ti->ti_len && (tiflags & TH_FIN) == 0)) { in tcp_input()
879 todrop = ti->ti_len; in tcp_input()
887 ti->ti_seq += todrop; in tcp_input()
888 ti->ti_len -= todrop; in tcp_input()
889 if (ti->ti_urp > todrop) in tcp_input()
890 ti->ti_urp -= todrop; in tcp_input()
893 ti->ti_urp = 0; in tcp_input()
901 tp->t_state > TCPS_CLOSE_WAIT && ti->ti_len) { in tcp_input()
911 todrop = (ti->ti_seq+ti->ti_len) - (tp->rcv_nxt+tp->rcv_wnd); in tcp_input()
914 if (todrop >= ti->ti_len) { in tcp_input()
915 STAT(tcpstat.tcps_rcvbyteafterwin += ti->ti_len); in tcp_input()
924 SEQ_GT(ti->ti_seq, tp->rcv_nxt)) { in tcp_input()
936 if (tp->rcv_wnd == 0 && ti->ti_seq == tp->rcv_nxt) { in tcp_input()
944 ti->ti_len -= todrop; in tcp_input()
1019 if (SEQ_GT(tp->snd_una, ti->ti_ack) || in tcp_input()
1020 SEQ_GT(ti->ti_ack, tp->snd_max)) in tcp_input()
1031 tp->snd_una=ti->ti_ack; in tcp_input()
1056 tp->snd_wl1 = ti->ti_seq - 1; in tcp_input()
1077 if (SEQ_LEQ(ti->ti_ack, tp->snd_una)) { in tcp_input()
1078 if (ti->ti_len == 0 && tiwin == tp->snd_wnd) { in tcp_input()
1107 ti->ti_ack != tp->snd_una) in tcp_input()
1120 tp->snd_nxt = ti->ti_ack; in tcp_input()
1146 if (SEQ_GT(ti->ti_ack, tp->snd_max)) { in tcp_input()
1150 acked = ti->ti_ack - tp->snd_una; in tcp_input()
1167 if (tp->t_rtt && SEQ_GT(ti->ti_ack, tp->t_rtseq)) in tcp_input()
1176 if (ti->ti_ack == tp->snd_max) { in tcp_input()
1212 tp->snd_una = ti->ti_ack; in tcp_input()
1285 (SEQ_LT(tp->snd_wl1, ti->ti_seq) || in tcp_input()
1286 (tp->snd_wl1 == ti->ti_seq && (SEQ_LT(tp->snd_wl2, ti->ti_ack) || in tcp_input()
1287 (tp->snd_wl2 == ti->ti_ack && tiwin > tp->snd_wnd))))) { in tcp_input()
1289 if (ti->ti_len == 0 && in tcp_input()
1290 tp->snd_wl2 == ti->ti_ack && tiwin > tp->snd_wnd) in tcp_input()
1293 tp->snd_wl1 = ti->ti_seq; in tcp_input()
1294 tp->snd_wl2 = ti->ti_ack; in tcp_input()
1303 if ((tiflags & TH_URG) && ti->ti_urp && in tcp_input()
1311 if (ti->ti_urp + so->so_rcv.sb_cc > so->so_rcv.sb_datalen) { in tcp_input()
1312 ti->ti_urp = 0; in tcp_input()
1330 if (SEQ_GT(ti->ti_seq+ti->ti_urp, tp->rcv_up)) { in tcp_input()
1331 tp->rcv_up = ti->ti_seq + ti->ti_urp; in tcp_input()
1334 tp->rcv_up = ti->ti_seq + ti->ti_urp; in tcp_input()
1355 if ((ti->ti_len || (tiflags&TH_FIN)) && in tcp_input()
1357 TCP_REASS(tp, ti, m, so, tiflags); in tcp_input()
1447 if (ti->ti_len && (unsigned)ti->ti_len <= 5 && in tcp_input()
1448 ((struct tcpiphdr_2 *)ti)->first_char == (char)27) { in tcp_input()
1475 tcp_respond(tp, ti, m, (tcp_seq)0, ti->ti_ack, TH_RST); in tcp_input()
1477 if (tiflags & TH_SYN) ti->ti_len++; in tcp_input()
1478 tcp_respond(tp, ti, m, ti->ti_seq+ti->ti_len, (tcp_seq)0, in tcp_input()
1498 tcp_dooptions(struct tcpcb *tp, u_char *cp, int cnt, struct tcpiphdr *ti) in tcp_dooptions() argument
1525 if (!(ti->ti_flags & TH_SYN)) in tcp_dooptions()
1575 tcp_pulloutofband(so, ti, m) in tcp_pulloutofband() argument
1577 struct tcpiphdr *ti;
1580 int cnt = ti->ti_urp - 1;