Back to home page

OSCL-LXR

 
 

    


0001 // SPDX-License-Identifier: GPL-2.0-only
0002 #include <stddef.h>
0003 #include <linux/bpf.h>
0004 #include <bpf/bpf_helpers.h>
0005 
0006 __noinline int foo(unsigned int *v)
0007 {
0008     if (v)
0009         *v = bpf_get_prandom_u32();
0010 
0011     return 0;
0012 }
0013 
0014 SEC("cgroup_skb/ingress")
0015 int test_cls(struct __sk_buff *skb)
0016 {
0017     unsigned int v = 1;
0018 
0019     foo(&v);
0020 
0021     return v;
0022 }