/linux/samples/bpf/ |
H A D | parse_varlen.c | 22 static int tcp(void *data, uint64_t tp_off, void *data_end) in tcp() argument 26 if (tcp + 1 > data_end) in tcp() 33 static int udp(void *data, uint64_t tp_off, void *data_end) in udp() argument 37 if (udp + 1 > data_end) in udp() 51 static int parse_ipv4(void *data, uint64_t nh_off, void *data_end) in parse_ipv4() argument 57 if (iph + 1 > data_end) in parse_ipv4() 66 if (iph + 1 > data_end) in parse_ipv4() 72 return tcp(data, nh_off + ihl_len, data_end); in parse_ipv4() 74 return udp(data, nh_off + ihl_len, data_end); in parse_ipv4() 78 static int parse_ipv6(void *data, uint64_t nh_off, void *data_end) in parse_ipv6() argument [all …]
|
H A D | xdp_tx_iptunnel_kern.c | 45 static __always_inline int get_dport(void *trans_data, void *data_end, in get_dport() argument 54 if (th + 1 > data_end) in get_dport() 59 if (uh + 1 > data_end) in get_dport() 79 void *data_end = (void *)(long)xdp->data_end; 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() 116 data_end = (void *)(long)xdp->data_end; in handle_ipv4() 122 if (new_eth + 1 > data_end || in handle_ipv4() 123 old_eth + 1 > data_end || in handle_ipv4() 124 iph + 1 > data_end) in handle_ipv4() [all …]
|
/linux/tools/testing/selftests/bpf/progs/ |
H A D | verifier_direct_packet_access.c | 20 __imm_const(__sk_buff_data_end, offsetof(struct __sk_buff, data_end)) in __retval() 40 __imm_const(__sk_buff_data_end, offsetof(struct __sk_buff, data_end)) in direct_packet_access_test1() 74 __imm_const(__sk_buff_data_end, offsetof(struct __sk_buff, data_end)), in direct_packet_access_test2() 110 __imm_const(__sk_buff_data_end, offsetof(struct __sk_buff, data_end)) in direct_packet_access_test4_write() 132 __imm_const(__sk_buff_data_end, offsetof(struct __sk_buff, data_end)) in pkt_end_reg_good_access() 154 __imm_const(__sk_buff_data_end, offsetof(struct __sk_buff, data_end)) in pkt_end_reg_bad_access() 177 __imm_const(__sk_buff_data_end, offsetof(struct __sk_buff, data_end)) in pkt_end_reg_both_accesses() 201 __imm_const(__sk_buff_data_end, offsetof(struct __sk_buff, data_end)) in test8_double_test_variant_1() 225 __imm_const(__sk_buff_data_end, offsetof(struct __sk_buff, data_end)) in test9_double_test_variant_2() 247 __imm_const(__sk_buff_data_end, offsetof(struct __sk_buff, data_end)) in packet_access_test10_write_invalid() [all …]
|
H A D | test_xdp.c | 47 static __always_inline int get_dport(void *trans_data, void *data_end, in get_dport() argument 56 if (th + 1 > data_end) in get_dport() 61 if (uh + 1 > data_end) in get_dport() 81 void *data_end = (void *)(long)xdp->data_end; in handle_ipv4() local 94 if (iph + 1 > data_end) in handle_ipv4() 97 dport = get_dport(iph + 1, data_end, iph->protocol); in handle_ipv4() 116 data_end = (void *)(long)xdp->data_end; in handle_ipv4() 122 if (new_eth + 1 > data_end || in handle_ipv4() 123 old_eth + 1 > data_end || in handle_ipv4() 124 iph + 1 > data_end) in handle_ipv4() [all …]
|
H A D | test_xdp_loop.c | 43 static __always_inline int get_dport(void *trans_data, void *data_end, in get_dport() argument 52 if (th + 1 > data_end) in get_dport() 57 if (uh + 1 > data_end) in get_dport() 77 void *data_end = (void *)(long)xdp->data_end; in handle_ipv4() local 90 if (iph + 1 > data_end) in handle_ipv4() 93 dport = get_dport(iph + 1, data_end, iph->protocol); in handle_ipv4() 112 data_end = (void *)(long)xdp->data_end; in handle_ipv4() 118 if (new_eth + 1 > data_end || in handle_ipv4() 119 old_eth + 1 > data_end || in handle_ipv4() 120 iph + 1 > data_end) in handle_ipv4() [all …]
|
H A D | xdpwall.c | 106 static __always_inline struct ethhdr *parse_ethhdr(void *data, void *data_end) in parse_ethhdr() argument 110 if (eth + 1 > data_end) in parse_ethhdr() 165 get_transport_hdr(__u16 offset, void *data, void *data_end) in get_transport_hdr() argument 167 if (offset > 255 || data + offset > data_end) in get_transport_hdr() 191 parse_tcp(struct pkt_info *info, void *transport_hdr, void *data_end) in parse_tcp() argument 195 if (tcp + 1 > data_end) in parse_tcp() 206 parse_udp(struct pkt_info *info, void *transport_hdr, void *data_end) in parse_udp() argument 210 if (udp + 1 > data_end) in parse_udp() 234 filter_transport_hdr(void *transport_hdr, void *data_end, in filter_transport_hdr() argument 238 if (!parse_tcp(info, transport_hdr, data_end)) in filter_transport_hdr() [all …]
|
H A D | test_xdp_noinline.c | 233 bool parse_udp(void *data, void *data_end, in parse_udp() argument 242 if (udp + 1 > data_end) in parse_udp() 255 bool parse_tcp(void *data, void *data_end, in parse_tcp() argument 264 if (tcp + 1 > data_end) in parse_tcp() 287 void *data_end; in encap_v6() local 293 data_end = (void *)(long)xdp->data_end; in encap_v6() 297 if (new_eth + 1 > data_end || in encap_v6() 298 old_eth + 1 > data_end || ip6h + 1 > data_end) in encap_v6() 341 void *data_end; in encap_v4() local 349 data_end = (void *)(long)xdp->data_end; in encap_v4() [all …]
|
H A D | test_btf_skc_cls_ingress.c | 29 void *data_end; in test_syncookie_helper() 31 data_end = (void *)(long)(skb->data_end); in test_syncookie_helper() 38 if ((void *)th + 40 > data_end) { in test_syncookie_helper() 71 void *data_end, *iphdr; in handle_ip6_tcp() 77 data_end = (void *)(long)(skb->data_end); in handle_ip6_tcp() 82 if (ip4h + 1 > data_end) in handle_ip6_tcp() 87 if (th + 1 > data_end) in handle_ip6_tcp() 99 if (ip6h + 1 > data_end) in handle_ip6_tcp() 27 void *data_end; test_syncookie_helper() local 69 void *data_end; handle_ip6_tcp() local 147 void *data_end; cls_ingress() local [all...] |
H A D | test_xdp_do_redirect.c | 32 void *data_end = (void *)(long)xdp->data_end; in xdp_redirect() local 38 if (payload + 1 > data_end) in xdp_redirect() 67 static bool check_pkt(void *data, void *data_end, const __u32 mark) in check_pkt() argument 72 if (payload + 1 > data_end) in check_pkt() 89 void *data_end = (void *)(long)xdp->data_end; in xdp_count_pkts() local 91 if (check_pkt(data, data_end, MARK_XMIT)) in xdp_count_pkts() 105 void *data_end = (void *)(long)skb->data_end; in tc_count_pkts() local 107 if (check_pkt(data, data_end, MARK_SKB)) in tc_count_pkts()
|
H A D | verifier_helper_packet_access.c | 36 __imm_const(xdp_md_data_end, offsetof(struct xdp_md, data_end)) in test1_valid_packet_ptr_range() 84 __imm_const(xdp_md_data_end, offsetof(struct xdp_md, data_end)) in to_packet_test3_variable_add() 109 __imm_const(xdp_md_data_end, offsetof(struct xdp_md, data_end)) in packet_ptr_with_bad_range_1() 133 __imm_const(xdp_md_data_end, offsetof(struct xdp_md, data_end)) in ptr_with_too_short_range_1() 158 __imm_const(__sk_buff_data_end, offsetof(struct __sk_buff, data_end)) in cls_valid_packet_ptr_range() 206 __imm_const(__sk_buff_data_end, offsetof(struct __sk_buff, data_end)) in packet_test8_cls_variable_add() 231 __imm_const(__sk_buff_data_end, offsetof(struct __sk_buff, data_end)) in packet_ptr_with_bad_range_2() 255 __imm_const(__sk_buff_data_end, offsetof(struct __sk_buff, data_end)) in ptr_with_too_short_range_2() 280 __imm_const(__sk_buff_data_end, offsetof(struct __sk_buff, data_end)) in test11_cls_unsuitable_helper_1() 303 __imm_const(__sk_buff_data_end, offsetof(struct __sk_buff, data_end)) in test12_cls_unsuitable_helper_2() [all …]
|
H A D | test_tc_change_tail.c | 14 void *data_end = (void *)(long)skb->data_end; in parse_ip_header() local 20 if ((void *)(data + sizeof(*eth)) > data_end) in parse_ip_header() 27 if ((void *)(data + sizeof(struct ethhdr) + sizeof(*iph)) > data_end) in parse_ip_header() 43 void *data_end = (void *)(long)skb->data_end; in parse_udp_header() local 52 if ((void *)(hdr + sizeof(*udp)) > data_end) in parse_udp_header() 64 void *data_end; in change_tail() local 70 data_end = (void *)(long)skb->data_end; in change_tail() 83 if (payload + 1 > (char *)data_end) in change_tail()
|
H A D | test_xdp_vlan.c | 57 bool parse_eth_frame(struct ethhdr *eth, void *data_end, struct parse_pkt *pkt) in parse_eth_frame() argument 64 if ((void *)eth + offset + (2*sizeof(struct _vlan_hdr)) > data_end) in parse_eth_frame() 108 void *data_end = (void *)(long)ctx->data_end; in xdp_prognum0() local 112 if (!parse_eth_frame(data, data_end, &pkt)) in xdp_prognum0() 150 void *data_end = (void *)(long)ctx->data_end; in xdp_prognum1() local 154 if (!parse_eth_frame(data, data_end, &pkt)) in xdp_prognum1() 184 void *data_end = (void *)(long)ctx->data_end; in xdp_prognum2() local 189 if (!parse_eth_frame(data, data_end, &pkt)) in xdp_prognum2() 230 void *data_end = (void *)(long)ctx->data_end; in xdp_prognum3() local 235 if (!parse_eth_frame(orig_eth, data_end, &pkt)) in xdp_prognum3()
|
H A D | test_tc_neigh_fib.c | 27 void *data_end = ctx_ptr(skb->data_end); in fill_fib_params_v4() local 31 if (data + sizeof(struct ethhdr) > data_end) in fill_fib_params_v4() 35 if ((void *)(ip4h + 1) > data_end) in fill_fib_params_v4() 55 void *data_end = ctx_ptr(skb->data_end); in fill_fib_params_v6() local 59 if (data + sizeof(struct ethhdr) > data_end) in fill_fib_params_v6() 63 if ((void *)(ip6h + 1) > data_end) in fill_fib_params_v6() 81 void *data_end = ctx_ptr(skb->data_end); in tc_chk() local 85 if (data + sizeof(struct ethhdr) > data_end) in tc_chk() 128 void *data_end = ctx_ptr(skb->data_end); in tc_redir() local 131 if (eth + 1 > data_end) in tc_redir()
|
H A D | vrf_socket_lookup.c | 18 static void socket_lookup(void *ctx, void *data_end, void *data) in socket_lookup() argument 26 if (eth + 1 > data_end) in socket_lookup() 33 if (iph + 1 > data_end) in socket_lookup() 38 if ((void *)tp + tplen > data_end) in socket_lookup() 66 void *data_end = (void *)(long)skb->data_end; in tc_socket_lookup() local 72 socket_lookup(skb, data_end, data); in tc_socket_lookup() 79 void *data_end = (void *)(long)xdp->data_end; in xdp_socket_lookup() local 85 socket_lookup(xdp, data_end, data); in xdp_socket_lookup()
|
H A D | verifier_xdp_direct_packet_access.c | 25 __imm_const(xdp_md_data_end, offsetof(struct xdp_md, data_end)) in end_mangling_bad_access_1() 46 __imm_const(xdp_md_data_end, offsetof(struct xdp_md, data_end)) in end_mangling_bad_access_2() 66 __imm_const(xdp_md_data_end, offsetof(struct xdp_md, data_end)) in __flag() 87 __imm_const(xdp_md_data_end, offsetof(struct xdp_md, data_end)) in __flag() 108 __imm_const(xdp_md_data_end, offsetof(struct xdp_md, data_end)) in __flag() 128 __imm_const(xdp_md_data_end, offsetof(struct xdp_md, data_end)) in __flag() 149 __imm_const(xdp_md_data_end, offsetof(struct xdp_md, data_end)) in __flag() 170 __imm_const(xdp_md_data_end, offsetof(struct xdp_md, data_end)) in __flag() 192 __imm_const(xdp_md_data_end, offsetof(struct xdp_md, data_end)) in __flag() 213 __imm_const(xdp_md_data_end, offsetof(struct xdp_md, data_end)) in __flag() [all …]
|
H A D | test_tc_neigh.c | 42 void *data_end = ctx_ptr(skb->data_end); in is_remote_ep_v4() local 46 if (data + sizeof(struct ethhdr) > data_end) in is_remote_ep_v4() 50 if ((void *)(ip4h + 1) > data_end) in is_remote_ep_v4() 59 void *data_end = ctx_ptr(skb->data_end); in is_remote_ep_v6() local 63 if (data + sizeof(struct ethhdr) > data_end) in is_remote_ep_v6() 67 if ((void *)(ip6h + 1) > data_end) in is_remote_ep_v6() 76 void *data_end = ctx_ptr(skb->data_end); in tc_chk() local 80 if (data + sizeof(struct ethhdr) > data_end) in tc_chk()
|
H A D | test_tcp_check_syncookie_kern.c |
|
H A D | test_pkt_access.c | 88 void *data_end = (void *)(long)skb->data_end; in test_pkt_write_access_subprog() local 95 if (tcp + 1 > data_end) in test_pkt_write_access_subprog() 105 void *data_end = (void *)(long)skb->data_end; in test_pkt_access() local 112 if (eth + 1 > data_end) in test_pkt_access() 118 if (iph + 1 > data_end) in test_pkt_access() 126 if (ip6h + 1 > data_end) in test_pkt_access() 142 if (((void *)(tcp) + 20) > data_end || proto != 6) in test_pkt_access() 145 if (((void *)(tcp) + 18) > data_end) in test_pkt_access()
|
H A D | test_xdp_meta.c | 14 __u8 *data, *data_meta, *data_end; in ing_cls() local 18 data_end = ctx_ptr(ctx, data_end); in ing_cls() 21 if (data + ETH_ALEN > data_end || in ing_cls() 34 __u8 *data, *data_meta, *data_end; in ing_xdp() local 42 data_end = ctx_ptr(ctx, data_end); in ing_xdp() 45 if (data + ETH_ALEN > data_end || in ing_xdp()
|
H A D | test_parse_tcp_hdr_opt.c | 39 const void *data_end = (void *)(long)xdp->data_end; in parse_hdr_opt() local 43 if (tcp_opt + 1 > data_end) in parse_hdr_opt() 58 tcp_opt + sizeof(__u8) + sizeof(__u8) > data_end) in parse_hdr_opt() 69 if (tcp_opt + tcp_hdr_opt_len_tpr > data_end) in parse_hdr_opt() 85 const void *data_end = (void *)(long)xdp->data_end; in xdp_ingress_v6() local 94 if (tcp_hdr + 1 > data_end) in xdp_ingress_v6()
|
H A D | sockmap_parse_prog.c | 8 void *data_end = (void *)(long) skb->data_end; in bpf_prog1() local 13 if (data + 10 > data_end) { in bpf_prog1() 18 data_end = (void *)(long)skb->data_end; in bpf_prog1() 20 if (data + 10 > data_end) in bpf_prog1()
|
H A D | test_check_mtu.c | 61 void *data_end = (void *)(long)ctx->data_end; in xdp_exceed_mtu() local 64 __u32 data_len = data_end - data; in xdp_exceed_mtu() 88 void *data_end = (void *)(long)ctx->data_end; in xdp_minus_delta() local 91 __u32 data_len = data_end - data; in xdp_minus_delta() 112 void *data_end = (void *)(long)ctx->data_end; in xdp_input_len() local 115 __u32 data_len = data_end - data; in xdp_input_len() 203 void *data_end = (void *)(long)ctx->data_end; in tc_exceed_mtu_da() local 206 __u32 data_len = data_end - data; in tc_exceed_mtu_da()
|
H A D | test_tc_edt.c | 67 void *data_end = (void *)(long)skb->data_end; in handle_tcp() local 70 if ((void *)(tcp + 1) > data_end) in handle_tcp() 81 void *data_end = (void *)(long)skb->data_end; in handle_ipv4() local 87 if (data + sizeof(struct ethhdr) > data_end) in handle_ipv4() 90 if ((void *)(iph + 1) > data_end) in handle_ipv4() 93 if (((void *)iph) + ihl > data_end) in handle_ipv4()
|
H A D | test_l4lb_noinline.c | 233 static __noinline int parse_icmpv6(void *data, void *data_end, __u64 off, in parse_icmpv6() argument 240 if (icmp_hdr + 1 > data_end) in parse_icmpv6() 246 if (ip6h + 1 > data_end) in parse_icmpv6() 255 static __noinline int parse_icmp(void *data, void *data_end, __u64 off, in parse_icmp() argument 262 if (icmp_hdr + 1 > data_end) in parse_icmp() 269 if (iph + 1 > data_end) in parse_icmp() 280 static __noinline bool parse_udp(void *data, __u64 off, void *data_end, in parse_udp() argument 286 if (udp + 1 > data_end) in parse_udp() 299 static __noinline bool parse_tcp(void *data, __u64 off, void *data_end, in parse_tcp() argument 305 if (tcp + 1 > data_end) in parse_tcp() [all …]
|
/linux/tools/testing/selftests/net/ |
H A D | nat6to4.bpf.c | 53 const void *data_end = (void *)(long)skb->data_end; in sched_cls_ingress6_nat_6_prog() local 66 if (data + l2_header_size + sizeof(*ip6) > data_end) in sched_cls_ingress6_nat_6_prog() 135 data_end = (void *)(long)skb->data_end; 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() 154 const void *data_end = (void *)(long)skb->data_end; in sched_cls_egress4_snat4_prog() local 163 if (data + l2_header_size + sizeof(struct ipv6hdr) > data_end) in sched_cls_egress4_snat4_prog() 210 if (data + sizeof(*ip4) + sizeof(struct udphdr) > data_end) in sched_cls_egress4_snat4_prog() 269 data_end = (void *)(long)skb->data_end; in sched_cls_egress4_snat4_prog() 273 if (data + l2_header_size + sizeof(ip6) > data_end) in sched_cls_egress4_snat4_prog()
|