Add uid and cookie bpf helper to cg_skb_func_proto
Subsystems (4)
PATCH v2 1/1 Add uid and cookie bpf helper to cg_skb_func_proto
From: Chenbo Feng <[email protected]>
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 8f917bba0042 ("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.
--- net/core/filter.c | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-)
net/core/filter.c +1 -6
@@ -2766,12 +2766,7 @@ xdp_func_proto(enum bpf_func_id func_id)static const struct bpf_func_proto *cg_skb_func_proto (enum bpf_func_id func_id) { -switch (func_id) { -case BPF_FUNC_skb_load_bytes: -return &bpf_skb_load_bytes_proto; -default : -return bpf_base_func_proto (func_id); - } +return sk_filter_func_proto (func_id); } static const struct bpf_func_proto *
Signature · 1 line
2.7.4
Quoted 10 lines · Chenbo Feng
From: Chenbo Feng <[email protected]>
BPF helper functions
get_socket_cookieandget_socket_uidcan be used for network traffic classifications, among others. Expose them also to programs of typeBPF_PROG_TYPE_CGROUP_SKB. As of commit8f917bba0042("bpf: pass sk to helper functions") the requiredskb->skfunction is available at both cgroup bpf ingress and egress hooks. With these two new helper,cg_skb_func_protois effectively the same assk_filter_func_proto.
Quoted 6 lines
Change since V1:
Instead of add the helper tocg_skb_func_proto, redirect thecg_skb_func_prototosk_filter_func_protosince all helper function insk_filter_func_protoare applicable tocg_skb_func_protonow.Signed-off-by Chenbo Feng <[email protected]>
Thanks!
Quoted 10 lines · Chenbo Feng
From: Chenbo Feng <[email protected]>
BPF helper functions
get_socket_cookieandget_socket_uidcan be used for network traffic classifications, among others. Expose them also to programs of typeBPF_PROG_TYPE_CGROUP_SKB. As of commit8f917bba0042("bpf: pass sk to helper functions") the requiredskb->skfunction is available at both cgroup bpf ingress and egress hooks. With these two new helper,cg_skb_func_protois effectively the same assk_filter_func_proto.
Quoted 6 lines
Change since V1:
Instead of add the helper tocg_skb_func_proto, redirect thecg_skb_func_prototosk_filter_func_protosince all helper function insk_filter_func_protoare applicable tocg_skb_func_protonow.Signed-off-by Chenbo Feng <[email protected]>
From: Chenbo Feng <[email protected]>
Date: Fri, 14 Apr 2017 18:25:26 -0700
Quoted 10 lines
From: Chenbo Feng <[email protected]>
BPF helper functions
get_socket_cookieandget_socket_uidcan be used for network traffic classifications, among others. Expose them also to programs of typeBPF_PROG_TYPE_CGROUP_SKB. As of commit8f917bba0042("bpf: pass sk to helper functions") the requiredskb->skfunction is available at both cgroup bpf ingress and egress hooks. With these two new helper,cg_skb_func_protois effectively the same assk_filter_func_proto.
Quoted 6 lines
Change since V1:
Instead of add the helper tocg_skb_func_proto, redirect thecg_skb_func_prototosk_filter_func_protosince all helper function insk_filter_func_protoare applicable tocg_skb_func_protonow.Signed-off-by Chenbo Feng <[email protected]>
Applied, thanks.