/linux/net/xfrm/ |
H A D | xfrm_inout.h | 11 const struct iphdr *iph = ip_hdr(skb); in xfrm4_extract_header() local 14 XFRM_MODE_SKB_CB(skb)->id = iph->id; 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 45 iph->version = 6; in xfrm6_beet_make_header() 48 sizeof(iph->flow_lbl)); in xfrm6_beet_make_header() 57 struct iphdr *iph = ip_hdr(skb); in xfrm4_beet_make_header() local 59 iph->ihl = 5; in xfrm4_beet_make_header() [all …]
|
/linux/include/net/netfilter/ |
H A D | nf_tables_ipv4.h | 21 struct iphdr *iph, _iph; in __nft_set_pktinfo_ipv4_validate() local 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() 38 else if (thoff < sizeof(*iph)) in __nft_set_pktinfo_ipv4_validate() 42 pkt->tprot = iph->protocol; in __nft_set_pktinfo_ipv4_validate() 57 struct iphdr *iph; in nft_set_pktinfo_ipv4_ingress() local 63 iph = ip_hdr(pkt->skb); in nft_set_pktinfo_ipv4_ingress() 64 if (iph->ihl < 5 || iph->version != 4) in nft_set_pktinfo_ipv4_ingress() 68 thoff = iph->ihl * 4; in nft_set_pktinfo_ipv4_ingress() [all …]
|
H A D | nf_queue.h | 48 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 D | ip_vs_proto_ah_esp.c | 41 const struct ip_vs_iphdr *iph, in ah_esp_conn_fill_param_proto() argument 44 if (likely(!ip_vs_iph_inverse(iph))) in ah_esp_conn_fill_param_proto() 46 &iph->saddr, htons(PORT_ISAKMP), in ah_esp_conn_fill_param_proto() 50 &iph->daddr, htons(PORT_ISAKMP), in ah_esp_conn_fill_param_proto() 56 const struct ip_vs_iphdr *iph) in ah_esp_conn_in_get() argument 72 IP_VS_DBG_ADDR(af, &iph->saddr), in ah_esp_conn_in_get() 73 IP_VS_DBG_ADDR(af, &iph->daddr)); in ah_esp_conn_in_get() 82 const struct ip_vs_iphdr *iph) in ah_esp_conn_out_get() argument 94 IP_VS_DBG_ADDR(af, &iph->saddr), in ah_esp_conn_out_get() 95 IP_VS_DBG_ADDR(af, &iph->daddr)); in ah_esp_conn_out_get() [all …]
|
H A D | ip_vs_core.c | 509 iph); in ip_vs_schedule() 835 icmph->icmp6_cksum = ~csum_ipv6_magic(&iph->saddr, &iph->daddr, in ip_vs_nat_icmp_v6() 917 struct iphdr *iph; in ip_vs_out_icmp() local 934 iph = ip_hdr(skb); in ip_vs_out_icmp() 942 &iph->saddr, &iph->daddr); in ip_vs_out_icmp() 1431 if (ip_vs_has_real_service(ipvs, af, iph.protocol, &iph.saddr, in ip_vs_out_hook() 1444 iph.len)))) { in ip_vs_out_hook() 1612 &iph->saddr, &iph->daddr); in ip_vs_in_icmp() 1728 &iph->saddr); in ip_vs_in_icmp() 1841 &iph->saddr, &iph->daddr); in ip_vs_in_icmp_v6() [all …]
|
/linux/tools/testing/selftests/bpf/progs/ |
H A D | xdping_kern.c | 66 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 …]
|
H A D | test_xdp_loop.c | 90 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 …]
|
H A D | test_xdp.c | 94 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 …]
|
H A D | test_xdp_dynptr.c | 86 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 …]
|
H A D | test_lwt_ip_encap.c | 19 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 D | xdp_tx_iptunnel_kern.c | 92 if (iph + 1 > data_end) in handle_ipv4() 95 dport = get_dport(iph + 1, data_end, iph->protocol); in handle_ipv4() 101 vip.daddr.v4 = iph->daddr; 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 = htons(payload_len + sizeof(*iph)); in handle_ipv4() [all …]
|
H A D | parse_varlen.c | 53 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() 66 if (iph + 1 > data_end) in parse_ipv4() 68 ihl_len += iph->ihl * 4; in parse_ipv4() 81 struct iphdr *iph; in parse_ipv6() local 93 if (iph + 1 > data_end) in parse_ipv6() 95 ihl_len += iph->ihl * 4; in parse_ipv6() [all …]
|
H A D | xdp_fwd_kern.c | 36 u32 check = (__force u32)iph->check; 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() 77 fib_params.ipv4_src = iph->saddr; in xdp_fwd_flags() 78 fib_params.ipv4_dst = iph->daddr; in xdp_fwd_flags() [all …]
|
H A D | xdp_adjust_tail_kern.c | 82 struct iphdr *iph, *orig_iph; in send_icmp4_too_big() local 91 iph = data + off; in send_icmp4_too_big() 102 iph->ttl = DEFAULT_TTL; in send_icmp4_too_big() 103 iph->daddr = orig_iph->saddr; in send_icmp4_too_big() 104 iph->saddr = orig_iph->daddr; in send_icmp4_too_big() 105 iph->version = 4; in send_icmp4_too_big() 106 iph->ihl = 5; in send_icmp4_too_big() 108 iph->tos = 0; in send_icmp4_too_big() 109 iph->tot_len = htons( in send_icmp4_too_big() 111 iph->check = 0; in send_icmp4_too_big() [all …]
|
/linux/tools/testing/selftests/bpf/prog_tests/ |
H A D | flow_dissector.c | 45 struct iphdr iph; member 51 struct iphdr iph; member 60 struct iphdr iph; member 66 struct ipv6hdr iph; member 115 .iph.ihl = 5, 159 .iph.ihl = 5, 205 .iph.ihl = 5, 232 .iph.ihl = 5, 375 .iph.ihl = 5, 404 .iph.ihl = 5, [all …]
|
/linux/include/net/ |
H A D | inet_ecn.h | 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() 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() 117 iph->tos &= ~INET_ECN_MASK; in IP_ECN_clear() 138 if (INET_ECN_is_not_ect(ipv6_get_dsfield(iph))) in IP6_ECN_set_ce() 141 from = *(__be32 *)iph; in IP6_ECN_set_ce() 143 *(__be32 *)iph = to; in IP6_ECN_set_ce() 157 from = *(__be32 *)iph; in IP6_ECN_set_ect1() [all …]
|
/linux/net/ipv4/ |
H A D | ip_input.c | 277 iph = ip_hdr(skb); in ip_rcv_options() 328 err = ip_route_use_hint(skb, iph->daddr, iph->saddr, iph->tos, in ip_rcv_finish_core() 344 iph = ip_hdr(skb); in ip_rcv_finish_core() 354 iph = ip_hdr(skb); in ip_rcv_finish_core() 365 err = ip_route_input_noref(skb, iph->daddr, iph->saddr, in ip_rcv_finish_core() 366 iph->tos, dev); in ip_rcv_finish_core() 483 iph = ip_hdr(skb); in ip_rcv_core() 496 if (iph->ihl < 5 || iph->version != 4) in ip_rcv_core() 509 iph = ip_hdr(skb); in ip_rcv_core() 511 if (unlikely(ip_fast_csum((u8 *)iph, iph->ihl))) in ip_rcv_core() [all …]
|
H A D | ah4.c | 120 struct iphdr *iph; in ah_output_done() local 132 top_iph->tos = iph->tos; in ah_output_done() 133 top_iph->ttl = iph->ttl; in ah_output_done() 179 if (!iph) in ah_output() 191 iph->tos = top_iph->tos; in ah_output() 257 kfree(iph); in ah_output() 357 iph = ip_hdr(skb); in ah_input() 383 iph->ttl = 0; in ah_input() 384 iph->tos = 0; in ah_input() 385 iph->frag_off = 0; in ah_input() [all …]
|
H A D | ipip.c | 142 iph->saddr, 0); in ipip_err() 185 if (t->parms.iph.daddr == 0) { in ipip_err() 222 const struct iphdr *iph; in ipip_tunnel_rcv() local 226 iph = ip_hdr(skb); in ipip_tunnel_rcv() 228 iph->daddr, 0); in ipip_tunnel_rcv() 233 tunnel->parms.iph.protocol != 0) in ipip_tunnel_rcv() 344 if (p->iph.version != 4 || in ipip_tunnel_ctl() 346 p->iph.ihl != 5 || (p->iph.frag_off & htons(~IP_DF))) in ipip_tunnel_ctl() 422 parms->iph.version = 4; in ipip_netlink_parms() 423 parms->iph.protocol = IPPROTO_IPIP; in ipip_netlink_parms() [all …]
|
H A D | xfrm4_input.c | 33 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 iph->tos, skb->dev)) in xfrm4_rcv_encap_finish() 52 struct iphdr *iph = ip_hdr(skb); in xfrm4_transport_finish() local 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() 132 iphlen = iph->ihl << 2; in __xfrm4_udp_encap_rcv() [all …]
|
/linux/net/netfilter/ |
H A D | xt_iprange.c | 20 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() 78 &iph->saddr, in iprange_mt6() [all …]
|
/linux/net/ipv6/netfilter/ |
H A D | nft_fib_ipv6.c | 25 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() 61 struct ipv6hdr *iph) in __nft_fib6_eval_type() argument 133 struct ipv6hdr *iph, _iph; in nft_fib6_eval_type() local 136 if (!iph) { in nft_fib6_eval_type() 141 *dest = __nft_fib6_eval_type(priv, pkt, iph); in nft_fib6_eval_type() 163 struct ipv6hdr *iph, _iph; in nft_fib6_eval() local [all …]
|
/linux/net/ipv6/ |
H A D | ip6_offload.c | 204 proto = iph->nexthdr; in ipv6_exthdrs_len() 226 struct ipv6hdr *iph; in ipv6_gro_receive() local 234 hlen = off + sizeof(*iph); in ipv6_gro_receive() 236 if (unlikely(!iph)) in ipv6_gro_receive() 243 proto = iph->nexthdr; in ipv6_gro_receive() 254 skb_gro_pull(skb, sizeof(*iph)); in ipv6_gro_receive() 289 if (memcmp(iph + 1, iph2 + 1, in ipv6_gro_receive() 341 struct ipv6hdr *iph; in ipv6_gro_complete() local 372 iph->nexthdr = NEXTHDR_HOP; in ipv6_gro_complete() 373 iph->payload_len = 0; in ipv6_gro_complete() [all …]
|
/linux/net/ipv4/netfilter/ |
H A D | nft_fib_ipv4.c | 34 struct iphdr *iph, _iph; in nft_fib4_eval_type() local 43 if (!iph) { in nft_fib4_eval_type() 49 addr = iph->daddr; in nft_fib4_eval_type() 51 addr = iph->saddr; in nft_fib4_eval_type() 63 struct iphdr *iph, _iph; in nft_fib4_eval() local 97 if (!iph) { in nft_fib4_eval() 102 if (ipv4_is_zeronet(iph->saddr)) { in nft_fib4_eval() 103 if (ipv4_is_lbcast(iph->daddr) || in nft_fib4_eval() 116 fl4.daddr = iph->daddr; in nft_fib4_eval() 117 fl4.saddr = get_saddr(iph->saddr); in nft_fib4_eval() [all …]
|
/linux/net/sched/ |
H A D | act_nat.c | 120 struct iphdr *iph; in tcf_nat_act() local 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() 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() 175 ihl = iph->ihl * 4; in tcf_nat_act() 178 switch (iph->frag_off & htons(IP_OFFSET) ? 0 : iph->protocol) { in tcf_nat_act() 228 addr = iph->daddr; in tcf_nat_act() [all …]
|