xref: /linux/tools/testing/selftests/bpf/progs/verifier_mtu.c (revision 7a5f93ea5862da91488975acaa0c7abd508f192b)
1 // SPDX-License-Identifier: GPL-2.0
2 
3 #include "vmlinux.h"
4 #include <bpf/bpf_helpers.h>
5 #include "bpf_misc.h"
6 
7 SEC("tc/ingress")
8 __description("uninit/mtu: write rejected")
9 __success
10 __caps_unpriv(CAP_BPF|CAP_NET_ADMIN)
11 __failure_unpriv __msg_unpriv("invalid indirect read from stack")
12 int tc_uninit_mtu(struct __sk_buff *ctx)
13 {
14 	__u32 mtu;
15 
16 	bpf_check_mtu(ctx, 0, &mtu, 0, 0);
17 	return TCX_PASS;
18 }
19 
20 char LICENSE[] SEC("license") = "GPL";
21