All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH net-next v5 0/3] net: core: Two Helper function about socket information
@ 2017-03-20 18:41 Chenbo Feng
  2017-03-20 18:41 ` [PATCH net-next v5 1/3] Add a helper function to get socket cookie in eBPF Chenbo Feng
                   ` (2 more replies)
  0 siblings, 3 replies; 7+ messages in thread
From: Chenbo Feng @ 2017-03-20 18:41 UTC (permalink / raw)
  To: netdev, Alexei Starovoitov, Daniel Borkmann
  Cc: Lorenzo Colitti, Willem de Bruijn, Chenbo Feng

From: Chenbo Feng <fengc@google.com>

Introduce two eBpf helper function to get the socket cookie and
socket uid for each packet. The helper function is useful when
the *sk field inside sk_buff is not empty. These helper functions
can be used on socket and uid based traffic monitoring programs.

Change since V4:
* Using current user namespace to get uid instead of using init_ns.
* Add compiling setup of example program in to Makefile.
* Change the name style of the example program binaries.

Change since V3:
* Fixed some typos and incorrect comments in sample program
* replaced raw insns with BPF_STX_XADD and add it to libbpf.h
* Use a temp dir as mount point instead and added a check for
  the user input string.
* Make the get uid helper function returns the user namespace uid
  instead of kuid.
* Return a overflowuid instead of 0 when no uid information is found.

Change since V2:
* Add a sample program to demostrate the usage of the helper function.
* Moved the helper function proto invoking place.
* Add function header into tools/include
* Apply sk_to_full_sk() before getting uid.

Change since V1:
* Removed the unnecessary declarations and export command
* resolved conflict with master branch.
* Examine if the socket is a full socket before getting the uid.


Chenbo Feng (3):
  Add a helper function to get socket cookie in eBPF
  Add a eBPF helper function to retrieve socket uid
  A Sample of using socket cookie and uid for traffic monitoring

 include/linux/sock_diag.h                    |   1 +
 include/uapi/linux/bpf.h                     |  16 +-
 net/core/filter.c                            |  39 +++++
 net/core/sock_diag.c                         |   2 +-
 samples/bpf/Makefile                         |   3 +
 samples/bpf/cookie_uid_helper_example.c      | 223 +++++++++++++++++++++++++++
 samples/bpf/libbpf.h                         |  10 ++
 samples/bpf/run_cookie_uid_helper_example.sh |  14 ++
 tools/include/uapi/linux/bpf.h               |   4 +-
 9 files changed, 309 insertions(+), 3 deletions(-)
 create mode 100644 samples/bpf/cookie_uid_helper_example.c
 create mode 100755 samples/bpf/run_cookie_uid_helper_example.sh

-- 
2.7.4

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

end of thread, other threads:[~2017-03-20 23:11 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-03-20 18:41 [PATCH net-next v5 0/3] net: core: Two Helper function about socket information Chenbo Feng
2017-03-20 18:41 ` [PATCH net-next v5 1/3] Add a helper function to get socket cookie in eBPF Chenbo Feng
2017-03-20 23:05   ` Daniel Borkmann
2017-03-20 18:41 ` [PATCH net-next v5 2/3] Add a eBPF helper function to retrieve socket uid Chenbo Feng
2017-03-20 23:11   ` Daniel Borkmann
2017-03-20 18:41 ` [PATCH net-next v5 3/3] A Sample of using socket cookie and uid for traffic monitoring Chenbo Feng
2017-03-20 23:07   ` Daniel Borkmann

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.