Home
last modified time | relevance | path

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

12

/external/iproute2/ip/
Diptunnel.c52 if (p->iph.protocol && p->iph.protocol != proto) { in set_tunnel_proto()
57 p->iph.protocol = proto; in set_tunnel_proto()
67 p->iph.version = 4; in parse_args()
68 p->iph.ihl = 5; in parse_args()
72 p->iph.frag_off = htons(IP_DF); in parse_args()
125 p->iph.frag_off = 0; in parse_args()
127 p->iph.frag_off = htons(IP_DF); in parse_args()
131 p->iph.daddr = get_addr32(*argv); in parse_args()
133 p->iph.daddr = htonl(INADDR_ANY); in parse_args()
137 p->iph.saddr = get_addr32(*argv); in parse_args()
[all …]
/external/linux-kselftest/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()
97 struct iphdr *iph; in xdping_client() local
109 iph = data + sizeof(*eth); in xdping_client()
110 icmph = data + sizeof(*eth) + sizeof(*iph); in xdping_client()
111 raddr = iph->saddr; in xdping_client()
[all …]
Dtest_xdp_loop.c83 struct iphdr *iph = data + sizeof(struct ethhdr); in handle_ipv4() local
91 if (iph + 1 > data_end) in handle_ipv4()
94 dport = get_dport(iph + 1, data_end, iph->protocol); in handle_ipv4()
98 vip.protocol = iph->protocol; in handle_ipv4()
100 vip.daddr.v4 = iph->daddr; in handle_ipv4()
102 payload_len = bpf_ntohs(iph->tot_len); in handle_ipv4()
116 iph = data + sizeof(*new_eth); in handle_ipv4()
117 old_eth = data + sizeof(*iph); in handle_ipv4()
121 iph + 1 > data_end) in handle_ipv4()
126 iph->version = 4; in handle_ipv4()
[all …]
Dtest_xdp.c87 struct iphdr *iph = data + sizeof(struct ethhdr); in handle_ipv4() local
95 if (iph + 1 > data_end) in handle_ipv4()
98 dport = get_dport(iph + 1, data_end, iph->protocol); in handle_ipv4()
102 vip.protocol = iph->protocol; in handle_ipv4()
104 vip.daddr.v4 = iph->daddr; in handle_ipv4()
106 payload_len = bpf_ntohs(iph->tot_len); in handle_ipv4()
120 iph = data + sizeof(*new_eth); in handle_ipv4()
121 old_eth = data + sizeof(*iph); in handle_ipv4()
125 iph + 1 > data_end) in handle_ipv4()
130 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_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 …]
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()
Dtest_pkt_access.c64 struct iphdr *iph = (struct iphdr *)(eth + 1); in test_pkt_access() local
66 if (iph + 1 > data_end) in test_pkt_access()
68 ihl_len = iph->ihl * 4; in test_pkt_access()
69 proto = iph->protocol; in test_pkt_access()
70 tcp = (struct tcphdr *)((void *)(iph) + ihl_len); in test_pkt_access()
Dtest_l4lb_noinline.c262 struct iphdr *iph; in parse_icmp() local
271 iph = data + off; in parse_icmp()
272 if (iph + 1 > data_end) in parse_icmp()
274 if (iph->ihl != 5) in parse_icmp()
276 pckt->proto = iph->protocol; in parse_icmp()
278 pckt->src = iph->daddr; in parse_icmp()
279 pckt->dst = iph->saddr; in parse_icmp()
339 struct iphdr *iph; in process_packet() local
371 iph = data + off; in process_packet()
372 if (iph + 1 > data_end) in process_packet()
[all …]
Dtest_l4lb.c262 struct iphdr *iph; in parse_icmp() local
271 iph = data + off; in parse_icmp()
272 if (iph + 1 > data_end) in parse_icmp()
274 if (iph->ihl != 5) in parse_icmp()
276 pckt->proto = iph->protocol; in parse_icmp()
278 pckt->src = iph->daddr; in parse_icmp()
279 pckt->dst = iph->saddr; in parse_icmp()
339 struct iphdr *iph; in process_packet() local
371 iph = data + off; in process_packet()
372 if (iph + 1 > data_end) in process_packet()
[all …]
Dbpf_flow.c266 struct iphdr *iph, _iph; in PROG() local
269 iph = bpf_flow_dissect_get_header(skb, sizeof(*iph), &_iph); in PROG()
270 if (!iph) in PROG()
274 if (iph->ihl < 5) in PROG()
278 keys->ipv4_src = iph->saddr; in PROG()
279 keys->ipv4_dst = iph->daddr; in PROG()
280 keys->ip_proto = iph->protocol; in PROG()
282 keys->thoff += iph->ihl << 2; in PROG()
286 if (iph->frag_off & bpf_htons(IP_MF | IP_OFFSET)) { in PROG()
288 if (iph->frag_off & bpf_htons(IP_OFFSET)) { in PROG()
[all …]
Dtest_queue_stack_map.h41 struct iphdr *iph = (struct iphdr *)(eth + 1); in _test() local
43 if (iph + 1 > data_end) in _test()
50 iph->daddr = value; in _test()
52 err = bpf_map_push_elem(&map_out, &iph->saddr, 0); in _test()
Dtest_tunnel_kern.c530 struct iphdr *iph = data; in _ipip_set_tunnel() local
531 struct tcphdr *tcp = data + sizeof(*iph); in _ipip_set_tunnel()
536 if (data + sizeof(*iph) + sizeof(*tcp) > data_end) { in _ipip_set_tunnel()
542 if (iph->protocol == IPPROTO_ICMP) { in _ipip_set_tunnel()
545 if (iph->protocol != IPPROTO_TCP || iph->ihl != 5) in _ipip_set_tunnel()
587 struct iphdr *iph = data; in _ipip6_set_tunnel() local
588 struct tcphdr *tcp = data + sizeof(*iph); in _ipip6_set_tunnel()
593 if (data + sizeof(*iph) + sizeof(*tcp) > data_end) { in _ipip6_set_tunnel()
636 struct ipv6hdr *iph = data; in _ip6ip6_set_tunnel() local
637 struct tcphdr *tcp = data + sizeof(*iph); in _ip6ip6_set_tunnel()
[all …]
Dtest_sk_lookup_kern.c31 struct iphdr *iph = (struct iphdr *)(data + nh_off); in get_tuple() local
33 if (iph + 1 > data_end) in get_tuple()
35 ihl_len = iph->ihl * 4; in get_tuple()
36 proto = iph->protocol; in get_tuple()
38 result = (struct bpf_sock_tuple *)&iph->saddr; in get_tuple()
/external/linux-kselftest/tools/testing/selftests/bpf/prog_tests/
Dflow_dissector.c40 struct iphdr iph; member
46 struct iphdr iph; member
55 struct iphdr iph; member
61 struct ipv6hdr iph; member
67 struct ipv6hdr iph; member
83 struct ipv6hdr iph; member
108 .iph.ihl = 5,
109 .iph.protocol = IPPROTO_TCP,
110 .iph.tot_len = __bpf_constant_htons(MAGIC_BYTES),
129 .iph.nexthdr = IPPROTO_TCP,
[all …]
Dqueue_stack_map.c16 struct iphdr *iph = (void *)buf + sizeof(struct ethhdr); in test_queue_stack_map_by_type() local
54 pkt_v4.iph.saddr = vals[i] * 5; in test_queue_stack_map_by_type()
57 pkt_v4.iph.saddr = vals[MAP_SIZE - 1 - i] * 5; in test_queue_stack_map_by_type()
63 iph->daddr != val) in test_queue_stack_map_by_type()
67 CHECK(err || retval || size != sizeof(pkt_v4) || iph->daddr != val, in test_queue_stack_map_by_type()
70 err, errno, retval, size, iph->daddr); in test_queue_stack_map_by_type()
91 pkt_v4.iph.saddr = 0; in test_queue_stack_map_by_type()
/external/wpa_supplicant_8/src/ap/
Dfils_hlp.c161 struct ip *iph; in fils_dhcp_handler() local
254 sizeof(*iph) + sizeof(*udph) + (end - pos) + 2); in fils_dhcp_handler()
261 iph = wpabuf_put(resp, sizeof(*iph)); in fils_dhcp_handler()
262 iph->ip_v = 4; in fils_dhcp_handler()
263 iph->ip_hl = sizeof(*iph) / 4; in fils_dhcp_handler()
264 iph->ip_len = htons(sizeof(*iph) + sizeof(*udph) + (end - pos)); in fils_dhcp_handler()
265 iph->ip_ttl = 1; in fils_dhcp_handler()
266 iph->ip_p = 17; /* UDP */ in fils_dhcp_handler()
267 iph->ip_src.s_addr = hapd->conf->dhcp_server.u.v4.s_addr; in fils_dhcp_handler()
268 iph->ip_dst.s_addr = dhcp->client_ip; in fils_dhcp_handler()
[all …]
/external/linux-kselftest/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 …]
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 …]
Dmsg_zerocopy.c257 static int setup_iph(struct iphdr *iph, uint16_t payload_len) in setup_iph() argument
262 memset(iph, 0, sizeof(*iph)); in setup_iph()
264 iph->version = 4; in setup_iph()
265 iph->tos = 0; in setup_iph()
266 iph->ihl = 5; in setup_iph()
267 iph->ttl = 2; in setup_iph()
268 iph->saddr = saddr->sin_addr.s_addr; in setup_iph()
269 iph->daddr = daddr->sin_addr.s_addr; in setup_iph()
270 iph->protocol = IPPROTO_EGP; in setup_iph()
271 iph->tot_len = htons(sizeof(*iph) + payload_len); in setup_iph()
[all …]
/external/iptables/iptables/
Dxtables-monitor.c323 const struct iphdr *iph; in trace_print_packet() local
333 if (len < sizeof(*iph)) in trace_print_packet()
335 iph = (const void *)ip6h; in trace_print_packet()
338 inet_ntop(AF_INET, &iph->saddr, addrbuf, sizeof(addrbuf)); in trace_print_packet()
340 inet_ntop(AF_INET, &iph->daddr, addrbuf, sizeof(addrbuf)); in trace_print_packet()
343 printf("LEN=%d TOS=0x%x TTL=%d ID=%d", ntohs(iph->tot_len), iph->tos, iph->ttl, ntohs(iph->id)); in trace_print_packet()
344 if (iph->frag_off & htons(0x8000)) in trace_print_packet()
346 if (iph->frag_off & htons(IP_DF)) in trace_print_packet()
348 if (iph->frag_off & htons(IP_MF)) in trace_print_packet()
351 if (ntohs(iph->frag_off) & 0x1fff) in trace_print_packet()
[all …]
/external/iputils/Modules/
Dpg3.c245 struct iphdr *iph; in fill_packet() local
257 iph = (struct iphdr*)skb_put(skb, sizeof( struct iphdr)); in fill_packet()
272 iph->ihl=5; in fill_packet()
273 iph->version=4; in fill_packet()
274 iph->ttl=3; in fill_packet()
275 iph->tos=0; in fill_packet()
276 iph->protocol = IPPROTO_UDP; /* UDP */ in fill_packet()
277 iph->saddr = saddr; in fill_packet()
278 iph->daddr = in_aton(pg_dst); in fill_packet()
279 iph->frag_off = 0; in fill_packet()
[all …]
/external/linux-kselftest/tools/testing/selftests/bpf/
Dtest_flow_dissector.c169 struct iphdr *iph = header; in build_ipv4_header() local
171 iph->ihl = 5; in build_ipv4_header()
172 iph->version = 4; in build_ipv4_header()
173 iph->tos = tos; in build_ipv4_header()
174 iph->ttl = 8; in build_ipv4_header()
175 iph->tot_len = htons(sizeof(*iph) + payload_len); in build_ipv4_header()
176 iph->id = htons(1337); in build_ipv4_header()
177 iph->protocol = proto; in build_ipv4_header()
178 iph->saddr = src; in build_ipv4_header()
179 iph->daddr = dst; in build_ipv4_header()
[all …]
/external/toybox/toys/pending/
Ddhcp.c169 struct iphdr iph; member
660 if (bytes < (int) (sizeof(packet.iph) + sizeof(packet.udph))) { in read_raw()
664 if (bytes < ntohs(packet.iph.tot_len)) { in read_raw()
669 bytes = ntohs(packet.iph.tot_len); in read_raw()
671 if (packet.iph.protocol != IPPROTO_UDP || packet.iph.version != IPVERSION in read_raw()
672 || packet.iph.ihl != (sizeof(packet.iph) >> 2) in read_raw()
674 || ntohs(packet.udph.len) != (uint16_t)(bytes - sizeof(packet.iph))) { in read_raw()
679 if (dhcp_checksum(&packet.iph, sizeof(packet.iph)) != 0) { in read_raw()
687 memset(&packet.iph, 0, ((size_t) &((struct iphdr *)0)->protocol)); in read_raw()
688 packet.iph.check = 0; in read_raw()
[all …]
Dip.c2453 printf("%s: %s/ip", ptnl->name, ptnl->iph.protocol == IPPROTO_IPIP ? "ip" : in display_tunnel()
2454 (ptnl->iph.protocol == IPPROTO_GRE ? "gre" : in display_tunnel()
2455 (ptnl->iph.protocol == IPPROTO_IPV6 ? "ipv6" : "unknown"))); in display_tunnel()
2456 printf(" remote %s local %s ", ptnl->iph.daddr ? in display_tunnel()
2457 inet_ntop(AF_INET, &ptnl->iph.daddr, rmt_addr, sizeof(rmt_addr)) : "any", in display_tunnel()
2458 ptnl->iph.saddr ? inet_ntop(AF_INET, &ptnl->iph.saddr, lcl_addr, in display_tunnel()
2470 if (ptnl->iph.ttl) printf(" ttl %d ", ptnl->iph.ttl); in display_tunnel()
2473 if (ptnl->iph.tos) { in display_tunnel()
2475 if (ptnl->iph.tos & 1) printf(" inherit"); in display_tunnel()
2476 if (ptnl->iph.tos & ~1) printf("%c%s ", ptnl->iph.tos & 1 ? '/' : ' ', in display_tunnel()
[all …]

12