/linux-6.1.9/net/xfrm/ |
D | xfrm_inout.h | 11 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-6.1.9/include/net/netfilter/ |
D | nf_tables_ipv4.h | 21 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 = ntohs(iph->tot_len); in __nft_set_pktinfo_ipv4_validate() 33 thoff = iph->ihl * 4; in __nft_set_pktinfo_ipv4_validate() 40 pkt->tprot = iph->protocol; in __nft_set_pktinfo_ipv4_validate() 42 pkt->fragoff = ntohs(iph->frag_off) & IP_OFFSET; in __nft_set_pktinfo_ipv4_validate() 55 struct iphdr *iph; in nft_set_pktinfo_ipv4_ingress() local [all …]
|
D | nf_queue.h | 49 static inline u32 hash_v4(const struct iphdr *iph, u32 initval) in hash_v4() argument 52 if ((__force u32)iph->saddr < (__force u32)iph->daddr) in hash_v4() 53 return jhash_3words((__force u32)iph->saddr, in hash_v4() 54 (__force u32)iph->daddr, iph->protocol, initval); in hash_v4() 56 return jhash_3words((__force u32)iph->daddr, in hash_v4() 57 (__force u32)iph->saddr, iph->protocol, initval); in hash_v4() 85 struct iphdr *iph, _iph; in hash_bridge() local 89 iph = skb_header_pointer(skb, skb_network_offset(skb), in hash_bridge() 90 sizeof(*iph), &_iph); in hash_bridge() 91 if (iph) in hash_bridge() [all …]
|
/linux-6.1.9/net/netfilter/ipvs/ |
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() 47 &iph->daddr, htons(PORT_ISAKMP), p); in ah_esp_conn_fill_param_proto() 50 &iph->daddr, htons(PORT_ISAKMP), in ah_esp_conn_fill_param_proto() 51 &iph->saddr, htons(PORT_ISAKMP), p); in ah_esp_conn_fill_param_proto() 56 const struct ip_vs_iphdr *iph) in ah_esp_conn_in_get() argument 61 ah_esp_conn_fill_param_proto(ipvs, af, iph, &p); in ah_esp_conn_in_get() 70 ip_vs_iph_icmp(iph) ? "ICMP+" : "", in ah_esp_conn_in_get() 71 ip_vs_proto_get(iph->protocol)->name, in ah_esp_conn_in_get() [all …]
|
D | ip_vs_core.c | 255 int *ignored, struct ip_vs_iphdr *iph) in ip_vs_sched_persist() argument 268 if (likely(!ip_vs_iph_inverse(iph))) { in ip_vs_sched_persist() 269 src_addr = &iph->saddr; in ip_vs_sched_persist() 270 dst_addr = &iph->daddr; in ip_vs_sched_persist() 272 src_addr = &iph->daddr; in ip_vs_sched_persist() 273 dst_addr = &iph->saddr; in ip_vs_sched_persist() 306 int protocol = iph->protocol; in ip_vs_sched_persist() 353 dest = sched->schedule(svc, skb, iph); in ip_vs_sched_persist() 391 && iph->protocol == IPPROTO_UDP) ? in ip_vs_sched_persist() 397 ip_vs_conn_fill_param(svc->ipvs, svc->af, iph->protocol, src_addr, in ip_vs_sched_persist() [all …]
|
/linux-6.1.9/tools/testing/selftests/bpf/progs/ |
D | xdping_kern.c | 65 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 …]
|
D | test_xdp_loop.c | 81 struct iphdr *iph = data + sizeof(struct ethhdr); in handle_ipv4() local 89 if (iph + 1 > data_end) in handle_ipv4() 92 dport = get_dport(iph + 1, data_end, iph->protocol); in handle_ipv4() 96 vip.protocol = iph->protocol; in handle_ipv4() 98 vip.daddr.v4 = iph->daddr; in handle_ipv4() 100 payload_len = bpf_ntohs(iph->tot_len); in handle_ipv4() 114 iph = data + sizeof(*new_eth); in handle_ipv4() 115 old_eth = data + sizeof(*iph); in handle_ipv4() 119 iph + 1 > data_end) in handle_ipv4() 124 iph->version = 4; in handle_ipv4() [all …]
|
D | test_xdp.c | 85 struct iphdr *iph = data + sizeof(struct ethhdr); in handle_ipv4() local 93 if (iph + 1 > data_end) in handle_ipv4() 96 dport = get_dport(iph + 1, data_end, iph->protocol); in handle_ipv4() 100 vip.protocol = iph->protocol; in handle_ipv4() 102 vip.daddr.v4 = iph->daddr; in handle_ipv4() 104 payload_len = bpf_ntohs(iph->tot_len); in handle_ipv4() 118 iph = data + sizeof(*new_eth); in handle_ipv4() 119 old_eth = data + sizeof(*iph); in handle_ipv4() 123 iph + 1 > data_end) in handle_ipv4() 128 iph->version = 4; in handle_ipv4() [all …]
|
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-6.1.9/samples/bpf/ |
D | xdp_tx_iptunnel_kern.c | 84 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 …]
|
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() 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 …]
|
D | xdp_fwd_kern.c | 34 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 …]
|
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() 107 iph->protocol = IPPROTO_ICMP; in send_icmp4_too_big() 108 iph->tos = 0; in send_icmp4_too_big() 109 iph->tot_len = htons( in send_icmp4_too_big() [all …]
|
/linux-6.1.9/tools/testing/selftests/bpf/prog_tests/ |
D | flow_dissector.c | 46 struct iphdr iph; member 52 struct iphdr iph; member 61 struct iphdr iph; member 67 struct ipv6hdr iph; member 73 struct ipv6hdr iph; member 89 struct ipv6hdr iph; member 116 .iph.ihl = 5, 117 .iph.protocol = IPPROTO_TCP, 118 .iph.tot_len = __bpf_constant_htons(MAGIC_BYTES), 138 .iph.nexthdr = IPPROTO_TCP, [all …]
|
/linux-6.1.9/include/net/ |
D | inet_ecn.h | 77 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-6.1.9/net/ipv4/ |
D | xfrm4_input.c | 31 const struct iphdr *iph = ip_hdr(skb); in xfrm4_rcv_encap_finish() local 33 if (ip_route_input_noref(skb, iph->daddr, iph->saddr, in xfrm4_rcv_encap_finish() 34 iph->tos, skb->dev)) in xfrm4_rcv_encap_finish() 50 struct iphdr *iph = ip_hdr(skb); in xfrm4_transport_finish() local 52 iph->protocol = XFRM_MODE_SKB_CB(skb)->protocol; in xfrm4_transport_finish() 56 return -iph->protocol; in xfrm4_transport_finish() 60 iph->tot_len = htons(skb->len); in xfrm4_transport_finish() 61 ip_send_check(iph); in xfrm4_transport_finish() 86 struct iphdr *iph; in xfrm4_udp_encap_rcv() local 145 iph = ip_hdr(skb); in xfrm4_udp_encap_rcv() [all …]
|
D | ip_input.c | 263 const struct iphdr *iph; in ip_rcv_options() local 277 iph = ip_hdr(skb); in ip_rcv_options() 279 opt->optlen = iph->ihl*4 - sizeof(struct iphdr); in ip_rcv_options() 293 &iph->saddr, in ip_rcv_options() 294 &iph->daddr); in ip_rcv_options() 308 static bool ip_can_use_hint(const struct sk_buff *skb, const struct iphdr *iph, in ip_can_use_hint() argument 311 return hint && !skb_dst(skb) && ip_hdr(hint)->daddr == iph->daddr && in ip_can_use_hint() 312 ip_hdr(hint)->tos == iph->tos; in ip_can_use_hint() 321 const struct iphdr *iph = ip_hdr(skb); in ip_rcv_finish_core() local 327 if (ip_can_use_hint(skb, iph, hint)) { in ip_rcv_finish_core() [all …]
|
D | ah4.c | 80 static int ip_clear_mutable_options(const struct iphdr *iph, __be32 *daddr) in ip_clear_mutable_options() argument 82 unsigned char *optptr = (unsigned char *)(iph+1); in ip_clear_mutable_options() 83 int l = iph->ihl*4 - sizeof(struct iphdr); in ip_clear_mutable_options() 123 struct iphdr *iph; in ah_output_done() local 131 iph = AH_SKB_CB(skb)->tmp; in ah_output_done() 132 icv = ah_tmp_icv(ahp->ahash, iph, ihl); in ah_output_done() 135 top_iph->tos = iph->tos; in ah_output_done() 136 top_iph->ttl = iph->ttl; in ah_output_done() 137 top_iph->frag_off = iph->frag_off; in ah_output_done() 139 top_iph->daddr = iph->daddr; in ah_output_done() [all …]
|
D | ipip.c | 132 const struct iphdr *iph = (const struct iphdr *)skb->data; in ipip_err() local 139 iph->daddr, iph->saddr, 0); in ipip_err() 173 ipv4_update_pmtu(skb, net, info, t->parms.link, iph->protocol); in ipip_err() 178 ipv4_redirect(skb, net, t->parms.link, iph->protocol); in ipip_err() 182 if (t->parms.iph.daddr == 0) { in ipip_err() 187 if (t->parms.iph.ttl == 0 && type == ICMP_TIME_EXCEEDED) in ipip_err() 218 const struct iphdr *iph; in ipip_tunnel_rcv() local 220 iph = ip_hdr(skb); in ipip_tunnel_rcv() 222 iph->saddr, iph->daddr, 0); in ipip_tunnel_rcv() 226 if (tunnel->parms.iph.protocol != ipproto && in ipip_tunnel_rcv() [all …]
|
/linux-6.1.9/net/netfilter/ |
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() 74 m |= iprange_ipv6_lt(&info->src_max.in6, &iph->saddr); in iprange_mt6() [all …]
|
/linux-6.1.9/net/sched/ |
D | act_nat.c | 105 struct iphdr *iph; in tcf_nat_act() local 132 if (!pskb_may_pull(skb, sizeof(*iph) + noff)) in tcf_nat_act() 135 iph = ip_hdr(skb); in tcf_nat_act() 138 addr = iph->saddr; in tcf_nat_act() 140 addr = iph->daddr; in tcf_nat_act() 143 if (skb_try_make_writable(skb, sizeof(*iph) + noff)) in tcf_nat_act() 150 iph = ip_hdr(skb); in tcf_nat_act() 152 iph->saddr = new_addr; in tcf_nat_act() 154 iph->daddr = new_addr; in tcf_nat_act() 156 csum_replace4(&iph->check, addr, new_addr); in tcf_nat_act() [all …]
|
/linux-6.1.9/net/ipv6/netfilter/ |
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() 54 fl6->flowlabel = (*(__be32 *)iph) & IPV6_FLOWINFO_MASK; in nft_fib6_flowi_init() 61 struct ipv6hdr *iph) in __nft_fib6_eval_type() argument 78 nft_fib6_flowi_init(&fl6, priv, pkt, dev, iph); in __nft_fib6_eval_type() 133 struct ipv6hdr *iph, _iph; in nft_fib6_eval_type() local 135 iph = skb_header_pointer(pkt->skb, noff, sizeof(_iph), &_iph); in nft_fib6_eval_type() [all …]
|
/linux-6.1.9/net/ipv4/netfilter/ |
D | nft_fib_ipv4.c | 34 struct iphdr *iph, _iph; in nft_fib4_eval_type() local 42 iph = skb_header_pointer(pkt->skb, noff, sizeof(_iph), &_iph); in nft_fib4_eval_type() 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 96 iph = skb_header_pointer(pkt->skb, noff, sizeof(_iph), &_iph); in nft_fib4_eval() 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() [all …]
|
/linux-6.1.9/net/ipv6/ |
D | ip6_offload.c | 184 static int ipv6_exthdrs_len(struct ipv6hdr *iph, in ipv6_exthdrs_len() argument 187 struct ipv6_opt_hdr *opth = (void *)iph; in ipv6_exthdrs_len() 188 int len = 0, proto, optlen = sizeof(*iph); in ipv6_exthdrs_len() 190 proto = iph->nexthdr; in ipv6_exthdrs_len() 213 struct ipv6hdr *iph; in ipv6_gro_receive() local 221 hlen = off + sizeof(*iph); in ipv6_gro_receive() 222 iph = skb_gro_header(skb, hlen, off); in ipv6_gro_receive() 223 if (unlikely(!iph)) in ipv6_gro_receive() 227 skb_gro_pull(skb, sizeof(*iph)); in ipv6_gro_receive() 230 flush += ntohs(iph->payload_len) != skb_gro_len(skb); in ipv6_gro_receive() [all …]
|
D | sit.c | 108 if (local == t->parms.iph.saddr && in ipip6_tunnel_lookup() 109 remote == t->parms.iph.daddr && in ipip6_tunnel_lookup() 116 if (remote == t->parms.iph.daddr && in ipip6_tunnel_lookup() 123 if (local == t->parms.iph.saddr && in ipip6_tunnel_lookup() 138 __be32 remote = parms->iph.daddr; in __ipip6_bucket() 139 __be32 local = parms->iph.saddr; in __ipip6_bucket() 207 __dev_addr_set(dev, &t->parms.iph.saddr, 4); in ipip6_tunnel_create() 208 memcpy(dev->broadcast, &t->parms.iph.daddr, 4); in ipip6_tunnel_create() 231 __be32 remote = parms->iph.daddr; in ipip6_tunnel_locate() 232 __be32 local = parms->iph.saddr; in ipip6_tunnel_locate() [all …]
|