Commit Graph

8 Commits

Author SHA1 Message Date
Ken Chen
f7d23e1a60 [Refactor] Make uid owner match comparison logic into a function
As an inline function, the logic can be reused by others.

Bug: Bug: 288340533
Test: build; presubmit
Change-Id: I8e57829e304e829eed72cc165b051cd22088260d
2023-09-17 00:11:48 +08:00
Maciej Żenczykowski
b9cf34715c netd.c - nettrace - add 'wakeup' boolean
This is based on network driver populated skb->mark magic bit.
This is the bit used by netd's WakeupController.

We mandated the location of this bit in U, though we haven't
(yet??) mandated it being supported by all network drivers.

If the driver doesn't support it, it could always
be false (skb->mark should default to 0),
or potentially (this is very very unlikely) be garbage.

IFIRC nettrace isn't enabled on pre-U devices anyway.

Test: TreeHugger
Signed-off-by: Maciej Żenczykowski <maze@google.com>
Change-Id: I2b3b91315d77c08c022396253b26954593dd3f5a
2023-09-13 22:05:30 +00:00
Maciej Żenczykowski
6109d94ec5 netd bpf - implement ingress discard based on {dstip,ifindex}
Test: TreeHugger
Bug: 295800201
Signed-off-by: Maciej Żenczykowski <maze@google.com>
Change-Id: I82771644045e0e37f73725730bd0bd2265ac5b77
2023-08-29 19:35:12 +00:00
Maciej Żenczykowski
a693bac180 StatsValue - define operator+=
while this is a little bit more code,
it seems much better for the accumulation operation
to be next to the struct definition itself
(in case we ever add more fields)

Test: TreeHugger
Signed-off-by: Maciej Żenczykowski <maze@google.com>
Change-Id: I26022db4566e69c964298d7b3f2cc4fa4a9a5152
2023-08-13 09:16:23 +00:00
Maciej Żenczykowski
4bcac5dadf eliminate 'struct Stats' in favour of StatsValue
Bug: 294604315
Test: TreeHugger
Signed-off-by: Maciej Żenczykowski <maze@google.com>
Change-Id: Ib45a130e7fa36ad90334c00de637d523455e000e
2023-08-12 16:24:49 +00:00
Maciej Żenczykowski
15b63b308e eliminate unused tcp{Rx,Tx}Packets
(next step is to replace use of Stats struct with
 identical (except field order) StatsValue struct)

Test: TreeHugger
Bug: 294604315
Signed-off-by: Maciej Żenczykowski <maze@google.com>
Change-Id: I9be3c411f9592bf4edc75386b1c5b386ebeb5905
2023-08-12 08:20:39 +00:00
Ryan Zuklie
9419d25fe2 Add packet tracing bpf implementation
This adds the core BPF implementation of Android network packet tracing.
The new code looks into the skb to pull out various bits of information.
Both the program and the ring buffer are restricted to 5.8+ kernels and
userdebug or eng builds.

With the packet_info_config map defaulting to zero, userdebug and eng
builds won't run any of the tracing today. The only effect will be 32k
memory increase for the ringbuf and the check on the config array.

Bug: 246985031
Test: build & flash both userdebug and user
Change-Id: I144da2971c0738b565ad58abc17e456209f13bde
2023-01-23 09:51:31 -08:00
Maciej Żenczykowski
513474c1a7 rename bpf_shared.h to netd.h
Test: TreeHugger
Signed-off-by: Maciej Żenczykowski <maze@google.com>
Change-Id: I2e1569c8d70e98f9a3fdbab41fd2ba7f7b84dd37
2022-12-18 20:02:52 +00:00