提交 9fd0f315 编写于 作者: C Chenbo Feng 提交者: David S. Miller

Add uid and cookie bpf helper to cg_skb_func_proto

BPF helper functions get_socket_cookie and get_socket_uid can be
used for network traffic classifications, among others. Expose
them also to programs of type BPF_PROG_TYPE_CGROUP_SKB. As of
commit 8f917bba ("bpf: pass sk to helper functions") the
required skb->sk function is available at both cgroup bpf ingress
and egress hooks. With these two new helper, cg_skb_func_proto is
effectively the same as sk_filter_func_proto.

Change since V1:
Instead of add the helper to cg_skb_func_proto, redirect the
cg_skb_func_proto to sk_filter_func_proto since all helper function
in sk_filter_func_proto are applicable to cg_skb_func_proto now.
Signed-off-by: NChenbo Feng <fengc@google.com>
Acked-by: NAlexei Starovoitov <ast@kernel.org>
Acked-by: NDaniel Borkmann <daniel@iogearbox.net>
Signed-off-by: NDavid S. Miller <davem@davemloft.net>
上级 f3c9d40e
...@@ -2766,12 +2766,7 @@ xdp_func_proto(enum bpf_func_id func_id) ...@@ -2766,12 +2766,7 @@ xdp_func_proto(enum bpf_func_id func_id)
static const struct bpf_func_proto * static const struct bpf_func_proto *
cg_skb_func_proto(enum bpf_func_id func_id) cg_skb_func_proto(enum bpf_func_id func_id)
{ {
switch (func_id) { return sk_filter_func_proto(func_id);
case BPF_FUNC_skb_load_bytes:
return &bpf_skb_load_bytes_proto;
default:
return bpf_base_func_proto(func_id);
}
} }
static const struct bpf_func_proto * static const struct bpf_func_proto *
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册