Linux kernel mirror (for testing)
git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel
os
linux
1// SPDX-License-Identifier: GPL-2.0-only
2/* Copyright (c) 2020 Facebook */
3#include <stddef.h>
4#include <linux/bpf.h>
5#include <bpf/bpf_helpers.h>
6
7__noinline int foo(struct __sk_buff *skb)
8{
9 return bpf_get_prandom_u32();
10}
11
12SEC("cgroup_skb/ingress")
13int test_cls(struct __sk_buff *skb)
14{
15 if (!foo(skb))
16 return 0;
17
18 return 1;
19}