ANDROID: GKI: add net vendor hooks for traffic statistics extension
Currently, Android traffic statistics are based on uid, but sometimes multiple apps share the same uid, and we hope to be able to calculate the traffic data of these apps separately. Bug: 341681580 Change-Id: If6c59ce5a98d90412fcbef822121a99d0b378b45 Signed-off-by: jujiang <jyu.jiang@vivo.corp-partner.google.com>
This commit is contained in:
committed by
Treehugger Robot
parent
1c3ae78599
commit
b3d08cab42
@@ -296,6 +296,7 @@ EXPORT_TRACEPOINT_SYMBOL_GPL(android_rvh_udpv6_recvmsg);
|
||||
EXPORT_TRACEPOINT_SYMBOL_GPL(android_rvh_tcp_select_window);
|
||||
EXPORT_TRACEPOINT_SYMBOL_GPL(android_rvh_inet_sock_create);
|
||||
EXPORT_TRACEPOINT_SYMBOL_GPL(android_rvh_inet_sock_release);
|
||||
EXPORT_TRACEPOINT_SYMBOL_GPL(android_rvh_bpf_skb_load_bytes);
|
||||
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_tcp_rtt_estimator);
|
||||
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_udp_enqueue_schedule_skb);
|
||||
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_build_skb_around);
|
||||
|
||||
@@ -119,6 +119,10 @@ DECLARE_RESTRICTED_HOOK(android_rvh_inet_sock_create,
|
||||
TP_PROTO(struct sock *sk), TP_ARGS(sk), 1);
|
||||
DECLARE_RESTRICTED_HOOK(android_rvh_inet_sock_release,
|
||||
TP_PROTO(struct sock *sk), TP_ARGS(sk), 1);
|
||||
DECLARE_RESTRICTED_HOOK(android_rvh_bpf_skb_load_bytes,
|
||||
TP_PROTO(const struct sk_buff *skb, u32 offset, void *to, u32 len,
|
||||
int *handled, int *err),
|
||||
TP_ARGS(skb, offset, to, len, handled, err), 1);
|
||||
DECLARE_HOOK(android_vh_tcp_rtt_estimator,
|
||||
TP_PROTO(struct sock *sk, long mrtt_us), TP_ARGS(sk, mrtt_us));
|
||||
DECLARE_HOOK(android_vh_udp_enqueue_schedule_skb,
|
||||
|
||||
@@ -91,6 +91,8 @@
|
||||
/* Keep the struct bpf_fib_lookup small so that it fits into a cacheline */
|
||||
static_assert(sizeof(struct bpf_fib_lookup) == 64, "struct bpf_fib_lookup size check");
|
||||
|
||||
#include <trace/hooks/net.h>
|
||||
|
||||
static const struct bpf_func_proto *
|
||||
bpf_sk_base_func_proto(enum bpf_func_id func_id, const struct bpf_prog *prog);
|
||||
|
||||
@@ -1758,6 +1760,12 @@ BPF_CALL_4(bpf_skb_load_bytes, const struct sk_buff *, skb, u32, offset,
|
||||
void *, to, u32, len)
|
||||
{
|
||||
void *ptr;
|
||||
int handled = 0;
|
||||
int err = 0;
|
||||
|
||||
trace_android_rvh_bpf_skb_load_bytes(skb, offset, to, len, &handled, &err);
|
||||
if (handled)
|
||||
return err;
|
||||
|
||||
if (unlikely(offset > INT_MAX))
|
||||
goto err_clear;
|
||||
|
||||
Reference in New Issue
Block a user