On 8/28/25 6:00 PM, Kuniyuki Iwashima wrote:
+BPF_CALL_5(bpf_unlocked_sock_setsockopt, struct sock *, sk, int, level, + int, optname, char *, optval, int, optlen) +{ + return __bpf_setsockopt(sk, level, optname, optval, optlen); +} + +static const struct bpf_func_proto bpf_unlocked_sock_setsockopt_proto = {
nit. There is a bpf_unlocked_"sk"_{get,set}sockopt_proto which its .func is also taking "struct sock *". This one is sock_create specific, how about renaming it to bpf_sock_create_{get,set}sockopt_proto. The same for the its .func.
+ .func = bpf_unlocked_sock_setsockopt, + .gpl_only = false, + .ret_type = RET_INTEGER, + .arg1_type = ARG_PTR_TO_CTX, + .arg2_type = ARG_ANYTHING, + .arg3_type = ARG_ANYTHING, + .arg4_type = ARG_PTR_TO_MEM | MEM_RDONLY, + .arg5_type = ARG_CONST_SIZE, +}; + +BPF_CALL_5(bpf_unlocked_sock_getsockopt, struct sock *, sk, int, level, + int, optname, char *, optval, int, optlen) +{ + return __bpf_getsockopt(sk, level, optname, optval, optlen); +} + +static const struct bpf_func_proto bpf_unlocked_sock_getsockopt_proto = { + .func = bpf_unlocked_sock_getsockopt, + .gpl_only = false, + .ret_type = RET_INTEGER, + .arg1_type = ARG_PTR_TO_CTX, + .arg2_type = ARG_ANYTHING, + .arg3_type = ARG_ANYTHING, + .arg4_type = ARG_PTR_TO_UNINIT_MEM, + .arg5_type = ARG_CONST_SIZE, +};