【发布时间】:2019-09-05 08:23:28
【问题描述】:
如果我在tools/testing/selftests/bpf/bpf_helpers.h bpf 中理解“很好”,则定义了帮助原型。
如果我现在想知道哪些助手可用于特定程序类型,我需要在 'func_proto(enum bpf_func_id func_id' kernel/ net/ drivers/ 的结果中进行搜索
例如要检查套接字过滤程序可以调用的助手,我可以阅读以下定义
static const struct bpf_func_proto *
sock_filter_func_proto(enum bpf_func_id func_id, const struct bpf_prog *prog)
{
switch (func_id) {
/* inet and inet6 sockets are created in a process
* context so there is always a valid uid/gid
*/
case BPF_FUNC_get_current_uid_gid:
return &bpf_get_current_uid_gid_proto;
case BPF_FUNC_get_local_storage:
return &bpf_get_local_storage_proto;
default:
return bpf_base_func_proto(func_id);
}
}
问题:
1)我看不到load_half,但我仍然可以从我的套接字过滤程序中调用它。为什么? 2)socket_filter和sk_filter有什么区别?
【问题讨论】: