No longer get app uid bandwidth stats for the clat daemon
Test: atest
Bug: 150738490
Signed-off-by: Maciej Żenczykowski <maze@google.com>
Change-Id: Ibe2de1b04e5ff342d87aa47236c635b47f7ea11b
Merged-In: Ibe2de1b04e5ff342d87aa47236c635b47f7ea11b
diff --git a/bpf_progs/netd.c b/bpf_progs/netd.c
index 8785efd..96191d6 100644
--- a/bpf_progs/netd.c
+++ b/bpf_progs/netd.c
@@ -223,6 +223,12 @@
static __always_inline inline int bpf_traffic_account(struct __sk_buff* skb, int direction) {
uint32_t sock_uid = bpf_get_socket_uid(skb);
+ // Always allow and never count clat traffic. Only the IPv4 traffic on the stacked
+ // interface is accounted for and subject to usage restrictions.
+ if (sock_uid == AID_CLAT) {
+ return BPF_PASS;
+ }
+
int match = bpf_owner_match(skb, sock_uid, direction);
if ((direction == BPF_EGRESS) && (match == BPF_DROP)) {
// If an outbound packet is going to be dropped, we do not count that