1 // SPDX-License-Identifier: GPL-2.0-only 2 #include <stddef.h> 3 #include <linux/bpf.h> 4 #include <bpf/bpf_helpers.h> 5 6 struct S { 7 int x; 8 }; 9 10 __noinline int foo(const struct S *s) 11 { 12 if (s) 13 return bpf_get_prandom_u32() < s->x; 14 15 return 0; 16 } 17 18 SEC("cgroup_skb/ingress") 19 int test_cls(struct __sk_buff *skb) 20 { 21 const struct S *s = (const struct S *)(0xbedabeda); 22 23 return foo(s); 24 } 25