netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Chenbo Feng <chenbofeng.kernel@gmail.com>
To: netdev@vger.kernel.org, Alexei Starovoitov <ast@fb.com>,
	Daniel Borkmann <daniel@iogearbox.net>
Cc: Lorenzo Colitti <lorenzo@google.com>,
	Willem de Bruijn <willemb@google.com>,
	Chenbo Feng <fengc@google.com>
Subject: [PATCH net-next v3 0/3] net: core: Two Helper function about socket information
Date: Wed, 22 Feb 2017 20:42:09 -0800	[thread overview]
Message-ID: <1487824932-5105-1-git-send-email-chenbofeng.kernel@gmail.com> (raw)

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 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                            |  36 +++++
 net/core/sock_diag.c                         |   2 +-
 samples/bpf/cookie_uid_helper_example.c      | 225 +++++++++++++++++++++++++++
 samples/bpf/run_cookie_uid_helper_example.sh |  14 ++
 tools/include/uapi/linux/bpf.h               |   4 +-
 7 files changed, 295 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

             reply	other threads:[~2017-02-23  4:43 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-02-23  4:42 Chenbo Feng [this message]
2017-02-23  4:42 ` [PATCH net-next v3 1/3] Add a helper function to get socket cookie in eBPF Chenbo Feng
2017-02-23  4:42 ` [PATCH net-next v3 2/3] Add a eBPF helper function to retrieve socket uid Chenbo Feng
2017-02-23 17:03   ` Willem de Bruijn
2017-02-23  4:42 ` [PATCH net-next v3 3/3] A Sample of using socket cookie and uid for traffic monitoring Chenbo Feng
2017-02-23 17:00 ` [PATCH net-next v3 0/3] net: core: Two Helper function about socket information Willem de Bruijn
  -- strict thread matches above, loose matches on Subject: below --
2017-02-23  4:44 Chenbo Feng

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1487824932-5105-1-git-send-email-chenbofeng.kernel@gmail.com \
    --to=chenbofeng.kernel@gmail.com \
    --cc=ast@fb.com \
    --cc=daniel@iogearbox.net \
    --cc=fengc@google.com \
    --cc=lorenzo@google.com \
    --cc=netdev@vger.kernel.org \
    --cc=willemb@google.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).