Lines Matching refs:th

402 static void tcp_ecn_rcv_synack(struct tcp_sock *tp, const struct tcphdr *th)  in tcp_ecn_rcv_synack()  argument
404 if (tcp_ecn_mode_rfc3168(tp) && (!th->ece || th->cwr)) in tcp_ecn_rcv_synack()
408 static void tcp_ecn_rcv_syn(struct tcp_sock *tp, const struct tcphdr *th) in tcp_ecn_rcv_syn() argument
410 if (tcp_ecn_mode_rfc3168(tp) && (!th->ece || !th->cwr)) in tcp_ecn_rcv_syn()
414 static bool tcp_ecn_rcv_ecn_echo(const struct tcp_sock *tp, const struct tcphdr *th) in tcp_ecn_rcv_ecn_echo() argument
416 if (th->ece && !th->syn && tcp_ecn_mode_rfc3168(tp)) in tcp_ecn_rcv_ecn_echo()
4010 static bool smc_parse_options(const struct tcphdr *th, in smc_parse_options() argument
4017 if (th->syn && !(opsize & 1) && in smc_parse_options()
4031 u16 tcp_parse_mss_option(const struct tcphdr *th, u16 user_mss) in tcp_parse_mss_option() argument
4033 const unsigned char *ptr = (const unsigned char *)(th + 1); in tcp_parse_mss_option()
4034 int length = (th->doff * 4) - sizeof(struct tcphdr); in tcp_parse_mss_option()
4081 const struct tcphdr *th = tcp_hdr(skb); in tcp_parse_options() local
4082 int length = (th->doff * 4) - sizeof(struct tcphdr); in tcp_parse_options()
4084 ptr = (const unsigned char *)(th + 1); in tcp_parse_options()
4108 if (opsize == TCPOLEN_MSS && th->syn && !estab) { in tcp_parse_options()
4119 if (opsize == TCPOLEN_WINDOW && th->syn && in tcp_parse_options()
4143 if (opsize == TCPOLEN_SACK_PERM && th->syn && in tcp_parse_options()
4154 TCP_SKB_CB(skb)->sacked = (ptr - 2) - (unsigned char *)th; in tcp_parse_options()
4174 ptr, th->syn, foc, false); in tcp_parse_options()
4186 ptr + 2, th->syn, foc, true); in tcp_parse_options()
4190 if (smc_parse_options(th, opt_rx, ptr, opsize)) in tcp_parse_options()
4206 static bool tcp_parse_aligned_timestamp(struct tcp_sock *tp, const struct tcphdr *th) in tcp_parse_aligned_timestamp() argument
4208 const __be32 *ptr = (const __be32 *)(th + 1); in tcp_parse_aligned_timestamp()
4230 const struct tcphdr *th, struct tcp_sock *tp) in tcp_fast_parse_options() argument
4235 if (th->doff == (sizeof(*th) / 4)) { in tcp_fast_parse_options()
4239 th->doff == ((sizeof(*th) + TCPOLEN_TSTAMP_ALIGNED) / 4)) { in tcp_fast_parse_options()
4240 if (tcp_parse_aligned_timestamp(tp, th)) in tcp_fast_parse_options()
4255 int tcp_do_parse_auth_options(const struct tcphdr *th, in tcp_do_parse_auth_options() argument
4258 int length = (th->doff << 2) - sizeof(*th); in tcp_do_parse_auth_options()
4259 const u8 *ptr = (const u8 *)(th + 1); in tcp_do_parse_auth_options()
4349 const struct tcphdr *th = tcp_hdr(skb); in tcp_disordered_ack_check() local
4355 if (!th->ack || seq != TCP_SKB_CB(skb)->end_seq) in tcp_disordered_ack_check()
4369 if (tcp_may_update_window(tp, ack, seq, ntohs(th->window) << in tcp_disordered_ack_check()
5759 static void tcp_check_urg(struct sock *sk, const struct tcphdr *th) in tcp_check_urg() argument
5762 u32 ptr = ntohs(th->urg_ptr); in tcp_check_urg()
5766 ptr += ntohl(th->seq); in tcp_check_urg()
5825 static void tcp_urg(struct sock *sk, struct sk_buff *skb, const struct tcphdr *th) in tcp_urg() argument
5830 if (unlikely(th->urg)) in tcp_urg()
5831 tcp_check_urg(sk, th); in tcp_urg()
5835 u32 ptr = tp->urg_seq - ntohl(th->seq) + (th->doff * 4) - in tcp_urg()
5836 th->syn; in tcp_urg()
5871 const struct tcphdr *th, int syn_inerr) in tcp_validate_incoming() argument
5877 if (!tcp_fast_parse_options(sock_net(sk), skb, th, tp) || in tcp_validate_incoming()
5886 if (th->rst) in tcp_validate_incoming()
5888 if (unlikely(th->syn)) in tcp_validate_incoming()
5915 if (!th->rst) { in tcp_validate_incoming()
5916 if (th->syn) in tcp_validate_incoming()
5934 if (th->rst) { in tcp_validate_incoming()
5981 if (th->syn) { in tcp_validate_incoming()
5982 if (sk->sk_state == TCP_SYN_RECV && sk->sk_socket && th->ack && in tcp_validate_incoming()
6037 const struct tcphdr *th = (const struct tcphdr *)skb->data; in tcp_rcv_established() local
6073 if ((tcp_flag_word(th) & TCP_HP_BITS) == tp->pred_flags && in tcp_rcv_established()
6088 if (!tcp_parse_aligned_timestamp(tp, th)) in tcp_rcv_established()
6189 if (len < (th->doff << 2) || tcp_checksum_complete(skb)) in tcp_rcv_established()
6192 if (!th->ack && !th->rst && !th->syn) { in tcp_rcv_established()
6201 if (!tcp_validate_incoming(sk, skb, th, 1)) in tcp_rcv_established()
6213 tcp_urg(sk, skb, th); in tcp_rcv_established()
6381 const struct tcphdr *th) in tcp_rcv_synsent_state_process() argument
6394 if (th->ack) { in tcp_rcv_synsent_state_process()
6430 if (th->rst) { in tcp_rcv_synsent_state_process()
6444 if (!th->syn) { in tcp_rcv_synsent_state_process()
6455 tcp_ecn_rcv_synack(tp, th); in tcp_rcv_synsent_state_process()
6470 tp->snd_wnd = ntohs(th->window); in tcp_rcv_synsent_state_process()
6533 if (th->rst) { in tcp_rcv_synsent_state_process()
6549 if (th->syn) { in tcp_rcv_synsent_state_process()
6560 WRITE_ONCE(ao->risn, th->seq); in tcp_rcv_synsent_state_process()
6582 tp->snd_wnd = ntohs(th->window); in tcp_rcv_synsent_state_process()
6586 tcp_ecn_rcv_syn(tp, th); in tcp_rcv_synsent_state_process()
6680 const struct tcphdr *th = tcp_hdr(skb); in tcp_rcv_state_process() local
6691 if (th->ack) in tcp_rcv_state_process()
6694 if (th->rst) { in tcp_rcv_state_process()
6698 if (th->syn) { in tcp_rcv_state_process()
6699 if (th->fin) { in tcp_rcv_state_process()
6721 queued = tcp_rcv_synsent_state_process(sk, skb, th); in tcp_rcv_state_process()
6726 tcp_urg(sk, skb, th); in tcp_rcv_state_process()
6747 if (!th->ack && !th->rst && !th->syn) { in tcp_rcv_state_process()
6751 if (!tcp_validate_incoming(sk, skb, th, 0)) in tcp_rcv_state_process()
6805 tp->snd_wnd = ntohs(th->window) << tp->rx_opt.snd_wscale; in tcp_rcv_state_process()
6846 after(TCP_SKB_CB(skb)->end_seq - th->fin, tp->rcv_nxt)) { in tcp_rcv_state_process()
6848 if (tp->syn_fastopen && th->fin) in tcp_rcv_state_process()
6858 } else if (th->fin || sock_owned_by_user(sk)) { in tcp_rcv_state_process()
6890 tcp_urg(sk, skb, th); in tcp_rcv_state_process()
6914 after(TCP_SKB_CB(skb)->end_seq - th->fin, tp->rcv_nxt)) { in tcp_rcv_state_process()
6981 const struct tcphdr *th = tcp_hdr(skb); in tcp_ecn_create_request() local
6983 bool th_ecn = th->ece && th->cwr; in tcp_ecn_create_request()
6994 if (((!ect || th->res1) && ecn_ok) || tcp_ca_needs_ecn(listen_sk) || in tcp_ecn_create_request()
7103 struct sock *sk, struct tcphdr *th) in tcp_get_syncookie_mss() argument
7120 mss = tcp_parse_mss_option(th, tp->rx_opt.user_mss); in tcp_get_syncookie_mss()