Home
last modified time | relevance | path

Searched refs:iph (Results 1 – 25 of 49) sorted by relevance

12

/tools/testing/selftests/bpf/progs/
Dxdping_kern.c65 struct iphdr *iph; in icmp_check() local
67 if (data + sizeof(*eth) + sizeof(*iph) + ICMP_ECHO_LEN > data_end) in icmp_check()
73 iph = data + sizeof(*eth); in icmp_check()
75 if (iph->protocol != IPPROTO_ICMP) in icmp_check()
78 if (bpf_ntohs(iph->tot_len) - sizeof(*iph) != ICMP_ECHO_LEN) in icmp_check()
81 icmph = data + sizeof(*eth) + sizeof(*iph); in icmp_check()
96 struct iphdr *iph; in xdping_client() local
108 iph = data + sizeof(*eth); in xdping_client()
109 icmph = data + sizeof(*eth) + sizeof(*iph); in xdping_client()
110 raddr = iph->saddr; in xdping_client()
[all …]
Dtest_xdp.c85 struct iphdr *iph = data + sizeof(struct ethhdr); in handle_ipv4() local
93 if (iph + 1 > data_end) in handle_ipv4()
96 dport = get_dport(iph + 1, data_end, iph->protocol); in handle_ipv4()
100 vip.protocol = iph->protocol; in handle_ipv4()
102 vip.daddr.v4 = iph->daddr; in handle_ipv4()
104 payload_len = bpf_ntohs(iph->tot_len); in handle_ipv4()
118 iph = data + sizeof(*new_eth); in handle_ipv4()
119 old_eth = data + sizeof(*iph); in handle_ipv4()
123 iph + 1 > data_end) in handle_ipv4()
128 iph->version = 4; in handle_ipv4()
[all …]
Dtest_xdp_loop.c81 struct iphdr *iph = data + sizeof(struct ethhdr); in handle_ipv4() local
89 if (iph + 1 > data_end) in handle_ipv4()
92 dport = get_dport(iph + 1, data_end, iph->protocol); in handle_ipv4()
96 vip.protocol = iph->protocol; in handle_ipv4()
98 vip.daddr.v4 = iph->daddr; in handle_ipv4()
100 payload_len = bpf_ntohs(iph->tot_len); in handle_ipv4()
114 iph = data + sizeof(*new_eth); in handle_ipv4()
115 old_eth = data + sizeof(*iph); in handle_ipv4()
119 iph + 1 > data_end) in handle_ipv4()
124 iph->version = 4; in handle_ipv4()
[all …]
Dtest_lwt_ip_encap.c19 struct iphdr iph; in bpf_lwt_encap_gre() member
26 hdr.iph.ihl = 5; in bpf_lwt_encap_gre()
27 hdr.iph.version = 4; in bpf_lwt_encap_gre()
28 hdr.iph.ttl = 0x40; in bpf_lwt_encap_gre()
29 hdr.iph.protocol = 47; /* IPPROTO_GRE */ in bpf_lwt_encap_gre()
31 hdr.iph.saddr = 0x640110ac; /* 172.16.1.100 */ in bpf_lwt_encap_gre()
32 hdr.iph.daddr = 0x641010ac; /* 172.16.16.100 */ in bpf_lwt_encap_gre()
34 hdr.iph.saddr = 0xac100164; /* 172.16.1.100 */ in bpf_lwt_encap_gre()
35 hdr.iph.daddr = 0xac101064; /* 172.16.16.100 */ in bpf_lwt_encap_gre()
39 hdr.iph.tot_len = bpf_htons(skb->len + sizeof(struct encap_hdr)); in bpf_lwt_encap_gre()
Dtest_xdp_dynptr.c86 struct iphdr *iph; in handle_ipv4() local
99 iph = bpf_dynptr_slice(xdp_ptr, ethhdr_sz, iph_buffer_udp, sizeof(iph_buffer_udp)); in handle_ipv4()
101 iph = bpf_dynptr_slice(xdp_ptr, ethhdr_sz, iph_buffer_tcp, sizeof(iph_buffer_tcp)); in handle_ipv4()
103 if (!iph) in handle_ipv4()
106 dport = get_dport(iph + 1, iph->protocol); in handle_ipv4()
110 vip.protocol = iph->protocol; in handle_ipv4()
112 vip.daddr.v4 = iph->daddr; in handle_ipv4()
114 payload_len = bpf_ntohs(iph->tot_len); in handle_ipv4()
129 iph = (struct iphdr *)(new_eth + 1); in handle_ipv4()
130 old_eth = (struct ethhdr *)(iph + 1); in handle_ipv4()
[all …]
Dload_bytes_relative.c24 struct iphdr iph; in load_bytes_relative() local
34 if (bpf_skb_load_bytes_relative(skb, 0, &iph, sizeof(iph), in load_bytes_relative()
38 if (bpf_skb_load_bytes_relative(skb, 0xffff, &iph, sizeof(iph), in load_bytes_relative()
Dtest_lwt_reroute.c15 struct iphdr *iph = NULL; in test_lwt_reroute() local
23 if (start + sizeof(*iph) > end) in test_lwt_reroute()
26 iph = (struct iphdr *)start; in test_lwt_reroute()
27 skb->mark = bpf_ntohl(iph->daddr) & 0xff; in test_lwt_reroute()
Dtest_tc_edt.c83 struct iphdr *iph; in handle_ipv4() local
89 iph = (struct iphdr *)(data + sizeof(struct ethhdr)); in handle_ipv4()
90 if ((void *)(iph + 1) > data_end) in handle_ipv4()
92 ihl = iph->ihl * 4; in handle_ipv4()
93 if (((void *)iph) + ihl > data_end) in handle_ipv4()
96 if (iph->protocol == IPPROTO_TCP) in handle_ipv4()
97 return handle_tcp(skb, (struct tcphdr *)(((void *)iph) + ihl)); in handle_ipv4()
Dip_check_defrag.c22 static bool is_frag_v4(struct iphdr *iph) in is_frag_v4() argument
27 offset = bpf_ntohs(iph->frag_off); in is_frag_v4()
49 struct iphdr *iph; in handle_v4() local
54 iph = bpf_dynptr_slice(&ptr, 0, iph_buf, sizeof(iph_buf)); in handle_v4()
55 if (!iph) in handle_v4()
59 if (is_frag_v4(iph)) { in handle_v4()
Dtest_xdp_noinline.c330 struct iphdr *iph; in encap_v4() local
342 iph = data + sizeof(struct eth_hdr); in encap_v4()
345 old_eth + 1 > data_end || iph + 1 > data_end) in encap_v4()
350 iph->version = 4; in encap_v4()
351 iph->ihl = 5; in encap_v4()
352 iph->frag_off = 0; in encap_v4()
353 iph->protocol = IPPROTO_IPIP; in encap_v4()
354 iph->check = 0; in encap_v4()
355 iph->tos = 1; in encap_v4()
356 iph->tot_len = bpf_htons(pkt_bytes + sizeof(struct iphdr)); in encap_v4()
[all …]
Dvrf_socket_lookup.c23 struct iphdr *iph; in socket_lookup() local
32 iph = (struct iphdr *)(eth + 1); in socket_lookup()
33 if (iph + 1 > data_end) in socket_lookup()
36 tp = (struct bpf_sock_tuple *)&iph->saddr; in socket_lookup()
41 switch (iph->protocol) { in socket_lookup()
Dtest_queue_stack_map.h39 struct iphdr *iph = (struct iphdr *)(eth + 1); in _test() local
41 if (iph + 1 > data_end) in _test()
48 iph->daddr = value; in _test()
50 err = bpf_map_push_elem(&map_out, &iph->saddr, 0); in _test()
Dbpf_flow.c152 struct iphdr *iph, _iph; in _dissect() local
154 iph = bpf_flow_dissect_get_header(skb, sizeof(*iph), &_iph); in _dissect()
155 if (iph && iph->ihl == 5 && in _dissect()
156 iph->saddr == bpf_htonl(FLOW_CONTINUE_SADDR)) { in _dissect()
280 struct iphdr *iph, _iph; in PROG() local
283 iph = bpf_flow_dissect_get_header(skb, sizeof(*iph), &_iph); in PROG()
284 if (!iph) in PROG()
288 if (iph->ihl < 5) in PROG()
292 keys->ipv4_src = iph->saddr; in PROG()
293 keys->ipv4_dst = iph->daddr; in PROG()
[all …]
Dtest_lwt_redirect.c29 struct iphdr *iph = NULL; in get_redirect_target() local
33 if (start + sizeof(*iph) > end) in get_redirect_target()
36 iph = (struct iphdr *)start; in get_redirect_target()
37 return bpf_ntohl(iph->daddr) & 0xff; in get_redirect_target()
Dxdp_hw_metadata.c31 struct iphdr *iph = NULL; in rx() local
40 iph = (void *)(eth + 1); in rx()
41 if (iph + 1 < data_end && iph->protocol == IPPROTO_UDP) in rx()
42 udp = (void *)(iph + 1); in rx()
Dtest_assign_reuse.c118 struct iphdr *iph = (struct iphdr *)(data + sizeof(*eth)); in tc_main() local
120 if (iph + 1 > data_end) in tc_main()
123 if (iph->protocol == IPPROTO_TCP) in tc_main()
124 return maybe_assign_tcp(skb, (struct tcphdr *)(iph + 1)); in tc_main()
125 else if (iph->protocol == IPPROTO_UDP) in tc_main()
126 return maybe_assign_udp(skb, (struct udphdr *)(iph + 1)); in tc_main()
Dtest_pkt_access.c116 struct iphdr *iph = (struct iphdr *)(eth + 1); in test_pkt_access() local
118 if (iph + 1 > data_end) in test_pkt_access()
120 ihl_len = iph->ihl * 4; in test_pkt_access()
121 proto = iph->protocol; in test_pkt_access()
122 tcp = (struct tcphdr *)((void *)(iph) + ihl_len); in test_pkt_access()
/tools/testing/selftests/bpf/prog_tests/
Dflow_dissector.c46 struct iphdr iph; member
52 struct iphdr iph; member
61 struct iphdr iph; member
67 struct ipv6hdr iph; member
73 struct ipv6hdr iph; member
89 struct ipv6hdr iph; member
116 .iph.ihl = 5,
117 .iph.protocol = IPPROTO_TCP,
118 .iph.tot_len = __bpf_constant_htons(MAGIC_BYTES),
138 .iph.nexthdr = IPPROTO_TCP,
[all …]
Dxdp_metadata.c122 static void ip_csum(struct iphdr *iph) in ip_csum() argument
128 iph->check = 0; in ip_csum()
129 p = (void *)iph; in ip_csum()
130 for (i = 0; i < sizeof(*iph) / sizeof(*p); i++) in ip_csum()
136 iph->check = ~sum; in ip_csum()
144 struct iphdr *iph; in generate_packet() local
159 iph = (void *)(eth + 1); in generate_packet()
160 udph = (void *)(iph + 1); in generate_packet()
166 iph->version = 0x4; in generate_packet()
167 iph->ihl = 0x5; in generate_packet()
[all …]
Dqueue_stack_map.c17 struct iphdr iph; in test_queue_stack_map_by_type() local
62 pkt_v4.iph.saddr = vals[i] * 5; in test_queue_stack_map_by_type()
65 pkt_v4.iph.saddr = vals[MAP_SIZE - 1 - i] * 5; in test_queue_stack_map_by_type()
73 memcpy(&iph, buf + sizeof(struct ethhdr), sizeof(iph)); in test_queue_stack_map_by_type()
74 if (iph.daddr != val) in test_queue_stack_map_by_type()
82 ASSERT_EQ(iph.daddr, val, "bpf_map_pop_elem iph.daddr"); in test_queue_stack_map_by_type()
100 pkt_v4.iph.saddr = 0; in test_queue_stack_map_by_type()
Dxdp.c15 struct iphdr iph; in test_xdp() local
36 memcpy(&iph, buf + sizeof(struct ethhdr), sizeof(iph)); in test_xdp()
40 ASSERT_EQ(iph.protocol, IPPROTO_IPIP, "ipv4 test_run iph.protocol"); in test_xdp()
/tools/testing/selftests/net/
Dtxring_overwrite.c45 struct iphdr *iph; in build_packet() local
54 iph = buffer + off; in build_packet()
55 iph->ttl = 8; in build_packet()
56 iph->ihl = 5; in build_packet()
57 iph->version = 4; in build_packet()
58 iph->saddr = htonl(INADDR_LOOPBACK); in build_packet()
59 iph->daddr = htonl(INADDR_LOOPBACK + 1); in build_packet()
60 iph->protocol = IPPROTO_UDP; in build_packet()
61 iph->tot_len = htons(blen - off); in build_packet()
62 iph->check = 0; in build_packet()
[all …]
Dgro.c224 struct iphdr *iph = buf; in fill_networklayer() local
238 memset(iph, 0, sizeof(*iph)); in fill_networklayer()
240 iph->version = 4; in fill_networklayer()
241 iph->ihl = 5; in fill_networklayer()
242 iph->ttl = 8; in fill_networklayer()
243 iph->protocol = IPPROTO_TCP; in fill_networklayer()
244 iph->tot_len = htons(sizeof(struct tcphdr) + in fill_networklayer()
246 iph->frag_off = htons(0x4000); /* DF = 1, MF = 0 */ in fill_networklayer()
247 if (inet_pton(AF_INET, addr4_src, &iph->saddr) != 1) in fill_networklayer()
249 if (inet_pton(AF_INET, addr4_dst, &iph->daddr) != 1) in fill_networklayer()
[all …]
Dpsock_snd.c119 struct iphdr *iph = header; in build_ipv4_header() local
121 iph->ihl = 5; in build_ipv4_header()
122 iph->version = 4; in build_ipv4_header()
123 iph->ttl = 8; in build_ipv4_header()
124 iph->tot_len = htons(sizeof(*iph) + sizeof(struct udphdr) + payload_len); in build_ipv4_header()
125 iph->id = htons(1337); in build_ipv4_header()
126 iph->protocol = IPPROTO_UDP; in build_ipv4_header()
127 iph->saddr = htonl((172 << 24) | (17 << 16) | 2); in build_ipv4_header()
128 iph->daddr = htonl((172 << 24) | (17 << 16) | 1); in build_ipv4_header()
129 iph->check = build_ip_csum((void *) iph, iph->ihl << 1, 0); in build_ipv4_header()
[all …]
Dcsum.c189 struct iphdr *iph = _iph; in build_packet_ipv4() local
191 memset(iph, 0, sizeof(*iph)); in build_packet_ipv4()
193 iph->version = 4; in build_packet_ipv4()
194 iph->ihl = 5; in build_packet_ipv4()
195 iph->ttl = 8; in build_packet_ipv4()
196 iph->protocol = proto; in build_packet_ipv4()
197 iph->saddr = cfg_saddr4.sin_addr.s_addr; in build_packet_ipv4()
198 iph->daddr = cfg_daddr4.sin_addr.s_addr; in build_packet_ipv4()
199 iph->tot_len = htons(sizeof(*iph) + len); in build_packet_ipv4()
200 iph->check = checksum_fold(iph, sizeof(*iph), 0); in build_packet_ipv4()
[all …]

12