/openbmc/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()
|
/openbmc/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.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 | gro.c | 111 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 …]
|
H A D | tap.c | 266 struct iphdr *iph = (struct iphdr *)buf; in build_ipv4_header() 311 vh->hdr_len = ETH_HLEN + sizeof(struct iphdr) + sizeof(struct udphdr); in build_test_packet_valid_udp_gso() 313 vh->csum_start = ETH_HLEN + sizeof(struct iphdr); in build_test_packet_valid_udp_gso() 316 vh->gso_size = ETH_DATA_LEN - sizeof(struct iphdr); in build_test_packet_valid_udp_gso() 348 vh->hdr_len = ETH_HLEN + sizeof(struct iphdr) + sizeof(struct udphdr); in build_test_packet_crash_tap_invalid_eth_proto() 351 vh->gso_size = ETH_DATA_LEN - sizeof(struct iphdr); in build_test_packet_crash_tap_invalid_eth_proto() 355 cur += sizeof(struct iphdr) + sizeof(struct udphdr); in build_test_packet_crash_tap_invalid_eth_proto()
|
/openbmc/qemu/net/ |
H A D | eth.c | 42 struct ip_header *iphdr = (struct ip_header *) l3_hdr; in eth_get_gso_type() local 44 if (IP_HEADER_VERSION(iphdr) == IP_HEADER_VERSION_4) { in eth_get_gso_type() 45 if (IPTOS_ECN(iphdr->ip_tos) == IPTOS_ECN_CE) { in eth_get_gso_type() 151 struct ip_header *iphdr = &ip4hdr_info->ip4_hdr; in eth_get_protocols() local 157 copied = iov_to_buf(iov, iovcnt, *l3hdr_off, iphdr, sizeof(*iphdr)); in eth_get_protocols() 158 if (copied < sizeof(*iphdr) || in eth_get_protocols() 159 IP_HEADER_VERSION(iphdr) != IP_HEADER_VERSION_4) { in eth_get_protocols() 164 ip_p = iphdr->ip_p; in eth_get_protocols() 165 ip4hdr_info->fragment = IP4_IS_FRAGMENT(iphdr); in eth_get_protocols() 166 *l4hdr_off = *l3hdr_off + IP_HDR_GET_LEN(iphdr); in eth_get_protocols() [all …]
|
/openbmc/linux/net/ipv4/netfilter/ |
H A D | nf_reject_ipv4.c | 17 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 …]
|
/openbmc/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)
|
H A D | xdp_adjust_tail_kern.c | 73 int headroom = (int)sizeof(struct iphdr) + (int)sizeof(struct icmphdr); in send_icmp4_too_big() 83 struct iphdr *iph, *orig_iph; in send_icmp4_too_big() 93 off += sizeof(struct iphdr); in send_icmp4_too_big() 114 ipv4_csum(iph, sizeof(struct iphdr), &csum); in send_icmp4_too_big()
|
/openbmc/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 …]
|
/openbmc/linux/tools/testing/selftests/bpf/progs/ |
H A D | skb_pkt_end.c | 11 #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()
|
H A D | test_cls_redirect_dynptr.c | 117 static bool ipv4_is_fragment(const struct iphdr *ip) in ipv4_is_fragment() 123 static int pkt_parse_ipv4(struct bpf_dynptr *dynptr, __u64 *offset, struct iphdr *iphdr) in pkt_parse_ipv4() argument 125 if (bpf_dynptr_read(iphdr, sizeof(*iphdr), dynptr, *offset, 0)) in pkt_parse_ipv4() 128 *offset += sizeof(*iphdr); in pkt_parse_ipv4() 130 if (iphdr->ihl < 5) in pkt_parse_ipv4() 134 *offset += (iphdr->ihl - 5) * 4; in pkt_parse_ipv4() 166 static void pkt_ipv4_checksum(struct iphdr *iph) in pkt_ipv4_checksum() 175 _Static_assert(sizeof(struct iphdr) == 20, "iphdr must be 20 bytes"); in pkt_ipv4_checksum() 179 for (size_t i = 0; i < sizeof(struct iphdr) / 2; i++) in pkt_ipv4_checksum() 299 payload_off - sizeof(struct ethhdr) - sizeof(struct iphdr); in forward_with_gre() [all …]
|
H A D | test_cls_redirect.c | 198 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 …]
|
H A D | test_xdp_noinline.c | 224 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() 393 struct iphdr *iph; in send_icmp_reply() 398 + sizeof(struct iphdr) + sizeof(struct icmphdr) > data_end) in send_icmp_reply() [all …]
|
/openbmc/linux/tools/testing/selftests/bpf/prog_tests/ |
H A D | flow_dissector.c | 46 struct iphdr iph; 52 struct iphdr iph; 53 struct iphdr iph_inner; 61 struct iphdr iph; 125 .thoff = ETH_HLEN + sizeof(struct iphdr), 169 .thoff = ETH_HLEN + VLAN_HLEN + sizeof(struct iphdr), 217 .thoff = ETH_HLEN + sizeof(struct iphdr), 243 .thoff = ETH_HLEN + sizeof(struct iphdr), 383 sizeof(struct iphdr), 390 .thoff = ETH_HLEN + sizeof(struct iphdr) + [all …]
|
/openbmc/linux/net/ipv4/ |
H A D | ah4.c | 80 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 …]
|
H A D | ip_options.c | 50 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...] |
/openbmc/linux/drivers/net/ethernet/qualcomm/rmnet/ |
H A D | rmnet_map_data.c | 37 struct iphdr *ip4h = (struct iphdr *)skb->data; in rmnet_map_ipv4_dl_csum_trailer() 167 static void rmnet_map_complement_ipv4_txporthdr_csum_field(struct iphdr *ip4h) in rmnet_map_complement_ipv4_txporthdr_csum_field() 181 rmnet_map_ipv4_ul_csum_header(struct iphdr *iphdr, in rmnet_map_ipv4_ul_csum_header() argument 188 if (iphdr->protocol == IPPROTO_UDP) in rmnet_map_ipv4_ul_csum_header() 197 rmnet_map_complement_ipv4_txporthdr_csum_field(iphdr); in rmnet_map_ipv4_ul_csum_header() 262 u16 ip_len = ((struct iphdr *)iph)->ihl * 4; in rmnet_map_v5_checksum_uplink_packet() 264 proto = ((struct iphdr *)iph)->protocol; in rmnet_map_v5_checksum_uplink_packet() 436 void *iphdr; in rmnet_map_v4_checksum_uplink_packet() local 448 iphdr = (char *)ul_header + in rmnet_map_v4_checksum_uplink_packet() 452 rmnet_map_ipv4_ul_csum_header(iphdr, ul_header, skb); in rmnet_map_v4_checksum_uplink_packet() [all …]
|
/openbmc/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()
|
/openbmc/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()
|
/openbmc/linux/arch/powerpc/platforms/ps3/ |
H A D | gelic_udbg.c | 62 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()
|