| /linux/tools/testing/selftests/bpf/progs/ |
| H A D | cgroup_tcp_skb.c | 25 int needed_tcp_pkt(struct __sk_buff *skb, struct tcphdr *tcph) in needed_tcp_pkt() argument 37 if (bpf_skb_load_bytes(skb, sizeof(ip6h), tcph, sizeof(*tcph))) in needed_tcp_pkt() 40 if (tcph->source != bpf_htons(g_sock_port) && in needed_tcp_pkt() 41 tcph->dest != bpf_htons(g_sock_port)) in needed_tcp_pkt() 48 static int egress_accept(struct tcphdr *tcph) in egress_accept() argument 51 if (tcph->fin || !tcph->syn || !tcph->ack) in egress_accept() 61 static int ingress_accept(struct tcphdr *tcph) in ingress_accept() argument 65 if (!tcph->syn || tcph->fin || tcph->ack) in ingress_accept() 71 if (tcph->fin || tcph->syn || !tcph->ack) in ingress_accept() 84 static int egress_connect(struct tcphdr *tcph) in egress_connect() argument [all …]
|
| H A D | cgroup_skb_sk_lookup_kern.c | 31 const struct tcphdr *tcph) in set_tuple() argument 35 tuple->ipv6.sport = tcph->dest; in set_tuple() 36 tuple->ipv6.dport = tcph->source; in set_tuple() 41 const struct tcphdr *tcph) in is_allowed_peer_cg() argument 48 set_tuple(&tuple, ip6h, tcph); in is_allowed_peer_cg() 70 struct tcphdr tcph; in ingress_lookup() local 85 if (bpf_skb_load_bytes(skb, sizeof(ip6h), &tcph, sizeof(tcph))) in ingress_lookup() 91 if (tcph.dest != g_serv_port) in ingress_lookup() 94 return is_allowed_peer_cg(skb, &ip6h, &tcph); in ingress_lookup()
|
| H A D | test_tc_tunnel.c | 89 struct tcphdr tcph; in set_ipv4_csum() 137 &tcph, sizeof(tcph)) < 0) in __encap_ipv4() 140 if (tcph.dest != __bpf_constant_htons(cfg_port)) in __encap_ipv4() 256 struct tcphdr tcph; in encap_ipv4() 268 &tcph, sizeof(tcph)) < 0) in __encap_ipv6() local 271 if (tcph.dest != __bpf_constant_htons(cfg_port)) in __encap_ipv6() 365 struct tcphdr tcph; in __encap_ipv6() 376 &tcph, sizeo in encap_ipv6_ipip6() 100 struct tcphdr tcph; __encap_ipv4() local 377 struct tcphdr tcph; encap_ipv6_ipip6() local [all...] |
| H A D | xdp_flowtable.c | 49 struct tcphdr *tcph = ports; in xdp_flowtable_offload_check_tcp_state() local 51 if (tcph + 1 > data_end) in xdp_flowtable_offload_check_tcp_state() 54 if (tcph->fin || tcph->rst) in xdp_flowtable_offload_check_tcp_state()
|
| /linux/net/netfilter/ |
| H A D | nf_conntrack_seqadj.c | 76 struct tcphdr *tcph, in nf_ct_sack_block_adjust() argument 106 inet_proto_csum_replace4(&tcph->check, skb, in nf_ct_sack_block_adjust() 108 inet_proto_csum_replace4(&tcph->check, skb, in nf_ct_sack_block_adjust() 122 struct tcphdr *tcph = (void *)skb->data + protoff; in nf_ct_sack_adjust() local 127 optend = protoff + tcph->doff * 4; in nf_ct_sack_adjust() 132 tcph = (void *)skb->data + protoff; in nf_ct_sack_adjust() 154 nf_ct_sack_block_adjust(skb, tcph, optoff + 2, in nf_ct_sack_adjust() 169 struct tcphdr *tcph; in nf_ct_seq_adjust() local 179 if (skb_ensure_writable(skb, protoff + sizeof(*tcph))) in nf_ct_seq_adjust() 182 tcph = (void *)skb->data + protoff; in nf_ct_seq_adjust() [all …]
|
| H A D | xt_TCPMSS.c | 78 struct tcphdr *tcph; in tcpmss_mangle_packet() local 96 tcph = (struct tcphdr *)(skb_network_header(skb) + tcphoff); in tcpmss_mangle_packet() 97 tcp_hdrlen = tcph->doff * 4; in tcpmss_mangle_packet() 116 opt = (u_int8_t *)tcph; in tcpmss_mangle_packet() 133 inet_proto_csum_replace2(&tcph->check, skb, in tcpmss_mangle_packet() 159 tcph = (struct tcphdr *)(skb_network_header(skb) + tcphoff); in tcpmss_mangle_packet() 176 opt = (u_int8_t *)tcph + sizeof(struct tcphdr); in tcpmss_mangle_packet() 179 inet_proto_csum_replace2(&tcph->check, skb, in tcpmss_mangle_packet() 186 inet_proto_csum_replace4(&tcph->check, skb, 0, *((__be32 *)opt), false); in tcpmss_mangle_packet() 188 oldval = ((__be16 *)tcph)[6]; in tcpmss_mangle_packet() [all …]
|
| H A D | nft_exthdr.c | 172 struct tcphdr *tcph; in nft_tcp_header_pointer() local 177 tcph = skb_header_pointer(pkt->skb, nft_thoff(pkt), sizeof(*tcph), buffer); in nft_tcp_header_pointer() 178 if (!tcph) in nft_tcp_header_pointer() 181 *tcphdr_len = __tcp_hdrlen(tcph); in nft_tcp_header_pointer() 182 if (*tcphdr_len < sizeof(*tcph) || *tcphdr_len > len) in nft_tcp_header_pointer() 196 struct tcphdr *tcph; in nft_exthdr_tcp_eval() local 199 tcph = nft_tcp_header_pointer(pkt, sizeof(buff), buff, &tcphdr_len); in nft_exthdr_tcp_eval() 200 if (!tcph) in nft_exthdr_tcp_eval() 203 opt = (u8 *)tcph; in nft_exthdr_tcp_eval() 204 for (i = sizeof(*tcph); i < tcphdr_len - 1; i += optl) { in nft_exthdr_tcp_eval() [all …]
|
| H A D | xt_TCPOPTSTRIP.c | 34 struct tcphdr *tcph, _th; in tcpoptstrip_mangle_packet() local 44 tcph = skb_header_pointer(skb, tcphoff, sizeof(_th), &_th); in tcpoptstrip_mangle_packet() 45 if (!tcph) in tcpoptstrip_mangle_packet() 48 tcp_hdrlen = tcph->doff * 4; in tcpoptstrip_mangle_packet() 55 /* must reload tcph, might have been moved */ in tcpoptstrip_mangle_packet() 56 tcph = (struct tcphdr *)(skb_network_header(skb) + tcphoff); in tcpoptstrip_mangle_packet() 57 opt = (u8 *)tcph; in tcpoptstrip_mangle_packet() 79 inet_proto_csum_replace2(&tcph->check, skb, htons(o), in tcpoptstrip_mangle_packet()
|
| H A D | nf_conntrack_proto_tcp.c | 275 static unsigned int get_conntrack_index(const struct tcphdr *tcph) in get_conntrack_index() argument 277 if (tcph->rst) return TCP_RST_SET; in get_conntrack_index() 278 else if (tcph->syn) return (tcph->ack ? TCP_SYNACK_SET : TCP_SYN_SET); in get_conntrack_index() 279 else if (tcph->fin) return TCP_FIN_SET; in get_conntrack_index() 280 else if (tcph->ack) return TCP_ACK_SET; in get_conntrack_index() 316 const struct tcphdr *tcph) in segment_seq_plus_len() argument 320 return (seq + len - dataoff - tcph->doff*4 in segment_seq_plus_len() 321 + (tcph->syn ? 1 : 0) + (tcph->fin ? 1 : 0)); in segment_seq_plus_len() 335 const struct tcphdr *tcph, in tcp_options() argument 340 int length = (tcph->doff*4) - sizeof(struct tcphdr); in tcp_options() [all …]
|
| H A D | nf_nat_helper.c | 95 struct tcphdr *tcph; in __nf_nat_mangle_tcp_packet() local 106 tcph = (void *)skb->data + protoff; in __nf_nat_mangle_tcp_packet() 109 mangle_contents(skb, protoff + tcph->doff*4, in __nf_nat_mangle_tcp_packet() 115 tcph, &tcph->check, datalen, oldlen); in __nf_nat_mangle_tcp_packet() 118 nf_ct_seqadj_set(ct, ctinfo, tcph->seq, in __nf_nat_mangle_tcp_packet()
|
| H A D | nf_flow_table_ip.c | 25 struct tcphdr *tcph; in nf_flow_state_check() local 30 tcph = (void *)(skb_network_header(skb) + thoff); in nf_flow_state_check() 31 if (tcph->syn && test_bit(NF_FLOW_CLOSING, &flow->flags)) { in nf_flow_state_check() 36 if ((tcph->fin || tcph->rst) && in nf_flow_state_check() 46 struct tcphdr *tcph; in nf_flow_nat_ip_tcp() local 48 tcph = (void *)(skb_network_header(skb) + thoff); in nf_flow_nat_ip_tcp() 49 inet_proto_csum_replace4(&tcph->check, skb, addr, new_addr, true); in nf_flow_nat_ip_tcp() 679 struct tcphdr *tcph; in nf_flow_offload_ipv6_forward() 681 tcph in nf_flow_offload_ipv6_forward() 484 struct tcphdr *tcph; nf_flow_nat_ipv6_tcp() local [all...] |
| H A D | nf_conntrack_pptp.c | 497 const struct tcphdr *tcph; in conntrack_pptp_help() local 522 tcph = skb_header_pointer(skb, nexthdr_off, sizeof(_tcph), &_tcph); in conntrack_pptp_help() 523 if (!tcph) in conntrack_pptp_help() 526 nexthdr_off += tcph->doff * 4; in conntrack_pptp_help() 527 datalen = tcplen - tcph->doff * 4; in conntrack_pptp_help()
|
| /linux/net/ipv4/netfilter/ |
| H A D | ipt_ECN.c | 47 struct tcphdr _tcph, *tcph; in set_ect_tcp() local 51 tcph = skb_header_pointer(skb, ip_hdrlen(skb), sizeof(_tcph), &_tcph); in set_ect_tcp() 52 if (!tcph) in set_ect_tcp() 56 tcph->ece == einfo->proto.tcp.ece) && in set_ect_tcp() 58 tcph->cwr == einfo->proto.tcp.cwr)) in set_ect_tcp() 61 if (skb_ensure_writable(skb, ip_hdrlen(skb) + sizeof(*tcph))) in set_ect_tcp() 63 tcph = (void *)ip_hdr(skb) + ip_hdrlen(skb); in set_ect_tcp() 65 oldval = ((__be16 *)tcph)[6]; in set_ect_tcp() 67 tcph->ece = einfo->proto.tcp.ece; in set_ect_tcp() 69 tcph->cwr = einfo->proto.tcp.cwr; in set_ect_tcp() [all …]
|
| /linux/net/netfilter/ipvs/ |
| H A D | ip_vs_proto_tcp.c | 104 tcp_fast_csum_update(int af, struct tcphdr *tcph, 111 tcph->check = in tcp_fast_csum_update() 114 ~csum_unfold(tcph->check)))); in tcp_fast_csum_update() 117 tcph->check = in tcp_fast_csum_update() 120 ~csum_unfold(tcph->check)))); in tcp_fast_csum_update() 125 tcp_partial_csum_update(int af, struct tcphdr *tcph, 132 tcph->check = in tcp_partial_csum_update() 135 csum_unfold(tcph->check)))); in tcp_partial_csum_update() 138 tcph->check = in tcp_partial_csum_update() 141 csum_unfold(tcph in tcp_partial_csum_update() 105 tcp_fast_csum_update(int af,struct tcphdr * tcph,const union nf_inet_addr * oldip,const union nf_inet_addr * newip,__be16 oldport,__be16 newport) tcp_fast_csum_update() argument 126 tcp_partial_csum_update(int af,struct tcphdr * tcph,const union nf_inet_addr * oldip,const union nf_inet_addr * newip,__be16 oldlen,__be16 newlen) tcp_partial_csum_update() argument 150 struct tcphdr *tcph; tcp_snat_handler() local 228 struct tcphdr *tcph; tcp_dnat_handler() local [all...] |
| /linux/tools/testing/selftests/drivers/net/ |
| H A D | gro.c | 288 struct tcphdr *tcph = buf; in fill_transportlayer() local 290 memset(tcph, 0, sizeof(*tcph)); in fill_transportlayer() 292 tcph->source = htons(SPORT); in fill_transportlayer() 293 tcph->dest = htons(DPORT); in fill_transportlayer() 294 tcph->seq = ntohl(START_SEQ + seq_offset); in fill_transportlayer() 295 tcph->ack_seq = ntohl(START_ACK + ack_offset); in fill_transportlayer() 296 tcph->ack = 1; in fill_transportlayer() 297 tcph->fin = fin; in fill_transportlayer() 298 tcph->doff = 5; in fill_transportlayer() 299 tcph->window = htons(TCP_MAXWIN); in fill_transportlayer() [all …]
|
| /linux/drivers/infiniband/hw/irdma/ |
| H A D | cm.c | 310 struct tcphdr *tcph; in irdma_form_ah_cm_frame() local 338 pktsize = sizeof(*tcph) + opts_len + hdr_len + pd_len; in irdma_form_ah_cm_frame() 340 memset(buf, 0, sizeof(*tcph)); in irdma_form_ah_cm_frame() 343 sqbuf->tcphlen = sizeof(*tcph) + opts_len; in irdma_form_ah_cm_frame() 346 tcph = (struct tcphdr *)buf; in irdma_form_ah_cm_frame() 347 buf += sizeof(*tcph); in irdma_form_ah_cm_frame() 349 tcph->source = htons(cm_node->loc_port); in irdma_form_ah_cm_frame() 350 tcph->dest = htons(cm_node->rem_port); in irdma_form_ah_cm_frame() 351 tcph->seq = htonl(cm_node->tcp_cntxt.loc_seq_num); in irdma_form_ah_cm_frame() 355 tcph->ack_seq = htonl(cm_node->tcp_cntxt.loc_ack_num); in irdma_form_ah_cm_frame() [all …]
|
| H A D | utils.c | 1405 struct tcphdr *tcph = (struct tcphdr *)buf->tcph; in irdma_ieq_get_qp() local 1415 loc_port = ntohs(tcph->dest); in irdma_ieq_get_qp() 1416 rem_port = ntohs(tcph->source); in irdma_ieq_get_qp() 1436 struct tcphdr *tcph = (struct tcphdr *)buf->tcph; in irdma_send_ieq_ack() local 1439 cm_node->tcp_cntxt.loc_seq_num = ntohl(tcph->ack_seq); in irdma_send_ieq_ack() 1498 struct tcphdr *tcph; in irdma_gen1_ieq_update_tcpip_info() local 1506 tcph = (struct tcphdr *)(addr + buf->maclen + iphlen); in irdma_gen1_ieq_update_tcpip_info() 1509 tcph->seq = htonl(seqnum); in irdma_gen1_ieq_update_tcpip_info() 1521 struct tcphdr *tcph; in irdma_ieq_update_tcpip_info() local 1528 tcph = (struct tcphdr *)addr; in irdma_ieq_update_tcpip_info() [all …]
|
| /linux/net/core/ |
| H A D | tso.c | 28 struct tcphdr *tcph = (struct tcphdr *)hdr; in tso_build_hdr() local 30 put_unaligned_be32(tso->tcp_seq, &tcph->seq); in tso_build_hdr() 34 tcph->psh = 0; in tso_build_hdr() 35 tcph->fin = 0; in tso_build_hdr() 36 tcph->rst = 0; in tso_build_hdr()
|
| /linux/net/sched/ |
| H A D | act_csum.c | 209 struct tcphdr *tcph; in tcf_csum_ipv4_tcp() local 215 tcph = tcf_csum_skb_nextlayer(skb, ihl, ipl, sizeof(*tcph)); in tcf_csum_ipv4_tcp() 216 if (tcph == NULL) in tcf_csum_ipv4_tcp() 220 tcph->check = 0; in tcf_csum_ipv4_tcp() 221 skb->csum = csum_partial(tcph, ipl - ihl, 0); in tcf_csum_ipv4_tcp() 222 tcph->check = tcp_v4_check(ipl - ihl, in tcf_csum_ipv4_tcp() 233 struct tcphdr *tcph; in tcf_csum_ipv6_tcp() local 239 tcph = tcf_csum_skb_nextlayer(skb, ihl, ipl, sizeof(*tcph)); in tcf_csum_ipv6_tcp() 240 if (tcph == NULL) in tcf_csum_ipv6_tcp() 244 tcph->check = 0; in tcf_csum_ipv6_tcp() [all …]
|
| H A D | act_nat.c | 181 struct tcphdr *tcph; in tcf_nat_act() local 183 if (!pskb_may_pull(skb, ihl + sizeof(*tcph) + noff) || in tcf_nat_act() 184 skb_try_make_writable(skb, ihl + sizeof(*tcph) + noff)) in tcf_nat_act() 187 tcph = (void *)(skb_network_header(skb) + ihl); in tcf_nat_act() 188 inet_proto_csum_replace4(&tcph->check, skb, addr, new_addr, in tcf_nat_act()
|
| H A D | sch_cake.c | 953 const struct tcphdr *tcph; in cake_get_tcphdr() local 992 tcph = skb_header_pointer(skb, offset, sizeof(_tcph), &_tcph); in cake_get_tcphdr() 993 if (!tcph || tcph->doff < 5) in cake_get_tcphdr() 997 min(__tcp_hdrlen(tcph), bufsize), buf); in cake_get_tcphdr() 1000 static const void *cake_get_tcpopt(const struct tcphdr *tcph, in cake_get_tcpopt() argument 1004 int length = __tcp_hdrlen(tcph) - sizeof(struct tcphdr); in cake_get_tcpopt() 1005 const u8 *ptr = (const u8 *)(tcph + 1); in cake_get_tcpopt() 1112 static void cake_tcph_get_tstamp(const struct tcphdr *tcph, in cake_tcph_get_tstamp() argument 1118 ptr = cake_get_tcpopt(tcph, TCPOPT_TIMESTAM in cake_tcph_get_tstamp() 1126 cake_tcph_may_drop(const struct tcphdr * tcph,u32 tstamp_new,u32 tsecr_new) cake_tcph_may_drop() argument 1206 const struct tcphdr *tcph, *tcph_check; cake_ack_filter() local [all...] |
| H A D | act_ct.c | 513 struct tcphdr **tcph) in tcf_ct_flow_table_fill_tuple_ipv4() argument 556 *tcph = (void *)(skb_network_header(skb) + thoff); in tcf_ct_flow_table_fill_tuple_ipv4() 586 struct tcphdr **tcph) in tcf_ct_flow_table_fill_tuple_ipv6() argument 625 *tcph = (void *)(skb_network_header(skb) + thoff); in tcf_ct_flow_table_fill_tuple_ipv6() 660 struct tcphdr *tcph = NULL; in tcf_ct_flow_table_lookup() local 668 if (!tcf_ct_flow_table_fill_tuple_ipv4(skb, &tuple, &tcph)) in tcf_ct_flow_table_lookup() 672 if (!tcf_ct_flow_table_fill_tuple_ipv6(skb, &tuple, &tcph)) in tcf_ct_flow_table_lookup() 702 if (tcph && (unlikely(tcph->fin || tcph in tcf_ct_flow_table_lookup() [all...] |
| /linux/tools/testing/selftests/net/tcp_ao/ |
| H A D | icmps-accept.c | 191 } tcph; in icmp_interfere4() member 209 packet_len = sizeof(packet.iphe) + sizeof(packet.tcph); in icmp_interfere4() 212 packet.tcph.sport = dst->sin_port; in icmp_interfere4() 213 packet.tcph.dport = src->sin_port; in icmp_interfere4() 214 packet.tcph.seq = htonl(rcv_nxt); in icmp_interfere4() 306 } tcph; in icmp6_interfere() member 321 packet_len = sizeof(packet.iphe) + sizeof(packet.tcph); in icmp6_interfere() 324 packet.tcph.sport = dst->sin6_port; in icmp6_interfere() 325 packet.tcph.dport = src->sin6_port; in icmp6_interfere() 326 packet.tcph in icmp6_interfere() [all...] |
| H A D | icmps-discard.c | 191 } tcph; in icmp_interfere4() member 209 packet_len = sizeof(packet.iphe) + sizeof(packet.tcph); in icmp_interfere4() 212 packet.tcph.sport = dst->sin_port; in icmp_interfere4() 213 packet.tcph.dport = src->sin_port; in icmp_interfere4() 214 packet.tcph.seq = htonl(rcv_nxt); in icmp_interfere4() 306 } tcph; in icmp6_interfere() member 321 packet_len = sizeof(packet.iphe) + sizeof(packet.tcph); in icmp6_interfere() 324 packet.tcph.sport = dst->sin6_port; in icmp6_interfere() 325 packet.tcph.dport = src->sin6_port; in icmp6_interfere() 326 packet.tcph.seq = htonl(rcv_nxt); in icmp6_interfere()
|
| /linux/tools/testing/selftests/net/lib/ |
| H A D | csum.c | 618 struct tcphdr *tcph = th; in recv_verify_packet_tcp() local 620 if (len < sizeof(*tcph) || tcph->dest != htons(cfg_port_dst)) in recv_verify_packet_tcp() 623 return recv_verify_csum(th, len, ntohs(tcph->source), tcph->check); in recv_verify_packet_tcp()
|