Home
last modified time | relevance | path

Searched refs:iphdr (Results 1 – 25 of 391) sorted by relevance

12345678910>>...16

/linux-5.19.10/tools/testing/selftests/net/
Dip_defrag.c29 #define IP4_HLEN (sizeof(struct iphdr))
101 static uint16_t udp_checksum(struct ip *iphdr, struct udphdr *udphdr) in udp_checksum() argument
106 sum = raw_checksum((uint8_t *)&iphdr->ip_src, 2 * sizeof(iphdr->ip_src), in udp_checksum()
117 static uint16_t udp6_checksum(struct ip6_hdr *iphdr, struct udphdr *udphdr) in udp6_checksum() argument
122 sum = raw_checksum((uint8_t *)&iphdr->ip6_src, 2 * sizeof(iphdr->ip6_src), in udp6_checksum()
176 struct ip *iphdr = (struct ip *)ip_frame; in send_fragment() local
180 iphdr->ip_off = htons(offset / 8); in send_fragment()
183 iphdr->ip_off = htons(offset / 8 | IP4_MF); in send_fragment()
185 iphdr->ip_len = htons(frag_len); in send_fragment()
206 struct ip *iphdr = (struct ip *)ip_frame; in send_udp_frags() local
[all …]
Dgro.c111 next_off = offsetof(struct iphdr, protocol); in setup_sock_filter()
224 struct iphdr *iph = buf; in fill_networklayer()
245 payload_len + sizeof(struct iphdr)); in fill_networklayer()
251 iph->check = checksum_fold(buf, sizeof(struct iphdr), 0); in fill_networklayer()
380 struct iphdr *iph = (struct iphdr *)(buf + ETH_HLEN); in recompute_packet()
392 iph->check = checksum_fold(iph, sizeof(struct iphdr), 0); in recompute_packet()
558 struct iphdr *iph; in add_ipv4_ts_option()
572 iph = (struct iphdr *)(optpkt + ETH_HLEN); in add_ipv4_ts_option()
576 iph->check = checksum_fold(iph, sizeof(struct iphdr) + optlen, 0); in add_ipv4_ts_option()
602 struct iphdr *iph = (struct iphdr *)(buf + ETH_HLEN); in send_fragment4()
[all …]
/linux-5.19.10/include/linux/
Dip.h19 static inline struct iphdr *ip_hdr(const struct sk_buff *skb) in ip_hdr()
21 return (struct iphdr *)skb_network_header(skb); in ip_hdr()
24 static inline struct iphdr *inner_ip_hdr(const struct sk_buff *skb) in inner_ip_hdr()
26 return (struct iphdr *)skb_inner_network_header(skb); in inner_ip_hdr()
29 static inline struct iphdr *ipip_hdr(const struct sk_buff *skb) in ipip_hdr()
31 return (struct iphdr *)skb_transport_header(skb); in ipip_hdr()
/linux-5.19.10/net/ipv4/netfilter/
Dnf_reject_ipv4.c17 struct iphdr *iph; in nf_reject_iphdr_validate()
20 if (!pskb_may_pull(skb, sizeof(struct iphdr))) in nf_reject_iphdr_validate()
46 struct iphdr *niph; in nf_reject_skb_v4_tcp_reset()
56 nskb = alloc_skb(sizeof(struct iphdr) + sizeof(struct tcphdr) + in nf_reject_skb_v4_tcp_reset()
80 struct iphdr *niph; in nf_reject_skb_v4_unreach()
111 nskb = alloc_skb(sizeof(struct iphdr) + sizeof(struct icmphdr) + in nf_reject_skb_v4_unreach()
168 struct iphdr *nf_reject_iphdr_put(struct sk_buff *nskb, in nf_reject_iphdr_put()
172 struct iphdr *niph, *oiph = ip_hdr(oldskb); in nf_reject_iphdr_put()
175 niph = skb_put(nskb, sizeof(struct iphdr)); in nf_reject_iphdr_put()
177 niph->ihl = sizeof(struct iphdr) / 4; in nf_reject_iphdr_put()
[all …]
/linux-5.19.10/samples/bpf/
Dtcbpf1_kern.c21 #define IP_CSUM_OFF (ETH_HLEN + offsetof(struct iphdr, check))
22 #define TOS_OFF (ETH_HLEN + offsetof(struct iphdr, tos))
32 #define TCP_CSUM_OFF (ETH_HLEN + sizeof(struct iphdr) + offsetof(struct tcphdr, check))
33 #define IP_SRC_OFF (ETH_HLEN + offsetof(struct iphdr, saddr))
46 #define TCP_DPORT_OFF (ETH_HLEN + sizeof(struct iphdr) + offsetof(struct tcphdr, dest))
58 __u8 proto = load_byte(skb, ETH_HLEN + offsetof(struct iphdr, protocol)); in bpf_prog1()
Dparse_ldabs.c23 return load_half(ctx, nhoff + offsetof(struct iphdr, frag_off)) in ip_is_fragment()
30 __u64 troff = ETH_HLEN + sizeof(struct iphdr); in handle_ingress()
34 if (load_byte(skb, ETH_HLEN + offsetof(struct iphdr, protocol)) != IPPROTO_UDP || in handle_ingress()
Dtcp_tos_reflect_kern.c28 struct iphdr *hdr; in bpf_basertt()
47 hdr_size = sizeof(struct iphdr); in bpf_basertt()
54 hdr = (struct iphdr *) header; in bpf_basertt()
Dtest_lwt_bpf.c72 struct iphdr *iph = data; in do_test_data()
84 #define IP_CSUM_OFF offsetof(struct iphdr, check)
85 #define IP_DST_OFF offsetof(struct iphdr, daddr)
86 #define IP_SRC_OFF offsetof(struct iphdr, saddr)
87 #define IP_PROTO_OFF offsetof(struct iphdr, protocol)
Dxdp_adjust_tail_kern.c72 int headroom = (int)sizeof(struct iphdr) + (int)sizeof(struct icmphdr); in send_icmp4_too_big()
82 struct iphdr *iph, *orig_iph; in send_icmp4_too_big()
92 off += sizeof(struct iphdr); in send_icmp4_too_big()
113 ipv4_csum(iph, sizeof(struct iphdr), &csum); in send_icmp4_too_big()
/linux-5.19.10/drivers/net/ethernet/qualcomm/rmnet/
Drmnet_map_data.c36 struct iphdr *ip4h = (struct iphdr *)skb->data; in rmnet_map_ipv4_dl_csum_trailer()
166 static void rmnet_map_complement_ipv4_txporthdr_csum_field(struct iphdr *ip4h) in rmnet_map_complement_ipv4_txporthdr_csum_field()
180 rmnet_map_ipv4_ul_csum_header(struct iphdr *iphdr, in rmnet_map_ipv4_ul_csum_header() argument
187 if (iphdr->protocol == IPPROTO_UDP) in rmnet_map_ipv4_ul_csum_header()
196 rmnet_map_complement_ipv4_txporthdr_csum_field(iphdr); in rmnet_map_ipv4_ul_csum_header()
261 u16 ip_len = ((struct iphdr *)iph)->ihl * 4; in rmnet_map_v5_checksum_uplink_packet()
263 proto = ((struct iphdr *)iph)->protocol; in rmnet_map_v5_checksum_uplink_packet()
435 void *iphdr; in rmnet_map_v4_checksum_uplink_packet() local
447 iphdr = (char *)ul_header + in rmnet_map_v4_checksum_uplink_packet()
451 rmnet_map_ipv4_ul_csum_header(iphdr, ul_header, skb); in rmnet_map_v4_checksum_uplink_packet()
[all …]
/linux-5.19.10/tools/testing/selftests/bpf/progs/
Dskb_pkt_end.c11 #define ETH_IPV4_TCP_SIZE (14 + sizeof(struct iphdr) + sizeof(struct tcphdr))
13 static INLINE struct iphdr *get_iphdr(struct __sk_buff *skb) in get_iphdr()
15 struct iphdr *ip = NULL; in get_iphdr()
31 struct iphdr *ip = NULL; in main_prog()
Dtest_cls_redirect.c198 static INLINING bool pkt_skip_ipv4_options(buf_t *buf, const struct iphdr *ipv4) in pkt_skip_ipv4_options()
207 static INLINING bool ipv4_is_fragment(const struct iphdr *ip) in ipv4_is_fragment()
213 static __always_inline struct iphdr *pkt_parse_ipv4(buf_t *pkt, struct iphdr *scratch) in pkt_parse_ipv4()
215 struct iphdr *ipv4 = buf_assign(pkt, sizeof(*ipv4), scratch); in pkt_parse_ipv4()
257 static INLINING void pkt_ipv4_checksum(struct iphdr *iph) in pkt_ipv4_checksum()
266 _Static_assert(sizeof(struct iphdr) == 20, "iphdr must be 20 bytes"); in pkt_ipv4_checksum()
271 for (size_t i = 0; i < sizeof(struct iphdr) / 2; i++) { in pkt_ipv4_checksum()
408 payload_off - sizeof(struct ethhdr) - sizeof(struct iphdr); in forward_with_gre()
450 skb, payload_off + offsetof(struct iphdr, ttl), &ttl, in forward_with_gre()
467 skb, payload_off + offsetof(struct iphdr, check), ttl, in forward_with_gre()
[all …]
Dtest_xdp_noinline.c224 off += sizeof(struct iphdr); in calc_offset()
226 off += sizeof(struct icmphdr) + sizeof(struct iphdr); in calc_offset()
330 struct iphdr *iph; in encap_v4()
337 if (bpf_xdp_adjust_head(xdp, 0 - (int)sizeof(struct iphdr))) in encap_v4()
343 old_eth = data + sizeof(struct iphdr); in encap_v4()
356 iph->tot_len = bpf_htons(pkt_bytes + sizeof(struct iphdr)); in encap_v4()
366 for (int i = 0; i < sizeof(struct iphdr) >> 1; i++) in encap_v4()
369 if (bpf_xdp_adjust_head(xdp, (int)sizeof(struct iphdr))) in encap_v4()
402 new_eth = *data + sizeof(struct iphdr); in decap_v4()
406 if (bpf_xdp_adjust_head(xdp, (int)sizeof(struct iphdr))) in decap_v4()
[all …]
/linux-5.19.10/include/net/
Dinet_ecn.h77 static inline int IP_ECN_set_ce(struct iphdr *iph) in IP_ECN_set_ce()
105 static inline int IP_ECN_set_ect1(struct iphdr *iph) in IP_ECN_set_ect1()
115 static inline void IP_ECN_clear(struct iphdr *iph) in IP_ECN_clear()
120 static inline void ipv4_copy_dscp(unsigned int dscp, struct iphdr *inner) in ipv4_copy_dscp()
176 if (skb_network_header(skb) + sizeof(struct iphdr) <= in INET_ECN_set_ce()
195 if (!pskb_network_may_pull(skb, sizeof(struct iphdr))) in skb_get_dsfield()
212 if (skb_network_header(skb) + sizeof(struct iphdr) <= in INET_ECN_set_ect1()
286 static inline int IP_ECN_decapsulate(const struct iphdr *oiph, in IP_ECN_decapsulate()
Dip_vs.h69 int hdr_flags, struct ip_vs_iphdr *iphdr) in ip_vs_fill_iph_skb_off() argument
71 iphdr->hdr_flags = hdr_flags; in ip_vs_fill_iph_skb_off()
72 iphdr->off = offset; in ip_vs_fill_iph_skb_off()
82 iphdr->saddr.in6 = iph->saddr; in ip_vs_fill_iph_skb_off()
83 iphdr->daddr.in6 = iph->daddr; in ip_vs_fill_iph_skb_off()
85 iphdr->len = offset; in ip_vs_fill_iph_skb_off()
86 iphdr->flags = 0; in ip_vs_fill_iph_skb_off()
87 iphdr->protocol = ipv6_find_hdr(skb, &iphdr->len, -1, in ip_vs_fill_iph_skb_off()
88 &iphdr->fragoffs, in ip_vs_fill_iph_skb_off()
89 &iphdr->flags); in ip_vs_fill_iph_skb_off()
[all …]
/linux-5.19.10/tools/testing/selftests/net/bpf/
Dnat6to4.c77 if (bpf_ntohs(ip6->payload_len) > 0xFFFF - sizeof(struct iphdr)) in sched_cls_ingress6_nat_6_prog()
94 struct iphdr ip = { in sched_cls_ingress6_nat_6_prog()
96 .ihl = sizeof(struct iphdr) / sizeof(__u32), // u4 in sched_cls_ingress6_nat_6_prog()
98 .tot_len = bpf_htons(bpf_ntohs(ip6->payload_len) + sizeof(struct iphdr)), // u16 in sched_cls_ingress6_nat_6_prog()
136 if (data + l2_header_size + sizeof(struct iphdr) > data_end) in sched_cls_ingress6_nat_6_prog()
145 *(struct iphdr *)(new_eth + 1) = ip; in sched_cls_ingress6_nat_6_prog()
156 const struct iphdr *const ip4 = (void *)(eth + 1); in sched_cls_egress4_snat4_prog()
/linux-5.19.10/net/ipv4/
Dah4.c80 static int ip_clear_mutable_options(const struct iphdr *iph, __be32 *daddr) 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()
127 struct iphdr *top_iph = ip_hdr(skb); in ah_output_done()
140 memcpy(top_iph+1, iph+1, top_iph->ihl*4 - sizeof(struct iphdr)); in ah_output_done()
157 struct iphdr *iph, *top_iph; in ah_output()
200 memcpy(iph+1, top_iph+1, top_iph->ihl*4 - sizeof(struct iphdr)); in ah_output()
256 memcpy(top_iph+1, iph+1, top_iph->ihl*4 - sizeof(struct iphdr)); in ah_output()
269 struct iphdr *work_iph; in ah_input_done()
315 struct iphdr *iph, *work_iph; in ah_input()
[all …]
Dip_options.c50 memcpy(iph + sizeof(struct iphdr), opt->__data, opt->optlen); in ip_options_build()
95 dopt->rr = dopt->optlen + sizeof(struct iphdr); in __ip_options_echo()
109 dopt->ts = dopt->optlen + sizeof(struct iphdr); in __ip_options_echo()
170 dopt->srr = dopt->optlen + sizeof(struct iphdr); in __ip_options_echo()
177 dopt->cipso = dopt->optlen+sizeof(struct iphdr); in __ip_options_echo()
197 unsigned char *optptr = skb_network_header(skb) + sizeof(struct iphdr); in ip_options_fragment()
257 iph = optptr - sizeof(struct iphdr); in __ip_options_compile()
485 unsigned char *optptr = opt->__data + opt->srr - sizeof(struct iphdr); in ip_options_undo()
491 unsigned char *optptr = opt->__data + opt->rr - sizeof(struct iphdr); in ip_options_undo()
497 unsigned char *optptr = opt->__data + opt->ts - sizeof(struct iphdr); in ip_options_undo()
[all …]
/linux-5.19.10/tools/testing/selftests/bpf/prog_tests/
Dflow_dissector.c44 struct iphdr iph;
50 struct iphdr iph;
51 struct iphdr iph_inner;
59 struct iphdr iph;
122 .thoff = ETH_HLEN + sizeof(struct iphdr),
164 .thoff = ETH_HLEN + VLAN_HLEN + sizeof(struct iphdr),
210 .thoff = ETH_HLEN + sizeof(struct iphdr),
235 .thoff = ETH_HLEN + sizeof(struct iphdr),
346 sizeof(struct iphdr),
353 .thoff = ETH_HLEN + sizeof(struct iphdr) +
[all …]
/linux-5.19.10/net/netfilter/
Dxt_DSCP.c34 if (skb_ensure_writable(skb, sizeof(struct iphdr))) in dscp_tg()
75 struct iphdr *iph = ip_hdr(skb); in tos_tg()
82 if (skb_ensure_writable(skb, sizeof(struct iphdr))) in tos_tg()
102 if (skb_ensure_writable(skb, sizeof(struct iphdr))) in tos_tg6()
/linux-5.19.10/drivers/net/wireguard/selftest/
Dratelimiter.c34 static __init int timings_test(struct sk_buff *skb4, struct iphdr *hdr4, in timings_test()
102 static __init int capacity_test(struct sk_buff *skb4, struct iphdr *hdr4, in capacity_test()
129 struct iphdr *hdr4; in wg_ratelimiter_selftest()
152 skb4 = alloc_skb(sizeof(struct iphdr), GFP_KERNEL); in wg_ratelimiter_selftest()
156 hdr4 = (struct iphdr *)skb_put(skb4, sizeof(*hdr4)); in wg_ratelimiter_selftest()
/linux-5.19.10/arch/powerpc/platforms/ps3/
Dgelic_udbg.c62 static __iomem struct iphdr *h_ip;
162 h_ip = (struct iphdr *)(h_vlan + 1); in gelic_debug_init()
165 h_ip = (struct iphdr *)(h_eth + 1); in gelic_debug_init()
168 header_size += sizeof(struct iphdr); in gelic_debug_init()
200 sizeof(struct iphdr); in gelic_sendbuf()
/linux-5.19.10/include/net/netfilter/
Dnf_tables_ipv4.h10 struct iphdr *ip; in nft_set_pktinfo_ipv4()
21 struct iphdr *iph, _iph; in __nft_set_pktinfo_ipv4_validate()
55 struct iphdr *iph; in nft_set_pktinfo_ipv4_ingress()
/linux-5.19.10/drivers/infiniband/core/
Dlag.c18 struct iphdr *iph; in rdma_build_skb()
26 hdr_len += is_ipv4 ? sizeof(struct iphdr) : sizeof(struct ipv6hdr); in rdma_build_skb()
43 skb_push(skb, sizeof(struct iphdr)); in rdma_build_skb()
51 iphdr)); in rdma_build_skb()
/linux-5.19.10/drivers/net/wireless/intel/iwlwifi/mei/
Dnet.c193 const struct iphdr *iphdr; in iwl_mei_rx_filter_ipv4() local
197 if (!pskb_may_pull(skb, skb_network_offset(skb) + sizeof(*iphdr)) || in iwl_mei_rx_filter_ipv4()
202 iphdr = ip_hdr(skb); in iwl_mei_rx_filter_ipv4()
204 filters->ipv4_filter.ipv4_addr == iphdr->daddr; in iwl_mei_rx_filter_ipv4()

12345678910>>...16