All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH net-next v2] Add uid and cookie bpf helper to cg_skb_func_proto
@ 2017-04-15  1:25 Chenbo Feng
  2017-04-15  1:41 ` Alexei Starovoitov
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Chenbo Feng @ 2017-04-15  1:25 UTC (permalink / raw)
  To: netdev; +Cc: Lorenzo Colitti, Willem de Bruijn, Chenbo Feng

From: Chenbo Feng <fengc@google.com>

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.

Signed-off-by: Chenbo Feng <fengc@google.com>
---
 net/core/filter.c | 7 +------
 1 file changed, 1 insertion(+), 6 deletions(-)

diff --git a/net/core/filter.c b/net/core/filter.c
index ce2a19d..19be954 100644
--- a/net/core/filter.c
+++ b/net/core/filter.c
@@ -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 *
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH net-next v2] Add uid and cookie bpf helper to cg_skb_func_proto
  2017-04-15  1:25 [PATCH net-next v2] Add uid and cookie bpf helper to cg_skb_func_proto Chenbo Feng
@ 2017-04-15  1:41 ` Alexei Starovoitov
  2017-04-15 11:30 ` Daniel Borkmann
  2017-04-17 19:22 ` David Miller
  2 siblings, 0 replies; 4+ messages in thread
From: Alexei Starovoitov @ 2017-04-15  1:41 UTC (permalink / raw)
  To: Chenbo Feng; +Cc: netdev, Lorenzo Colitti, Willem de Bruijn, Chenbo Feng

On Fri, Apr 14, 2017 at 06:25:26PM -0700, Chenbo Feng wrote:
> From: Chenbo Feng <fengc@google.com>
> 
> 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.
> 
> Signed-off-by: Chenbo Feng <fengc@google.com>

Thanks!
Acked-by: Alexei Starovoitov <ast@kernel.org>

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH net-next v2] Add uid and cookie bpf helper to cg_skb_func_proto
  2017-04-15  1:25 [PATCH net-next v2] Add uid and cookie bpf helper to cg_skb_func_proto Chenbo Feng
  2017-04-15  1:41 ` Alexei Starovoitov
@ 2017-04-15 11:30 ` Daniel Borkmann
  2017-04-17 19:22 ` David Miller
  2 siblings, 0 replies; 4+ messages in thread
From: Daniel Borkmann @ 2017-04-15 11:30 UTC (permalink / raw)
  To: Chenbo Feng, netdev; +Cc: Lorenzo Colitti, Willem de Bruijn, Chenbo Feng

On 04/15/2017 03:25 AM, Chenbo Feng wrote:
> From: Chenbo Feng <fengc@google.com>
>
> 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.
>
> Signed-off-by: Chenbo Feng <fengc@google.com>

Acked-by: Daniel Borkmann <daniel@iogearbox.net>

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH net-next v2] Add uid and cookie bpf helper to cg_skb_func_proto
  2017-04-15  1:25 [PATCH net-next v2] Add uid and cookie bpf helper to cg_skb_func_proto Chenbo Feng
  2017-04-15  1:41 ` Alexei Starovoitov
  2017-04-15 11:30 ` Daniel Borkmann
@ 2017-04-17 19:22 ` David Miller
  2 siblings, 0 replies; 4+ messages in thread
From: David Miller @ 2017-04-17 19:22 UTC (permalink / raw)
  To: chenbofeng.kernel; +Cc: netdev, lorenzo, willemb, fengc

From: Chenbo Feng <chenbofeng.kernel@gmail.com>
Date: Fri, 14 Apr 2017 18:25:26 -0700

> From: Chenbo Feng <fengc@google.com>
> 
> 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.
> 
> Signed-off-by: Chenbo Feng <fengc@google.com>

Applied, thanks.

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2017-04-17 19:22 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-04-15  1:25 [PATCH net-next v2] Add uid and cookie bpf helper to cg_skb_func_proto Chenbo Feng
2017-04-15  1:41 ` Alexei Starovoitov
2017-04-15 11:30 ` Daniel Borkmann
2017-04-17 19:22 ` David Miller

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.