Home
last modified time | relevance | path

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

123

/tools/testing/selftests/bpf/progs/
A Dtest_tc_change_tail.c17 struct iphdr *iph; in parse_ip_header() local
24 iph = (void *)(data + sizeof(struct ethhdr)); in parse_ip_header()
31 if (iph->version != 4) /* Only support IPv4 */ in parse_ip_header()
37 *ip_proto = iph->protocol; in parse_ip_header()
38 return iph; in parse_ip_header()
44 void *hdr = (void *)iph; in parse_udp_header()
48 udp = hdr + (iph->ihl * 4); in parse_udp_header()
63 struct iphdr *iph; in change_tail() local
71 iph = parse_ip_header(skb, &ip_proto); in change_tail()
72 if (!iph) in change_tail()
[all …]
A Dxdping_kern.c66 struct iphdr *iph; in icmp_check() local
74 iph = data + sizeof(*eth); in icmp_check()
79 if (bpf_ntohs(iph->tot_len) - sizeof(*iph) != ICMP_ECHO_LEN) in icmp_check()
97 struct iphdr *iph; in xdping_client() local
111 raddr = iph->saddr; in xdping_client()
139 iph->saddr = iph->daddr; in xdping_client()
140 iph->daddr = raddr; in xdping_client()
159 struct iphdr *iph; in xdping_server() local
170 raddr = iph->saddr; in xdping_server()
174 iph->saddr = iph->daddr; in xdping_server()
[all …]
A Dtest_xdp.c94 if (iph + 1 > data_end) in handle_ipv4()
97 dport = get_dport(iph + 1, data_end, iph->protocol); in handle_ipv4()
124 iph + 1 > data_end) in handle_ipv4()
129 iph->version = 4; in handle_ipv4()
130 iph->ihl = sizeof(*iph) >> 2; in handle_ipv4()
131 iph->frag_off = 0; in handle_ipv4()
133 iph->check = 0; in handle_ipv4()
134 iph->tos = 0; in handle_ipv4()
135 iph->tot_len = bpf_htons(payload_len + sizeof(*iph)); in handle_ipv4()
138 iph->ttl = 8; in handle_ipv4()
[all …]
A Dtest_xdp_loop.c90 if (iph + 1 > data_end) in handle_ipv4()
93 dport = get_dport(iph + 1, data_end, iph->protocol); in handle_ipv4()
120 iph + 1 > data_end) in handle_ipv4()
125 iph->version = 4; in handle_ipv4()
126 iph->ihl = sizeof(*iph) >> 2; in handle_ipv4()
127 iph->frag_off = 0; in handle_ipv4()
129 iph->check = 0; in handle_ipv4()
130 iph->tos = 0; in handle_ipv4()
131 iph->tot_len = bpf_htons(payload_len + sizeof(*iph)); in handle_ipv4()
134 iph->ttl = 8; in handle_ipv4()
[all …]
A Dxdp_flowtable.c32 if (iph->frag_off & bpf_htons(IP_MF | IP_OFFSET)) in xdp_flowtable_offload_check_iphdr()
36 if (iph->ihl * 4 != sizeof(*iph)) in xdp_flowtable_offload_check_iphdr()
39 if (iph->ttl <= 1) in xdp_flowtable_offload_check_iphdr()
84 struct iphdr *iph = data + sizeof(*eth); in xdp_flowtable_do_lookup() local
91 if (!xdp_flowtable_offload_check_iphdr(iph)) in xdp_flowtable_do_lookup()
95 iph->protocol)) in xdp_flowtable_do_lookup()
99 tuple.tos = iph->tos; in xdp_flowtable_do_lookup()
100 tuple.l4_protocol = iph->protocol; in xdp_flowtable_do_lookup()
101 tuple.tot_len = bpf_ntohs(iph->tot_len); in xdp_flowtable_do_lookup()
102 tuple.ipv4_src = iph->saddr; in xdp_flowtable_do_lookup()
[all …]
A 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()
A Dtest_xdp_dynptr.c86 struct iphdr *iph; in handle_ipv4() local
103 if (!iph) in handle_ipv4()
106 dport = get_dport(iph + 1, iph->protocol); in handle_ipv4()
112 vip.daddr.v4 = iph->daddr; in handle_ipv4()
137 iph->version = 4; in handle_ipv4()
138 iph->ihl = iphdr_sz >> 2; in handle_ipv4()
139 iph->frag_off = 0; in handle_ipv4()
141 iph->check = 0; in handle_ipv4()
142 iph->tos = 0; in handle_ipv4()
146 iph->ttl = 8; in handle_ipv4()
[all …]
A 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()
A 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()
A 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()
A 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()
A Dtest_xdp_noinline.c339 struct iphdr *iph; in encap_v4() local
359 iph->version = 4; in encap_v4()
360 iph->ihl = 5; in encap_v4()
363 iph->check = 0; in encap_v4()
364 iph->tos = 1; in encap_v4()
371 iph->ttl = 4; in encap_v4()
414 iph = data + off; in send_icmp_reply()
419 iph->ttl = 4; in send_icmp_reply()
421 iph->daddr = iph->saddr; in send_icmp_reply()
423 iph->check = 0; in send_icmp_reply()
[all …]
A 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()
A 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()
A 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()
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()
294 keys->ip_proto = iph->protocol; in PROG()
[all …]
A 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()
A 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()
/tools/testing/selftests/bpf/prog_tests/
A Dflow_dissector.c20 struct iphdr iph; member
26 struct iphdr iph; member
35 struct iphdr iph; member
41 struct ipv6hdr iph; member
47 struct ipv6hdr iph; member
74 struct iphdr iph; member
103 .iph.ihl = 5,
147 .iph.ihl = 5,
193 .iph.ihl = 5,
220 .iph.ihl = 5,
[all …]
A 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()
A Dxdp_metadata.c142 struct iphdr *iph; in generate_packet() local
168 iph->version = 0x4; in generate_packet()
169 iph->ihl = 0x5; in generate_packet()
170 iph->tos = 0x9; in generate_packet()
171 iph->tot_len = htons(sizeof(*iph) + sizeof(*udph) + UDP_PAYLOAD_BYTES); in generate_packet()
172 iph->id = 0; in generate_packet()
173 iph->frag_off = 0; in generate_packet()
174 iph->ttl = 0; in generate_packet()
178 iph->check = build_ip_csum(iph); in generate_packet()
183 udph->check = ~csum_tcpudp_magic(iph->saddr, iph->daddr, in generate_packet()
[all …]
/tools/testing/selftests/net/
A 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 …]
A Dgro.c264 memset(iph, 0, sizeof(*iph)); in fill_networklayer()
267 iph->ihl = 5; in fill_networklayer()
268 iph->ttl = 8; in fill_networklayer()
416 iph->tot_len = htons(ntohs(iph->tot_len) + extlen); in recompute_packet()
418 iph->check = checksum_fold(iph, sizeof(struct iphdr), 0); in recompute_packet()
600 iph->tot_len = htons(ntohs(iph->tot_len) + optlen); in add_ipv4_ts_option()
627 iph->check = checksum_fold(iph, sizeof(struct iphdr), 0); in fix_ip4_checksum()
785 iph->check = checksum_fold(iph, sizeof(struct iphdr), 0); in send_fragment4()
800 iph->ttl = 7; in send_changed_ttl()
802 iph->check = checksum_fold(iph, sizeof(struct iphdr), 0); in send_changed_ttl()
[all …]
A 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 …]
/tools/testing/selftests/net/tcp_ao/
A Dicmps-discard.c168 iph->version = 4; in set_ip4hdr()
169 iph->ihl = 5; in set_ip4hdr()
170 iph->tos = 0; in set_ip4hdr()
172 iph->ttl = 2; in set_ip4hdr()
173 iph->protocol = proto; in set_ip4hdr()
176 iph->check = checksum4_fold((void *)iph, iph->ihl << 1, 0); in set_ip4hdr()
184 struct iphdr iph; in icmp_interfere4() member
232 iph->version = 6; in set_ip6hdr()
234 iph->nexthdr = proto; in set_ip6hdr()
235 iph->hop_limit = 2; in set_ip6hdr()
[all …]
/tools/testing/selftests/bpf/
A Dnetwork_helpers.h48 struct iphdr iph; member
56 struct ipv6hdr iph; member
137 static inline __sum16 build_ip_csum(struct iphdr *iph) in build_ip_csum() argument
142 iph->check = 0; in build_ip_csum()
143 p = (void *)iph; in build_ip_csum()
144 sum = csum_partial(p, iph->ihl << 2, 0); in build_ip_csum()
224 static inline __sum16 build_udp_v4_csum(const struct iphdr *iph, in build_udp_v4_csum() argument
230 return csum_tcpudp_magic(iph->saddr, iph->daddr, ntohs(udph->len), in build_udp_v4_csum()

Completed in 731 milliseconds

123