Back to home page

OSCL-LXR

 
 

    


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