Skip to content

Commit 3e873be

Browse files
Geliang Tangintel-lab-lkp
authored andcommitted
Squash to "bpf: Export mptcp packet scheduler helpers"
Define .filter as Martin suggested. Signed-off-by: Geliang Tang <[email protected]>
1 parent b950918 commit 3e873be

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

net/mptcp/bpf.c

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -317,9 +317,22 @@ BTF_ID_FLAGS(func, bpf_mptcp_subflow_queues_empty)
317317
BTF_ID_FLAGS(func, mptcp_pm_subflow_chk_stale, KF_SLEEPABLE)
318318
BTF_KFUNCS_END(bpf_mptcp_common_kfunc_ids)
319319

320+
static int bpf_mptcp_common_kfunc_filter(const struct bpf_prog *prog, u32 kfunc_id)
321+
{
322+
if (!btf_id_set8_contains(&bpf_mptcp_common_kfunc_ids, kfunc_id))
323+
return 0;
324+
325+
if (prog->aux->st_ops &&
326+
prog->aux->st_ops != &bpf_mptcp_sched_ops)
327+
return -EACCES;
328+
329+
return 0;
330+
}
331+
320332
static const struct btf_kfunc_id_set bpf_mptcp_common_kfunc_set = {
321333
.owner = THIS_MODULE,
322334
.set = &bpf_mptcp_common_kfunc_ids,
335+
.filter = bpf_mptcp_common_kfunc_filter,
323336
};
324337

325338
static int __init bpf_mptcp_kfunc_init(void)

0 commit comments

Comments
 (0)