1 // SPDX-License-Identifier: GPL-2.0
2 /* Copyright (c) 2025 Meta Platforms, Inc. and affiliates. */
3 #include <vmlinux.h>
4 #include <bpf/bpf_helpers.h>
5 
6 char _license[] SEC("license") = "GPL";
7 
8 unsigned int idx;
9 __u8 result[4];
10 
11 SEC("cgroup/getsockopt")
child(struct bpf_sockopt * ctx)12 int child(struct bpf_sockopt *ctx)
13 {
14 	if (idx < 4)
15 		result[idx++] = 1;
16 	return 1;
17 }
18 
19 SEC("cgroup/getsockopt")
child_2(struct bpf_sockopt * ctx)20 int child_2(struct bpf_sockopt *ctx)
21 {
22 	if (idx < 4)
23 		result[idx++] = 2;
24 	return 1;
25 }
26 
27 SEC("cgroup/getsockopt")
parent(struct bpf_sockopt * ctx)28 int parent(struct bpf_sockopt *ctx)
29 {
30 	if (idx < 4)
31 		result[idx++] = 3;
32 	return 1;
33 }
34 
35 SEC("cgroup/getsockopt")
parent_2(struct bpf_sockopt * ctx)36 int parent_2(struct bpf_sockopt *ctx)
37 {
38 	if (idx < 4)
39 		result[idx++] = 4;
40 	return 1;
41 }
42