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 struct S;
0007 
0008 __noinline int foo(const struct S *s)
0009 {
0010     if (s)
0011         return bpf_get_prandom_u32() < *(const int *) s;
0012 
0013     return 0;
0014 }
0015 
0016 SEC("cgroup_skb/ingress")
0017 int test_cls(struct __sk_buff *skb)
0018 {
0019 
0020     return foo(NULL);
0021 }