improves coverage...
(see also cs/ p:android$ combineUidTag showing this 1 hit)
Test: TreeHugger
Signed-off-by: Maciej Żenczykowski <maze@google.com>
Change-Id: I85524032b045bdad78876239c968a3008217ed67
The network trace handler only produces, never consumes Perfetto events.
By cutting out the consumer code, we can reduce the binary size by
~280KB.
Bug: 246985031
Test: build and flash
Change-Id: Ie03129630cc425e1759770ef3f3d3391e78331d7
This runs the Perfetto and NetworkTraceHandler initialization on system
initialization along with the existing NetworkStatsService. The code is
run within the context of the system_server and is only executed on U or
later devices running eng or userdebug builds.
Bug: 246985031
Test: build & flash
Change-Id: I2b091e31c3ded54c0d7062d7d73f33ed47e0bf98
This adds the DataSource base class, data source registration and
overrides the lifecycle methods.
Adding the Perfetto SDK increases the size of the tethering apex by
450kb (~150 KB for the compressed apex).
Bug: 246985031
Test: atest libnetworkstats_test
Change-Id: Ie2e8f3e43c8080434408f752346e575a19e9042e
This adds the base (non-perfetto) NetworkTraceHandler with support for
starting and stopping tracing, and pulling messages from BPF. The
included test covers the end-to-end scenario from socket creation,
socket tagging and data traffic.
Bug: 246985031
Test: atest --iterations 500 libnetworkstats_test
Change-Id: I035d2e03fa7c461ecb93d207b7fd2f53e6a2f52e
See:
https://source.corp.google.com/search?q=p:android$%20OVERFLOW_COUNTERSET
(I'm guessing any remaining uses are in Java not C/C++?)
I'd like to remove the definition from the
frameworks/libs/net/common/native/bpf_headers/include/bpf/BpfUtils.h
header file, where it really doesn't fit.
Test: TreeHugger
Signed-off-by: Maciej Żenczykowski <maze@google.com>
Change-Id: I687f4ca0f52c362b29be7fe612f90d8aed2afe9e
This might eliminate a failure mode with dreaded 524 error
from the kernel... or it might not, but it shouldn't hurt.
Bug: 230418056
Test: TreeHugger
Signed-off-by: Maciej Żenczykowski <maze@google.com>
Change-Id: If2479daf77f61c220214ff507582295bd303fd21
frameworks/libs/net/common/native/bpf_headers/include/bpf/BpfMap.h
(which is a mainline automerged path)
already aborts() on failure in the path taking constructor
(by calling abortOnKeyOrValueSizeMismatch), and as such
checking for isValid afterwards is pointless.
Also, there's no reason to waste cpu cycles opening and closing these maps, and creating and destroying the map objects.
Test: TreeHugger
Signed-off-by: Maciej Żenczykowski <maze@google.com>
Change-Id: Icb5567ee32ca9a00fd8aeb565066716d350f1292
We note that:
0 <= BpfMap<K,V>.getMap()
is equivalent to
BpfMap<K,V>.isValid()
but the latter is far more kosher.
Unfortunately there is more non-kosher stuff happening in this
file, so we still need to define BPF_MAP_MAKE_VISIBLE_FOR_TESTING anyway.
Test: TreeHugger
Signed-off-by: Maciej Żenczykowski <maze@google.com>
Change-Id: I138709c6a298a2d8511b525a8349e01ab87d9455
In the BPF code, per-UID network access (e.g., for doze mode,
standby, etc.) is stored in UidOwnerValue structures. Each of
these stores that UID's rules in a 32-bit bitmask of
UidOwnerMatchType values, so the code can support ~31 match
types.
However, which match types are enabled is stored in
configuration_map at index UID_RULES_CONFIGURATION_KEY, and
configuration_map only stores 8-bit values. So it's not
possible to define more than 7 match types.
Widen configuration_map to from 8 to 32 bits to match the width
of UidOwnerValue.rule. This doesn't impact memory because
configuration_map only has 2 entries.
Bug: 208371987
Test: TreeHugger
Signed-off-by: Maciej Żenczykowski <maze@google.com>
Change-Id: I7e1eee2daedd66d27965a2dd4ce6b4c3667892f7
In order to get counted by mts code coverage, these native tests need to
be run as part of mts.
Bug: 233904825
Test: m mts && mts-tradefed run mts-tethering-coverage
Change-Id: I79313197b146c7043ffb5e164faa46c2e16dd1d2
Configuration map index 1(CURRENT_STATS_MAP_CONFIGURATION_KEY) can only
have value 0(SELECT_MAP_A) or 1(SELECT_MAP_B). Return error if it is any
other values. Otherwise, read out of array boundary can cause memory
corruption or security issues.
Bug: 231420457
Test: TH
Change-Id: Ia800ad78781f72b8118469c0230cc550796d334e
Add new symbols to libservice-connectivity loaded on T only, and the
framework libraries to apex and tests.
Bug: 197717846
Test: atest FrameworksNetTests
(cherry-picked and splitting apex Android.bp to aosp/1994130)
Change-Id: Iae44344701a3267110e5cbf271120201134d59e5
Merged-In: Iae44344701a3267110e5cbf271120201134d59e5
If libraries are moved from the platform to a module, the test
will fail with:
CANNOT LINK EXECUTABLE "/data/local/tmp/libnetworkstats_test/arm64/libnetworkstats_test": library "libnetworkstats.so" not found: needed by main executable
This may be because it can't find libnetworkstats.so because that
is in platform.
In any case, since this is the test for libnetworkstats,
dynamically linking libnetworkstats is incorrect, because it
means if the same CL modifies both libnetworkstats and its test,
that CL will run the modified test against the unmodified
libnetworkstats.so on the device, when running updating tests
without reflashing the device.
Also remove libutils because it does not seem to be needed.
Test: atest libnetworkstats_test passes with libraries moved
Change-Id: Id49641c0a919129e2c54531c3995ec7421161002
Two reason for renaming:
1. Avoid module name collision in sc-mainline-prod branch.
2. The libnetdbpf was misnamed before.
Bug: 202086915
Test: atest libnetworkstats_test FrameworksNetTests
ConnectivityCoverageTests FrameworksNetSmokeTests
CtsAppOpsTestCases
Change-Id: I87fcf4b1a9d58780a45743a9aa91b9b936e54266
This is a clean copy (that can't build). Modifications will be in
followed commits.
Bug: 202086915
Test: $ diff -r
packages/modules/Connectivity/service-t/native/libs/libnetdbpf/
system/netd/libnetdbpf/
(no different)
No-Typo-Check: Clean move
Change-Id: I23aad26d487b4d99e24ffecf79eeef3f8eea664b