| /linux/tools/testing/selftests/net/ |
| H A D | ip_defrag.c | 29 #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 …]
|
| H A D | nat6to4.bpf.c | 77 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()
|
| H A D | tap.c | 260 struct iphdr *iph = (struct iphdr *)buf; in build_ipv4_header() 305 vh->hdr_len = ETH_HLEN + sizeof(struct iphdr) + sizeof(struct udphdr); in build_test_packet_valid_udp_gso() 307 vh->csum_start = ETH_HLEN + sizeof(struct iphdr); in build_test_packet_valid_udp_gso() 310 vh->gso_size = ETH_DATA_LEN - sizeof(struct iphdr); in build_test_packet_valid_udp_gso() 342 vh->hdr_len = ETH_HLEN + sizeof(struct iphdr) + sizeof(struct udphdr); in build_test_packet_crash_tap_invalid_eth_proto() 345 vh->gso_size = ETH_DATA_LEN - sizeof(struct iphdr); in build_test_packet_crash_tap_invalid_eth_proto() 349 cur += sizeof(struct iphdr) + sizeof(struct udphdr); in build_test_packet_crash_tap_invalid_eth_proto()
|
| /linux/include/linux/ |
| H A D | ip.h | 19 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() 39 static inline unsigned int iph_totlen(const struct sk_buff *skb, const struct iphdr *iph) in iph_totlen() 55 static inline void iph_set_totlen(struct iphdr *iph, unsigned int len) in iph_set_totlen()
|
| H A D | virtio_net.h | 54 unsigned int nh_min_len = sizeof(struct iphdr); in __virtio_net_hdr_to_skb() 255 return is_ipv6 ? sizeof(struct ipv6hdr) : sizeof(struct iphdr); in virtio_l3min() 320 struct iphdr *iphdr = (struct iphdr *)(skb->data + inner_nh); in virtio_net_hdr_tnl_to_skb() local 322 inner_isv6 = iphdr->version == 6; in virtio_net_hdr_tnl_to_skb()
|
| /linux/samples/bpf/ |
| H A D | tcbpf1_kern.c | 21 #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()
|
| H A D | parse_ldabs.c | 23 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()
|
| H A D | tcp_tos_reflect_kern.c | 28 struct iphdr *hdr; in bpf_basertt() 47 hdr_size = sizeof(struct iphdr); in bpf_basertt() 54 hdr = (struct iphdr *) header; in bpf_basertt()
|
| H A D | test_lwt_bpf.c | 64 struct iphdr *iph = data; in do_test_data() 76 #define IP_CSUM_OFF offsetof(struct iphdr, check) 77 #define IP_DST_OFF offsetof(struct iphdr, daddr) 78 #define IP_SRC_OFF offsetof(struct iphdr, saddr) 79 #define IP_PROTO_OFF offsetof(struct iphdr, protocol)
|
| /linux/tools/testing/selftests/bpf/progs/ |
| H A D | skb_pkt_end.c | 13 #define ETH_IPV4_TCP_SIZE (14 + sizeof(struct iphdr) + sizeof(struct tcphdr)) 15 static INLINE struct iphdr *get_iphdr(struct __sk_buff *skb) in get_iphdr() 17 struct iphdr *ip = NULL; in get_iphdr() 33 struct iphdr *ip = NULL; in main_prog() 57 offset = sizeof(struct ethhdr) + offsetof(struct iphdr, protocol); in main_prog()
|
| H A D | test_cls_redirect_dynptr.c | 119 static bool ipv4_is_fragment(const struct iphdr *ip) in ipv4_is_fragment() 125 static int pkt_parse_ipv4(struct bpf_dynptr *dynptr, __u64 *offset, struct iphdr *iphdr) in pkt_parse_ipv4() argument 127 if (bpf_dynptr_read(iphdr, sizeof(*iphdr), dynptr, *offset, 0)) in pkt_parse_ipv4() 130 *offset += sizeof(*iphdr); in pkt_parse_ipv4() 132 if (iphdr->ihl < 5) in pkt_parse_ipv4() 136 *offset += (iphdr->ihl - 5) * 4; in pkt_parse_ipv4() 168 static void pkt_ipv4_checksum(struct iphdr *iph) in pkt_ipv4_checksum() 177 _Static_assert(sizeof(struct iphdr) in pkt_ipv4_checksum() [all...] |
| H A D | test_cls_redirect.c | 199 static INLINING bool pkt_skip_ipv4_options(buf_t *buf, const struct iphdr *ipv4) in buf_assign() 208 static INLINING bool ipv4_is_fragment(const struct iphdr *ip) in pkt_skip_ipv4_options() 214 static __always_inline struct iphdr *pkt_parse_ipv4(buf_t *pkt, struct iphdr *scratch) in ipv4_is_fragment() 216 struct iphdr *ipv4 = buf_assign(pkt, sizeof(*ipv4), scratch); in pkt_parse_ipv4() 258 static INLINING void pkt_ipv4_checksum(struct iphdr *iph) in pkt_checksum_fold() 267 _Static_assert(sizeof(struct iphdr) == 20, "iphdr must be 20 bytes"); in pkt_ipv4_checksum() 272 for (size_t i = 0; i < sizeof(struct iphdr) / 2; i++) { in pkt_ipv4_checksum() 409 payload_off - sizeof(struct ethhdr) - sizeof(struct iphdr); in forward_with_gre() [all...] |
| H A D | test_tc_change_tail.c | 12 static __always_inline struct iphdr *parse_ip_header(struct __sk_buff *skb, int *ip_proto) in parse_ip_header() 17 struct iphdr *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() 63 struct iphdr *iph; in change_tail()
|
| H A D | test_xdp_noinline.c | 225 off += sizeof(struct iphdr); in calc_offset() 227 off += sizeof(struct icmphdr) + sizeof(struct iphdr); in calc_offset() 339 struct iphdr *iph; in encap_v4() 346 if (bpf_xdp_adjust_head(xdp, 0 - (int)sizeof(struct iphdr))) in encap_v4() 352 old_eth = data + sizeof(struct iphdr); in encap_v4() 365 iph->tot_len = bpf_htons(pkt_bytes + sizeof(struct iphdr)); in encap_v4() 375 for (int i = 0; i < sizeof(struct iphdr) >> 1; i++) in encap_v4() 378 if (bpf_xdp_adjust_head(xdp, (int)sizeof(struct iphdr))) in encap_v4() 406 struct iphdr *iph; in send_icmp_reply() 411 + sizeof(struct iphdr) + sizeof(struct icmphdr) > data_end) in send_icmp_reply() [all …]
|
| /linux/tools/testing/selftests/drivers/net/ |
| H A D | gro.c | 120 next_off = sizeof(struct iphdr) + offsetof(struct iphdr, protocol); in setup_sock_filter() 122 next_off = offsetof(struct iphdr, protocol); in setup_sock_filter() 254 struct iphdr *iph = buf; in fill_networklayer() 275 payload_len + sizeof(struct iphdr)); in fill_networklayer() 281 iph->check = checksum_fold(buf, sizeof(struct iphdr), 0); in fill_networklayer() 325 fill_networklayer(buf + ETH_HLEN, payload_len + sizeof(struct iphdr), in create_packet() 327 fill_networklayer(buf + ETH_HLEN + sizeof(struct iphdr), in create_packet() 420 struct iphdr *iph = (struct iphdr *)(buf + ETH_HLEN); in recompute_packet() 432 iph->check = checksum_fold(iph, sizeof(struct iphdr), 0); in recompute_packet() 438 iph->check = checksum_fold(iph, sizeof(struct iphdr), 0); in recompute_packet() [all …]
|
| /linux/tools/testing/selftests/bpf/prog_tests/ |
| H A D | flow_dissector.c | 20 struct iphdr iph; 26 struct iphdr iph; 27 struct iphdr iph_inner; 35 struct iphdr iph; 74 struct iphdr iph; 76 struct iphdr iph_inner; 112 .thoff = ETH_HLEN + sizeof(struct iphdr), 156 .thoff = ETH_HLEN + VLAN_HLEN + sizeof(struct iphdr), 204 .thoff = ETH_HLEN + sizeof(struct iphdr), 230 .thoff = ETH_HLEN + sizeof(struct iphdr), [all …]
|
| /linux/include/net/ |
| H A D | inet_ecn.h | 77 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()
|
| H A D | ip_vs.h | 72 int hdr_flags, struct ip_vs_iphdr *iphdr) in ip_vs_fill_iph_skb_off() argument 74 iphdr->hdr_flags = hdr_flags; in ip_vs_fill_iph_skb_off() 75 iphdr->off = offset; in ip_vs_fill_iph_skb_off() 85 iphdr->saddr.in6 = iph->saddr; in ip_vs_fill_iph_skb_off() 86 iphdr->daddr.in6 = iph->daddr; in ip_vs_fill_iph_skb_off() 88 iphdr->len = offset; in ip_vs_fill_iph_skb_off() 89 iphdr->flags = 0; in ip_vs_fill_iph_skb_off() 90 iphdr->protocol = ipv6_find_hdr(skb, &iphdr->len, -1, in ip_vs_fill_iph_skb_off() 91 &iphdr->fragoffs, in ip_vs_fill_iph_skb_off() 92 &iphdr->flags); in ip_vs_fill_iph_skb_off() [all …]
|
| /linux/net/ipv4/ |
| H A D | ah4.c | 77 static int ip_clear_mutable_options(const struct iphdr *iph, __be32 *daddr) 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() 124 struct iphdr *top_iph = ip_hdr(skb); in ah_output_done() 137 memcpy(top_iph+1, iph+1, top_iph->ihl*4 - sizeof(struct iphdr)); in ah_output_done() 154 struct iphdr *iph, *top_iph; in ah_output() 197 memcpy(iph+1, top_iph+1, top_iph->ihl*4 - sizeof(struct iphdr)); in ah_output() 253 memcpy(top_iph+1, iph+1, top_iph->ihl*4 - sizeof(struct iphdr)); in ah_output() 266 struct iphdr *work_iph; in ah_input_done() 312 struct iphdr *iph, *work_iph; in ah_input() [all …]
|
| H A D | icmp.c | 483 const struct iphdr *iph, __be32 saddr, in icmp_route_lookup() 778 struct iphdr *iph; in __icmp_send() 945 room -= sizeof(struct iphdr) + icmp_param.replyopts.opt.opt.optlen; in icmp_unreach() 950 if (room <= (int)sizeof(struct iphdr)) in icmp_unreach() 1009 (skb_network_header(skb_in) + sizeof(struct iphdr)) > 1011 skb_network_offset(skb_in) + sizeof(struct iphdr)))) 1027 const struct iphdr *iph = (const struct iphdr *)skb->data; in icmp_echo() 1064 const struct iphdr *iph; in icmp_build_probe() 1077 if (!pskb_may_pull(skb, sizeof(struct iphdr))) in icmp_build_probe() [all...] |
| /linux/drivers/net/wireguard/selftest/ |
| H A D | ratelimiter.c | 33 static __init int timings_test(struct sk_buff *skb4, struct iphdr *hdr4, in timings_test() 97 static __init int capacity_test(struct sk_buff *skb4, struct iphdr *hdr4, in capacity_test() 124 struct iphdr *hdr4; in wg_ratelimiter_selftest() 147 skb4 = alloc_skb(sizeof(struct iphdr), GFP_KERNEL); in wg_ratelimiter_selftest() 151 hdr4 = (struct iphdr *)skb_put(skb4, sizeof(*hdr4)); in wg_ratelimiter_selftest()
|
| /linux/net/netfilter/ |
| H A D | xt_DSCP.c | 36 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/arch/powerpc/platforms/ps3/ |
| H A D | gelic_udbg.c | 63 static __iomem struct iphdr *h_ip; 163 h_ip = (struct iphdr *)(h_vlan + 1); in gelic_debug_init() 166 h_ip = (struct iphdr *)(h_eth + 1); in gelic_debug_init() 169 header_size += sizeof(struct iphdr); in gelic_debug_init() 201 sizeof(struct iphdr); in gelic_sendbuf()
|
| /linux/drivers/infiniband/core/ |
| H A D | lag.c | 17 struct iphdr *iph; in rdma_build_skb() 25 hdr_len += is_ipv4 ? sizeof(struct iphdr) : sizeof(struct ipv6hdr); in rdma_build_skb() 42 skb_push(skb, sizeof(struct iphdr)); in rdma_build_skb() 50 iphdr)); in rdma_build_skb()
|
| /linux/include/net/netfilter/ |
| H A D | nf_tables_ipv4.h | 10 struct iphdr *ip; in nft_set_pktinfo_ipv4() 21 struct iphdr *iph, _iph; in __nft_set_pktinfo_ipv4_validate() 59 struct iphdr *iph; in nft_set_pktinfo_ipv4_ingress()
|