mirror of
https://github.com/hardkernel/linux.git
synced 2026-06-09 04:10:18 +09:00
BACKPORT: UPSTREAM: Add a eBPF helper function to retrieve socket uid
Cherry-pick from commit 6acc5c2910
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>
Bug: 30950746
Change-Id: Idc00947ccfdd4e9f2214ffc4178d701cd9ead0ac
This commit is contained in:
@@ -466,6 +466,14 @@ enum bpf_func_id {
|
||||
*/
|
||||
BPF_FUNC_get_socket_cookie,
|
||||
|
||||
/**
|
||||
* u32 bpf_get_socket_uid(skb)
|
||||
* Get the owner uid of the socket stored inside sk_buff.
|
||||
* @skb: pointer to skb
|
||||
* Return: uid of the socket owner on success or overflowuid if failed.
|
||||
*/
|
||||
BPF_FUNC_get_socket_uid,
|
||||
|
||||
__BPF_FUNC_MAX_ID,
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user