Home
last modified time | relevance | path

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

1234567891011

/linux/net/xfrm/
H A Dxfrm_inout.h11 const struct iphdr *iph = ip_hdr(skb); in xfrm4_extract_header() local
13 XFRM_MODE_SKB_CB(skb)->ihl = sizeof(*iph); in xfrm4_extract_header()
14 XFRM_MODE_SKB_CB(skb)->id = iph->id; in xfrm4_extract_header()
15 XFRM_MODE_SKB_CB(skb)->frag_off = iph->frag_off; in xfrm4_extract_header()
16 XFRM_MODE_SKB_CB(skb)->tos = iph->tos; in xfrm4_extract_header()
17 XFRM_MODE_SKB_CB(skb)->ttl = iph->ttl; in xfrm4_extract_header()
18 XFRM_MODE_SKB_CB(skb)->optlen = iph->ihl * 4 - sizeof(*iph); in xfrm4_extract_header()
26 struct ipv6hdr *iph = ipv6_hdr(skb); in xfrm6_extract_header() local
28 XFRM_MODE_SKB_CB(skb)->ihl = sizeof(*iph); in xfrm6_extract_header()
31 XFRM_MODE_SKB_CB(skb)->tos = ipv6_get_dsfield(iph); in xfrm6_extract_header()
[all …]
/linux/tools/testing/selftests/bpf/progs/
H A Dicmp_send.c25 struct iphdr *iph; in egress() local
36 iph = data; in egress()
37 if ((void *)(iph + 1) > data_end || in egress()
38 iph->protocol != IPPROTO_TCP || in egress()
39 iph->daddr != bpf_htonl(SERVER_IP)) in egress()
42 tcph = (void *)iph + iph->ihl * 4; in egress()
79 struct iphdr *iph; in recursion() local
85 iph = data; in recursion()
86 if ((void *)(iph + 1) > data_end || iph->version != 4) in recursion()
89 if (iph->daddr != bpf_htonl(SERVER_IP)) in recursion()
[all …]
H A Dxdping_kern.c
H A Dtest_xdp.c86 struct iphdr *iph = data + sizeof(struct ethhdr); in handle_ipv4() local
94 if (iph + 1 > data_end) in handle_ipv4()
97 dport = get_dport(iph + 1, data_end, iph->protocol); in handle_ipv4()
101 vip.protocol = iph->protocol; in handle_ipv4()
103 vip.daddr.v4 = iph->daddr; in handle_ipv4()
105 payload_len = bpf_ntohs(iph->tot_len); in handle_ipv4()
119 iph = data + sizeof(*new_eth); in handle_ipv4()
120 old_eth = data + sizeof(*iph); in handle_ipv4()
124 iph + 1 > data_end) in handle_ipv4()
129 iph->version = 4; in handle_ipv4()
[all …]
H A Dtest_xdp_loop.c82 struct iphdr *iph = data + sizeof(struct ethhdr); in handle_ipv4() local
90 if (iph + 1 > data_end) in handle_ipv4()
93 dport = get_dport(iph + 1, data_end, iph->protocol); in handle_ipv4()
97 vip.protocol = iph->protocol; in handle_ipv4()
99 vip.daddr.v4 = iph->daddr; in handle_ipv4()
101 payload_len = bpf_ntohs(iph->tot_len); in handle_ipv4()
115 iph = data + sizeof(*new_eth); in handle_ipv4()
116 old_eth = data + sizeof(*iph); in handle_ipv4()
120 iph + 1 > data_end) in handle_ipv4()
125 iph->version = 4; in handle_ipv4()
[all …]
H 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()
27 if ((void *)(data + sizeof(struct ethhdr) + sizeof(*iph)) > data_end) in parse_ip_header()
31 if (iph->version != 4) /* Only support IPv4 */ in parse_ip_header()
34 if (iph->ihl < 5) /* Minimum IP header length */ in parse_ip_header()
37 *ip_proto = iph->protocol; in parse_ip_header()
38 return iph; in parse_ip_header()
41 static __always_inline struct udphdr *parse_udp_header(struct __sk_buff *skb, struct iphdr *iph) in parse_udp_header() argument
44 void *hdr = (void *)iph; in parse_udp_header()
48 udp = hdr + (iph->ihl * 4); in parse_udp_header()
[all …]
H A Dxdp_flowtable.c32 static bool xdp_flowtable_offload_check_iphdr(struct iphdr *iph) in xdp_flowtable_offload_check_iphdr()
35 if (iph->frag_off & bpf_htons(IP_MF | IP_OFFSET)) in xdp_flowtable_offload_check_iphdr()
39 if (iph->ihl * 4 != sizeof(*iph)) in xdp_flowtable_offload_check_iphdr()
42 if (iph->ttl <= 1) in xdp_flowtable_offload_check_iphdr()
87 struct iphdr *iph = data + sizeof(*eth); in xdp_flowtable_do_lookup()
89 ports = (struct flow_ports___local *)(iph + 1); in xdp_flowtable_do_lookup()
94 if (!xdp_flowtable_offload_check_iphdr(iph)) in xdp_flowtable_do_lookup()
98 iph->protocol)) in xdp_flowtable_do_lookup()
102 tuple.tos = iph in xdp_flowtable_do_lookup()
29 xdp_flowtable_offload_check_iphdr(struct iphdr * iph) xdp_flowtable_offload_check_iphdr() argument
84 struct iphdr *iph = data + sizeof(*eth); xdp_flowtable_do_lookup() local
[all...]
H A 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 …]
H A Dtest_lwt_ip_encap.c17 struct iphdr iph; in bpf_lwt_encap_gre()
24 hdr.iph.ihl = 5; in bpf_lwt_encap_gre()
25 hdr.iph.version = 4; in bpf_lwt_encap_gre()
26 hdr.iph.ttl = 0x40; in bpf_lwt_encap_gre()
27 hdr.iph.protocol = 47; /* IPPROTO_GRE */ in bpf_lwt_encap_gre()
29 hdr.iph.saddr = 0x640110ac; /* 172.16.1.100 */ in bpf_lwt_encap_gre()
30 hdr.iph.daddr = 0x641010ac; /* 172.16.16.100 */ in bpf_lwt_encap_gre()
32 hdr.iph.saddr = 0xac100164; /* 172.16.1.100 */ in bpf_lwt_encap_gre()
33 hdr.iph.daddr = 0xac101064; /* 172.16.16.100 */ in bpf_lwt_encap_gre()
37 hdr.iph in bpf_lwt_encap_gre()
19 struct iphdr iph; bpf_lwt_encap_gre() member
[all...]
/linux/samples/bpf/
H A Dxdp_tx_iptunnel_kern.c84 struct iphdr *iph = data + sizeof(struct ethhdr); in handle_ipv4() local
92 if (iph + 1 > data_end) in handle_ipv4()
95 dport = get_dport(iph + 1, data_end, iph->protocol); in handle_ipv4()
99 vip.protocol = iph->protocol; in handle_ipv4()
101 vip.daddr.v4 = iph->daddr; in handle_ipv4()
103 payload_len = ntohs(iph->tot_len); in handle_ipv4()
119 iph = data + sizeof(*new_eth); in handle_ipv4()
120 old_eth = data + sizeof(*iph); in handle_ipv4()
124 iph + 1 > data_end) in handle_ipv4()
129 iph->version = 4; in handle_ipv4()
[all …]
H A Dparse_varlen.c53 struct iphdr *iph; in parse_ipv4() local
56 iph = data + nh_off; in parse_ipv4()
57 if (iph + 1 > data_end) in parse_ipv4()
60 if (ip_is_fragment(iph)) in parse_ipv4()
62 ihl_len = iph->ihl * 4; in parse_ipv4()
64 if (iph->protocol == IPPROTO_IPIP) { in parse_ipv4()
65 iph = data + nh_off + ihl_len; in parse_ipv4()
66 if (iph + 1 > data_end) in parse_ipv4()
68 ihl_len += iph->ihl * 4; in parse_ipv4()
71 if (iph->protocol == IPPROTO_TCP) in parse_ipv4()
[all …]
H A Dxdp_fwd_kern.c34 static __always_inline int ip_decrease_ttl(struct iphdr *iph) in ip_decrease_ttl() argument
36 u32 check = (__force u32)iph->check; in ip_decrease_ttl()
39 iph->check = (__force __sum16)(check + (check >= 0xFFFF)); in ip_decrease_ttl()
40 return --iph->ttl; in ip_decrease_ttl()
50 struct iphdr *iph; in xdp_fwd_flags() local
63 iph = data + nh_off; in xdp_fwd_flags()
65 if (iph + 1 > data_end) in xdp_fwd_flags()
68 if (iph->ttl <= 1) in xdp_fwd_flags()
72 fib_params.tos = iph->tos; in xdp_fwd_flags()
73 fib_params.l4_protocol = iph->protocol; in xdp_fwd_flags()
[all …]
/linux/tools/testing/selftests/bpf/prog_tests/
H 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
63 struct ipv6hdr iph; member
74 struct iphdr iph; member
103 .iph.ihl = 5,
104 .iph.protocol = IPPROTO_TCP,
105 .iph.tot_len = __bpf_constant_htons(MAGIC_BYTES),
[all …]
/linux/net/netfilter/
H A Dxt_iprange.c20 const struct iphdr *iph = ip_hdr(skb); in iprange_mt4() local
24 m = ntohl(iph->saddr) < ntohl(info->src_min.ip); in iprange_mt4()
25 m |= ntohl(iph->saddr) > ntohl(info->src_max.ip); in iprange_mt4()
29 &iph->saddr, in iprange_mt4()
37 m = ntohl(iph->daddr) < ntohl(info->dst_min.ip); in iprange_mt4()
38 m |= ntohl(iph->daddr) > ntohl(info->dst_max.ip); in iprange_mt4()
42 &iph->daddr, in iprange_mt4()
69 const struct ipv6hdr *iph = ipv6_hdr(skb); in iprange_mt6() local
73 m = iprange_ipv6_lt(&iph->saddr, &info->src_min.in6); in iprange_mt6()
74 m |= iprange_ipv6_lt(&info->src_max.in6, &iph->saddr); in iprange_mt6()
[all …]
H A Dnf_flow_table_ip.c69 static void nf_flow_nat_ip_l4proto(struct sk_buff *skb, struct iphdr *iph, in nf_flow_nat_ip_l4proto() argument
73 switch (iph->protocol) { in nf_flow_nat_ip_l4proto()
84 struct sk_buff *skb, struct iphdr *iph, in nf_flow_snat_ip() argument
91 addr = iph->saddr; in nf_flow_snat_ip()
93 iph->saddr = new_addr; in nf_flow_snat_ip()
96 addr = iph->daddr; in nf_flow_snat_ip()
98 iph->daddr = new_addr; in nf_flow_snat_ip()
101 csum_replace4(&iph->check, addr, new_addr); in nf_flow_snat_ip()
103 nf_flow_nat_ip_l4proto(skb, iph, thoff, addr, new_addr); in nf_flow_snat_ip()
107 struct sk_buff *skb, struct iphdr *iph, in nf_flow_dnat_ip() argument
[all …]
/linux/net/ipv4/
H A Dah4.c77 static int ip_clear_mutable_options(const struct iphdr *iph, __be32 *daddr) in ip_clear_mutable_options() argument
79 unsigned char *optptr = (unsigned char *)(iph+1); in ip_clear_mutable_options()
80 int l = iph->ihl*4 - sizeof(struct iphdr); in ip_clear_mutable_options()
120 struct iphdr *iph; in ah_output_done() local
132 iph = AH_SKB_CB(skb)->tmp; in ah_output_done()
133 seqhi = (__be32 *)((char *)iph + ihl); in ah_output_done()
137 top_iph->tos = iph->tos; in ah_output_done()
138 top_iph->ttl = iph->ttl; in ah_output_done()
139 top_iph->frag_off = iph->frag_off; in ah_output_done()
141 top_iph->daddr = iph->daddr; in ah_output_done()
[all …]
H A Dxfrm4_input.c33 const struct iphdr *iph = ip_hdr(skb); in xfrm4_rcv_encap_finish() local
35 if (ip_route_input_noref(skb, iph->daddr, iph->saddr, in xfrm4_rcv_encap_finish()
36 ip4h_dscp(iph), skb->dev)) in xfrm4_rcv_encap_finish()
52 struct iphdr *iph = ip_hdr(skb); in xfrm4_transport_finish() local
55 iph->protocol = XFRM_MODE_SKB_CB(skb)->protocol; in xfrm4_transport_finish()
59 return -iph->protocol; in xfrm4_transport_finish()
63 iph->tot_len = htons(skb->len); in xfrm4_transport_finish()
64 ip_send_check(iph); in xfrm4_transport_finish()
86 struct iphdr *iph; in __xfrm4_udp_encap_rcv() local
132 iph = ip_hdr(skb); in __xfrm4_udp_encap_rcv()
[all …]
H A Dipip.c132 const struct iphdr *iph = (const struct iphdr *)skb->data; in ipip_err() local
141 t = ip_tunnel_lookup(itn, skb->dev->ifindex, flags, iph->daddr, in ipip_err()
142 iph->saddr, 0); in ipip_err()
176 ipv4_update_pmtu(skb, net, info, t->parms.link, iph->protocol); in ipip_err()
181 ipv4_redirect(skb, net, t->parms.link, iph->protocol); in ipip_err()
185 if (t->parms.iph.daddr == 0) { in ipip_err()
190 if (t->parms.iph.ttl == 0 && type == ICMP_TIME_EXCEEDED) in ipip_err()
222 const struct iphdr *iph; in ipip_tunnel_rcv() local
226 iph = ip_hdr(skb); in ipip_tunnel_rcv()
227 tunnel = ip_tunnel_lookup(itn, skb->dev->ifindex, flags, iph->saddr, in ipip_tunnel_rcv()
[all …]
H A Dip_output.c95 void ip_send_check(struct iphdr *iph) in ip_send_check() argument
97 iph->check = 0; in ip_send_check()
98 iph->check = ip_fast_csum((unsigned char *)iph, iph->ihl); in ip_send_check()
104 struct iphdr *iph = ip_hdr(skb); in __ip_local_out() local
108 iph_set_totlen(iph, skb->len); in __ip_local_out()
109 ip_send_check(iph); in __ip_local_out()
158 struct iphdr *iph; in ip_build_and_send_pkt() local
163 iph = ip_hdr(skb); in ip_build_and_send_pkt()
164 iph->version = 4; in ip_build_and_send_pkt()
165 iph->ihl = 5; in ip_build_and_send_pkt()
[all …]
/linux/net/netfilter/ipvs/
H A Dip_vs_core.c432 int *ignored, struct ip_vs_iphdr *iph) in ip_vs_sched_persist() argument
445 if (likely(!ip_vs_iph_inverse(iph))) { in ip_vs_sched_persist()
446 src_addr = &iph->saddr; in ip_vs_sched_persist()
447 dst_addr = &iph->daddr; in ip_vs_sched_persist()
449 src_addr = &iph->daddr; in ip_vs_sched_persist()
450 dst_addr = &iph->saddr; in ip_vs_sched_persist()
483 int protocol = iph->protocol; in ip_vs_sched_persist()
530 dest = sched->schedule(svc, skb, iph); in ip_vs_sched_persist()
568 && iph->protocol == IPPROTO_UDP) ? in ip_vs_sched_persist()
574 ip_vs_conn_fill_param(svc->ipvs, svc->af, iph->protocol, src_addr, in ip_vs_sched_persist()
[all …]
/linux/include/net/netfilter/
H A Dnf_queue.h53 static inline u32 hash_v4(const struct iphdr *iph, u32 initval) in hash_v4() argument
56 if ((__force u32)iph->saddr < (__force u32)iph->daddr) in hash_v4()
57 return jhash_3words((__force u32)iph->saddr, in hash_v4()
58 (__force u32)iph->daddr, iph->protocol, initval); in hash_v4()
60 return jhash_3words((__force u32)iph->daddr, in hash_v4()
61 (__force u32)iph->saddr, iph->protocol, initval); in hash_v4()
89 struct iphdr *iph, _iph; in hash_bridge() local
93 iph = skb_header_pointer(skb, skb_network_offset(skb), in hash_bridge()
94 sizeof(*iph), &_iph); in hash_bridge()
95 if (iph) in hash_bridge()
[all …]
/linux/net/sched/
H A Dact_nat.c121 struct iphdr *iph; in tcf_nat_act() local
145 if (!pskb_may_pull(skb, sizeof(*iph) + noff)) in tcf_nat_act()
148 iph = ip_hdr(skb); in tcf_nat_act()
151 addr = iph->saddr; in tcf_nat_act()
153 addr = iph->daddr; in tcf_nat_act()
156 if (skb_try_make_writable(skb, sizeof(*iph) + noff)) in tcf_nat_act()
163 iph = ip_hdr(skb); in tcf_nat_act()
165 iph->saddr = new_addr; in tcf_nat_act()
167 iph->daddr = new_addr; in tcf_nat_act()
169 csum_replace4(&iph->check, addr, new_addr); in tcf_nat_act()
[all …]
/linux/net/ipv6/
H A Dsit.c111 if (local == t->parms.iph.saddr && in ipip6_tunnel_lookup()
112 remote == t->parms.iph.daddr && in ipip6_tunnel_lookup()
119 if (remote == t->parms.iph.daddr && in ipip6_tunnel_lookup()
126 if (local == t->parms.iph.saddr && in ipip6_tunnel_lookup()
141 __be32 remote = parms->iph.daddr; in __ipip6_bucket()
142 __be32 local = parms->iph.saddr; in __ipip6_bucket()
209 __dev_addr_set(dev, &t->parms.iph.saddr, 4); in ipip6_tunnel_create()
210 memcpy(dev->broadcast, &t->parms.iph.daddr, 4); in ipip6_tunnel_create()
234 __be32 remote = parms->iph.daddr; in ipip6_tunnel_locate()
235 __be32 local = parms->iph.saddr; in ipip6_tunnel_locate()
[all …]
/linux/include/net/
H A Ddsfield.h16 static inline __u8 ipv4_get_dsfield(const struct iphdr *iph) in ipv4_get_dsfield() argument
18 return iph->tos; in ipv4_get_dsfield()
28 static inline void ipv4_change_dsfield(struct iphdr *iph,__u8 mask, in ipv4_change_dsfield() argument
31 __u32 check = ntohs((__force __be16)iph->check); in ipv4_change_dsfield()
34 dsfield = (iph->tos & mask) | value; in ipv4_change_dsfield()
35 check += iph->tos; in ipv4_change_dsfield()
39 iph->check = (__force __sum16)htons(check); in ipv4_change_dsfield()
40 iph->tos = dsfield; in ipv4_change_dsfield()
/linux/drivers/net/ethernet/mellanox/mlx5/core/
H A Den_selftest.c86 struct iphdr *iph; in mlx5e_test_get_udp_skb() local
103 iph = skb_put(skb, sizeof(struct iphdr)); in mlx5e_test_get_udp_skb()
120 iph->ihl = 5; in mlx5e_test_get_udp_skb()
121 iph->ttl = 32; in mlx5e_test_get_udp_skb()
122 iph->version = 4; in mlx5e_test_get_udp_skb()
123 iph->protocol = IPPROTO_UDP; in mlx5e_test_get_udp_skb()
126 iph->tot_len = htons(iplen); in mlx5e_test_get_udp_skb()
127 iph->frag_off = 0; in mlx5e_test_get_udp_skb()
128 iph->saddr = 0; in mlx5e_test_get_udp_skb()
129 iph->daddr = 0; in mlx5e_test_get_udp_skb()
[all …]

1234567891011