Home
last modified time | relevance | path

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

12345678910

/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/include/net/netfilter/
H A Dnf_tables_ipv4.h21 struct iphdr *iph, _iph; in __nft_set_pktinfo_ipv4_validate() local
24 iph = skb_header_pointer(pkt->skb, skb_network_offset(pkt->skb), in __nft_set_pktinfo_ipv4_validate()
25 sizeof(*iph), &_iph); in __nft_set_pktinfo_ipv4_validate()
26 if (!iph) in __nft_set_pktinfo_ipv4_validate()
29 if (iph->ihl < 5 || iph->version != 4) in __nft_set_pktinfo_ipv4_validate()
32 len = iph_totlen(pkt->skb, iph); in __nft_set_pktinfo_ipv4_validate()
33 thoff = iph->ihl * 4; in __nft_set_pktinfo_ipv4_validate()
40 else if (thoff < sizeof(*iph)) in __nft_set_pktinfo_ipv4_validate()
44 pkt->tprot = iph->protocol; in __nft_set_pktinfo_ipv4_validate()
46 pkt->fragoff = ntohs(iph->frag_off) & IP_OFFSET; in __nft_set_pktinfo_ipv4_validate()
[all …]
H A Dnf_queue.h48 static inline u32 hash_v4(const struct iphdr *iph, u32 initval) in hash_v4() argument
51 if ((__force u32)iph->saddr < (__force u32)iph->daddr) in hash_v4()
52 return jhash_3words((__force u32)iph->saddr, in hash_v4()
53 (__force u32)iph->daddr, iph->protocol, initval); in hash_v4()
55 return jhash_3words((__force u32)iph->daddr, in hash_v4()
56 (__force u32)iph->saddr, iph->protocol, initval); in hash_v4()
84 struct iphdr *iph, _iph; in hash_bridge() local
88 iph = skb_header_pointer(skb, skb_network_offset(skb), in hash_bridge()
89 sizeof(*iph), &_iph); in hash_bridge()
90 if (iph) in hash_bridge()
[all …]
/linux/net/netfilter/ipvs/
H A Dip_vs_proto_ah_esp.c40 const struct ip_vs_iphdr *iph, in ah_esp_conn_fill_param_proto()
43 if (likely(!ip_vs_iph_inverse(iph))) in ah_esp_conn_fill_param_proto()
45 &iph->saddr, htons(PORT_ISAKMP), in ah_esp_conn_fill_param_proto()
46 &iph->daddr, htons(PORT_ISAKMP), p); in ah_esp_conn_fill_param_proto()
49 &iph->daddr, htons(PORT_ISAKMP), in ah_esp_conn_fill_param_proto()
50 &iph->saddr, htons(PORT_ISAKMP), p); in ah_esp_conn_fill_param_proto()
55 const struct ip_vs_iphdr *iph) in ah_esp_conn_in_get()
60 ah_esp_conn_fill_param_proto(ipvs, af, iph, &p); in ah_esp_conn_in_get()
69 ip_vs_iph_icmp(iph) ? "ICMP+" : "", in ah_esp_conn_in_get()
70 ip_vs_proto_get(iph in ah_esp_conn_in_get()
41 ah_esp_conn_fill_param_proto(struct netns_ipvs * ipvs,int af,const struct ip_vs_iphdr * iph,struct ip_vs_conn_param * p) ah_esp_conn_fill_param_proto() argument
56 ah_esp_conn_in_get(struct netns_ipvs * ipvs,int af,const struct sk_buff * skb,const struct ip_vs_iphdr * iph) ah_esp_conn_in_get() argument
82 ah_esp_conn_out_get(struct netns_ipvs * ipvs,int af,const struct sk_buff * skb,const struct ip_vs_iphdr * iph) ah_esp_conn_out_get() argument
106 ah_esp_conn_schedule(struct netns_ipvs * ipvs,int af,struct sk_buff * skb,struct ip_vs_proto_data * pd,int * verdict,struct ip_vs_conn ** cpp,struct ip_vs_iphdr * iph) ah_esp_conn_schedule() argument
[all...]
/linux/tools/testing/selftests/bpf/progs/
H A Dxdping_kern.c66 struct iphdr *iph; in icmp_check() local
68 if (data + sizeof(*eth) + sizeof(*iph) + ICMP_ECHO_LEN > data_end) in icmp_check()
74 iph = data + sizeof(*eth); in icmp_check()
76 if (iph->protocol != IPPROTO_ICMP) in icmp_check()
79 if (bpf_ntohs(iph->tot_len) - sizeof(*iph) != ICMP_ECHO_LEN) in icmp_check()
82 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 …]
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 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 Dxdp_flowtable.c29 static bool xdp_flowtable_offload_check_iphdr(struct iphdr *iph) in xdp_flowtable_offload_check_iphdr() argument
32 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
86 ports = (struct flow_ports___local *)(iph + 1); in xdp_flowtable_do_lookup()
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()
[all …]
H 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()
/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/include/net/
H A Dinet_ecn.h77 static inline int IP_ECN_set_ce(struct iphdr *iph) in IP_ECN_set_ce() argument
79 u32 ecn = (iph->tos + 1) & INET_ECN_MASK; in IP_ECN_set_ce()
100 iph->check = csum16_add(iph->check, check_add); in IP_ECN_set_ce()
101 iph->tos |= INET_ECN_CE; in IP_ECN_set_ce()
105 static inline int IP_ECN_set_ect1(struct iphdr *iph) in IP_ECN_set_ect1() argument
107 if ((iph->tos & INET_ECN_MASK) != INET_ECN_ECT_0) in IP_ECN_set_ect1()
110 iph->check = csum16_add(iph->check, htons(0x1)); in IP_ECN_set_ect1()
111 iph->tos ^= INET_ECN_MASK; in IP_ECN_set_ect1()
115 static inline void IP_ECN_clear(struct iphdr *iph) in IP_ECN_clear() argument
117 iph->tos &= ~INET_ECN_MASK; in IP_ECN_clear()
[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
128 iph = AH_SKB_CB(skb)->tmp; in ah_output_done()
129 icv = ah_tmp_icv(iph, ihl); in ah_output_done()
132 top_iph->tos = iph->tos; in ah_output_done()
133 top_iph->ttl = iph->ttl; in ah_output_done()
134 top_iph->frag_off = iph->frag_off; in ah_output_done()
136 top_iph->daddr = iph->daddr; in ah_output_done()
[all …]
H A Dipip.c11 * Alan Cox : Fixed bug with 1.3.18 and IPIP not working (now needs to set skb->h.iph)
132 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 in ipip_tunnel_rcv()
[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
54 iph->protocol = XFRM_MODE_SKB_CB(skb)->protocol; in xfrm4_transport_finish()
58 return -iph->protocol; in xfrm4_transport_finish()
62 iph->tot_len = htons(skb->len); in xfrm4_transport_finish()
63 ip_send_check(iph); in xfrm4_transport_finish()
85 struct iphdr *iph; in __xfrm4_udp_encap_rcv() local
131 iph = ip_hdr(skb); in __xfrm4_udp_encap_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/
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_synproxy_core.c399 struct iphdr *iph; in synproxy_build_ip() local
402 iph = skb_put(skb, sizeof(*iph)); in synproxy_build_ip()
403 iph->version = 4; in synproxy_build_ip()
404 iph->ihl = sizeof(*iph) / 4; in synproxy_build_ip()
405 iph->tos = 0; in synproxy_build_ip()
406 iph->id = 0; in synproxy_build_ip()
407 iph->frag_off = htons(IP_DF); in synproxy_build_ip()
408 iph->ttl = READ_ONCE(net->ipv4.sysctl_ip_default_ttl); in synproxy_build_ip()
409 iph->protocol = IPPROTO_TCP; in synproxy_build_ip()
410 iph->check = 0; in synproxy_build_ip()
[all …]
/linux/net/ipv6/
H A Dip6_offload.c200 static int ipv6_exthdrs_len(struct ipv6hdr *iph, in ipv6_exthdrs_len() argument
203 struct ipv6_opt_hdr *opth = (void *)iph; in ipv6_exthdrs_len()
204 int len = 0, proto, optlen = sizeof(*iph); in ipv6_exthdrs_len()
206 proto = iph->nexthdr; in ipv6_exthdrs_len()
228 struct ipv6hdr *iph; in ipv6_gro_receive() local
236 hlen = off + sizeof(*iph); in ipv6_gro_receive()
237 iph = skb_gro_header(skb, hlen, off); in ipv6_gro_receive()
238 if (unlikely(!iph)) in ipv6_gro_receive()
243 flush += ntohs(iph->payload_len) != skb->len - hlen; in ipv6_gro_receive()
245 proto = iph->nexthdr; in ipv6_gro_receive()
[all …]
/linux/net/ipv6/netfilter/
H A Dnft_fib_ipv6.c25 struct ipv6hdr *iph) in nft_fib6_flowi_init() argument
30 fl6->daddr = iph->daddr; in nft_fib6_flowi_init()
31 fl6->saddr = iph->saddr; in nft_fib6_flowi_init()
37 fl6->daddr = iph->saddr; in nft_fib6_flowi_init()
38 fl6->saddr = iph->daddr; in nft_fib6_flowi_init()
52 fl6->flowlabel = (*(__be32 *)iph) & IPV6_FLOWINFO_MASK; in nft_fib6_flowi_init()
60 struct ipv6hdr *iph) in __nft_fib6_eval_type()
77 nft_fib6_flowi_init(&fl6, priv, pkt, dev, iph); in __nft_fib6_eval_type()
132 struct ipv6hdr *iph, _iph; in nft_fib6_eval_type()
134 iph in nft_fib6_eval_type()
59 __nft_fib6_eval_type(const struct nft_fib * priv,const struct nft_pktinfo * pkt,struct ipv6hdr * iph) __nft_fib6_eval_type() argument
133 struct ipv6hdr *iph, _iph; nft_fib6_eval_type() local
145 nft_fib_v6_skip_icmpv6(const struct sk_buff * skb,u8 next,const struct ipv6hdr * iph) nft_fib_v6_skip_icmpv6() argument
163 struct ipv6hdr *iph, _iph; nft_fib6_eval() local
[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 …]

12345678910