xref: /linux/tools/testing/selftests/bpf/progs/verifier_mtu.c (revision c532de5a67a70f8533d495f8f2aaa9a0491c3ad0)
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 __failure __msg("invalid indirect read from stack")
10 int tc_uninit_mtu(struct __sk_buff *ctx)
11 {
12 	__u32 mtu;
13 
14 	bpf_check_mtu(ctx, 0, &mtu, 0, 0);
15 	return TCX_PASS;
16 }
17 
18 char LICENSE[] SEC("license") = "GPL";
19