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