Lines Matching defs:th
2292 struct tcphdr *th, struct pf_state_peer *dst)
2294 int hlen = (th->th_off << 2) - sizeof (*th), thoptlen = hlen;
2301 !pf_pull_hdr(m, off + sizeof (*th), opts, hlen, NULL, NULL, pd->af))
2319 pf_change_a(&sack.start, &th->th_sum,
2322 pf_change_a(&sack.end, &th->th_sum,
2327 copyback = off + sizeof (*th) + thoptlen;
2342 m_copyback(m, off + sizeof (*th), thoptlen, opts);
2363 struct tcphdr *th = NULL;
2445 th = (struct tcphdr *)(void *)((caddr_t)h + sizeof (struct ip));
2458 th = (struct tcphdr *)(void *)
2465 th->th_sport = sport;
2466 th->th_dport = dport;
2467 th->th_seq = htonl(seq);
2468 th->th_ack = htonl(ack);
2469 th->th_off = tlen >> 2;
2470 th->th_flags = flags;
2471 th->th_win = htons(win);
2474 opt = (char *)(th + 1);
2489 th->th_sum = in_cksum(m, len);
2515 th->th_sum = in6_cksum(m, IPPROTO_TCP,
4015 struct tcphdr *th = pd->hdr.tcp;
4044 sxport.port = th->th_sport;
4045 dxport.port = th->th_dport;
4046 hdrlen = sizeof (*th);
4112 &th->th_sport, pd->ip_sum, &th->th_sum,
4114 sxport.port = th->th_sport;
4210 &th->th_dport, pd->ip_sum, &th->th_sum,
4212 dxport.port = th->th_dport;
4319 th->th_sport))
4330 th->th_dport))
4350 (r->flagset & th->th_flags) != r->flags)
4370 pf_osfp_fingerprint(pd, m, off, th),
4427 &th->th_sport, pd->ip_sum,
4428 &th->th_sum, &pd->baddr,
4430 sxport.port = th->th_sport;
4500 &th->th_dport, pd->ip_sum,
4501 &th->th_sum, &pd->baddr,
4503 dxport.port = th->th_dport;
4577 !(th->th_flags & TH_RST)) {
4578 u_int32_t ack = ntohl(th->th_seq) + pd->p_len;
4602 if (th->th_flags & TH_SYN)
4604 if (th->th_flags & TH_FIN)
4607 pd->src, th->th_dport, th->th_sport,
4608 ntohl(th->th_ack), ack, TH_RST|TH_ACK, 0, 0,
4821 s->src.seqlo = ntohl(th->th_seq);
4823 if ((th->th_flags & (TH_SYN|TH_ACK)) ==
4829 pf_change_a(&th->th_seq, &th->th_sum,
4831 rewrite = off + sizeof (*th);
4834 if (th->th_flags & TH_SYN) {
4837 th->th_off, af);
4839 s->src.max_win = MAX(ntohs(th->th_win), 1);
4847 if (th->th_flags & TH_FIN)
4898 pf_normalize_tcp_init(m, off, pd, th, &s->src,
4908 th, s, &s->src, &s->dst, &rewrite)) {
5006 (th->th_flags & (TH_SYN|TH_ACK)) == TH_SYN &&
5012 &th->th_sport, pd->ip_sum,
5013 &th->th_sum, &pd->baddr,
5015 sxport.port = th->th_sport;
5018 &th->th_dport, pd->ip_sum,
5019 &th->th_sum, &pd->baddr,
5021 sxport.port = th->th_dport;
5026 mss = pf_get_mss(m, off, th->th_off, af);
5030 pf_send_tcp(r, af, daddr, saddr, th->th_dport,
5031 th->th_sport, s->src.seqhi, ntohl(th->th_seq) + 1,
5042 offx += th->th_off << 2;
5100 struct tcphdr *th = pd->hdr.tcp;
5131 hdrlen = sizeof (*th);
5187 th->th_sport)))))
5199 th->th_dport)))
5217 (r->flagset & th->th_flags) != r->flags))
5449 struct tcphdr *th;
5678 th = pd->hdr.tcp;
5683 th->th_sum = pf_cksum_fixup(th->th_sum,
5687 th->th_sum = pf_cksum_fixup(th->th_sum,
5796 struct tcphdr *th = pd->hdr.tcp;
5797 u_int16_t win = ntohs(th->th_win);
5810 key.ext.xport.port = th->th_sport;
5811 key.gwy.xport.port = th->th_dport;
5815 key.lan.xport.port = th->th_sport;
5816 key.ext.xport.port = th->th_dport;
5834 if (th->th_flags & TH_SYN) {
5835 if (ntohl(th->th_seq) != (*state)->src.seqlo) {
5840 pd->src, th->th_dport, th->th_sport,
5841 (*state)->src.seqhi, ntohl(th->th_seq) + 1,
5846 } else if (!(th->th_flags & TH_ACK) ||
5847 (ntohl(th->th_ack) != (*state)->src.seqhi + 1) ||
5848 (ntohl(th->th_seq) != (*state)->src.seqlo + 1)) {
5869 if (((th->th_flags & (TH_SYN|TH_ACK)) != TH_ACK) ||
5870 (ntohl(th->th_ack) != (*state)->src.seqhi + 1) ||
5871 (ntohl(th->th_seq) != (*state)->src.seqlo + 1)) {
5875 (*state)->src.max_win = MAX(ntohs(th->th_win), 1);
5884 } else if (((th->th_flags & (TH_SYN|TH_ACK)) !=
5886 (ntohl(th->th_ack) != (*state)->dst.seqhi + 1)) {
5890 (*state)->dst.max_win = MAX(ntohs(th->th_win), 1);
5891 (*state)->dst.seqlo = ntohl(th->th_seq);
5893 pd->src, th->th_dport, th->th_sport,
5894 ntohl(th->th_ack), ntohl(th->th_seq) + 1,
5918 if (((th->th_flags & (TH_SYN|TH_ACK)) == TH_SYN) &&
5924 pf_print_flags(th->th_flags);
5934 if (src->wscale && dst->wscale && !(th->th_flags & TH_SYN)) {
5946 orig_seq = seq = ntohl(th->th_seq);
5952 if (pf_normalize_tcp_init(m, off, pd, th, src, dst)) {
5963 ack = ntohl(th->th_ack) - dst->seqdiff;
5964 pf_change_a(&th->th_seq, &th->th_sum, htonl(seq +
5966 pf_change_a(&th->th_ack, &th->th_sum, htonl(ack), 0);
5967 copyback = off + sizeof (*th);
5969 ack = ntohl(th->th_ack);
5973 if (th->th_flags & TH_SYN) {
5976 src->wscale = pf_get_wscale(m, off, th->th_off,
6007 if (th->th_flags & TH_FIN)
6027 ack = ntohl(th->th_ack) - dst->seqdiff;
6030 pf_change_a(&th->th_seq, &th->th_sum, htonl(seq +
6032 pf_change_a(&th->th_ack, &th->th_sum, htonl(ack), 0);
6033 copyback = off+ sizeof (*th);
6036 if (th->th_flags & TH_SYN)
6038 if (th->th_flags & TH_FIN)
6042 if ((th->th_flags & TH_ACK) == 0) {
6046 (th->th_flags & (TH_ACK|TH_RST)) == (TH_ACK|TH_RST)) ||
6077 if (dst->seqdiff && (th->th_off << 2) > (int)sizeof (struct tcphdr)) {
6078 copyback = pf_modulate_sack(m, off, pd, th, dst);
6097 ((th->th_flags & TH_RST) == 0 || orig_seq == src->seqlo ||
6103 if (pf_normalize_tcp_stateful(m, off, pd, reason, th,
6121 if (th->th_flags & TH_SYN)
6124 if (th->th_flags & TH_FIN)
6127 if (th->th_flags & TH_ACK) {
6139 if (th->th_flags & TH_RST)
6192 pf_print_flags(th->th_flags);
6203 if (pf_normalize_tcp_stateful(m, off, pd, reason, th,
6224 if (th->th_flags & TH_FIN)
6227 if (th->th_flags & TH_RST)
6236 if (!(th->th_flags & TH_RST))
6238 pd->dst, pd->src, th->th_dport,
6239 th->th_sport, ntohl(th->th_ack), 0,
6249 pf_print_flags(th->th_flags);
6276 off + (th->th_off << 2), pd, kif);
6287 pf_change_ap(direction, pd->mp, pd->src, &th->th_sport,
6288 pd->ip_sum, &th->th_sum,
6292 pf_change_ap(direction, pd->mp, pd->dst, &th->th_dport,
6293 pd->ip_sum, &th->th_sum,
6296 copyback = off + sizeof (*th);
6307 m_copyback(m, off, sizeof (*th), th);
6714 struct tcphdr th;
6725 if (!pf_pull_hdr(m, off2, &th, 8, NULL, reason,
6738 key.ext.xport.port = th.th_dport;
6739 key.gwy.xport.port = th.th_sport;
6743 key.lan.xport.port = th.th_dport;
6744 key.ext.xport.port = th.th_sport;
6763 seq = ntohl(th.th_seq) - src->seqdiff;
6765 pf_change_a(&th.th_seq, icmpsum,
6789 pf_change_icmp(pd2.src, &th.th_sport,
6795 pf_change_icmp(pd2.dst, &th.th_dport,
6827 m_copyback(m, off2, 8, &th);
8183 struct tcphdr th;
8184 pd.hdr.tcp = &th;
8185 if (!pf_pull_hdr(m, off, &th, sizeof (th),
8190 pd.p_len = pd.tot_len - off - (th.th_off << 2);
8191 if ((th.th_flags & TH_ACK) && pd.p_len == 0)
8778 struct tcphdr th;
8780 pd.hdr.tcp = &th;
8781 if (!pf_pull_hdr(m, off, &th, sizeof (th),
8786 pd.p_len = pd.tot_len - off - (th.th_off << 2);