aboutsummaryrefslogtreecommitdiffstats
path: root/tools/include
diff options
context:
space:
mode:
authorChenbo Feng <fengc@google.com>2017-03-22 17:27:35 -0700
committerDavid S. Miller <davem@davemloft.net>2017-03-23 17:01:02 -0700
commit6acc5c2910689fc6ee181bf63085c5efff6a42bd (patch)
tree049fec629362ea0f3017381bc96f4e117ed3e903 /tools/include
parentAdd a helper function to get socket cookie in eBPF (diff)
downloadlinux-dev-6acc5c2910689fc6ee181bf63085c5efff6a42bd.tar.xz
linux-dev-6acc5c2910689fc6ee181bf63085c5efff6a42bd.zip
Add a eBPF helper function to retrieve socket uid
Returns the owner uid of the socket inside a sk_buff. This is useful to perform per-UID accounting of network traffic or per-UID packet filtering. The socket need to be a fullsock otherwise overflowuid is returned. Signed-off-by: Chenbo Feng <fengc@google.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'tools/include')
-rw-r--r--tools/include/uapi/linux/bpf.h3
1 files changed, 2 insertions, 1 deletions
diff --git a/tools/include/uapi/linux/bpf.h b/tools/include/uapi/linux/bpf.h
index a3851859e5f3..1ea08ce35567 100644
--- a/tools/include/uapi/linux/bpf.h
+++ b/tools/include/uapi/linux/bpf.h
@@ -507,7 +507,8 @@ union bpf_attr {
FN(skb_change_head), \
FN(xdp_adjust_head), \
FN(probe_read_str), \
- FN(get_socket_cookie),
+ FN(get_socket_cookie), \
+ FN(get_socket_uid),
/* integer value in 'imm' field of BPF_CALL instruction selects which helper
* function eBPF program intends to call