xref: /linux/tools/testing/selftests/bpf/progs/test_cgroup_link.c (revision 26fbb4c8c7c3ee9a4c3b4de555a8587b5a19154e)
1 // SPDX-License-Identifier: GPL-2.0
2 // Copyright (c) 2020 Facebook
3 #include <linux/bpf.h>
4 #include <bpf/bpf_helpers.h>
5 
6 int calls = 0;
7 int alt_calls = 0;
8 
9 SEC("cgroup_skb/egress1")
10 int egress(struct __sk_buff *skb)
11 {
12 	__sync_fetch_and_add(&calls, 1);
13 	return 1;
14 }
15 
16 SEC("cgroup_skb/egress2")
17 int egress_alt(struct __sk_buff *skb)
18 {
19 	__sync_fetch_and_add(&alt_calls, 1);
20 	return 1;
21 }
22 
23 char _license[] SEC("license") = "GPL";
24 
25