We can't specify which union member we want to initialize
or the compiler will be too smart and do a partial init,
but a = {} will still zero the entire struct.
Test: builds, atest
Signed-off-by: Maciej Żenczykowski <maze@google.com>
Change-Id: I0f9208be1be65cec35d848d37a0142d03e0919bf
Maciej Żenczykowskicommited 2020-01-15 07:08:21 +00:00
(due to switch to bpfloader from loading via netd)
Test: build, atest
Signed-off-by: Maciej Żenczykowski <maze@google.com>
Change-Id: Ic95cdfde26b8e7b905551a7fd2b465e0cf99bbce
Maciej Żenczykowskiauthored and Steven Morelandcommited 2020-01-14 09:10:32 -08:00
These are unused by virtue of the code continuing to build.
C++20 has https://en.cppreference.com/w/cpp/language/default_comparisons
but still requires explicit declaration of them with '=default' annotation.
Test: builds
Bug: 146787904
Signed-off-by: Maciej Żenczykowski <maze@google.com>
Change-Id: I751ad5592acc1ed4cf763d1ca82c301f2e233e56
Maciej Żenczykowskicommited 2020-01-06 13:57:05 +00:00
Now that we're developing Android R and we know upgrades
will only be supported from Android P & Q, we no longer
need to check for Android pre-P (ie. O) - so we can remove
that check.
We also take the opportunity to slightly refactor the code
to make it more readable.
Note: it's not appropriate to backport this into any 'normal'
Q branch, since it *will* break 4.9-O devices upgrading to Q
userspace without upgrading the kernel to at least 4.9-P.
Test: builds, atest
Bug: 139501958
Signed-off-by: Maciej Żenczykowski <maze@google.com>
Change-Id: Iacb3c2db489061b3f278d8e971e44dd1a5c4c1e6
Maciej Żenczykowskicommited 2019-10-23 07:31:24 +00:00
delete the loader code that is no longer used by any bpf programs.
Bug: 130206035
Test: build all the bpf related target.
Change-Id: I3ea4e40cb986b380f3b79a7685c3c09633e4d199
Add a helper function to set sufficient MEMLOCK rlimit
for bpf related unit tests.
Bug: 119279144
Bug: 129246448
Test: libbpf_android_test
Change-Id: I5390f4d3b21436abff69a661d1c6e6a6749542ed
Chenbo Fengauthored and Maciej Żenczykowskicommited 2019-04-10 05:54:00 +00:00
For devices with 4.14 kernel shipping with bpf feature, they support more
functionality compared to 4.9 kernels. So when checking if the device
supports a given bpf feature, return a bpf level dependent on the detailed
kernel version instead of a simple boolean. This information would be
useful when we support new features such as map_in_map and cgroup socket
filters.
Bug: 111441138
Test: libnetdbpf_test, netd_integration_test
Change-Id: Ib51a56a35643ad76b58987ba1938c69905d28141
Use two maps to record the details of network stats and swap and clean
up after system server pulls the stats. The kernel program checks the
bpf map currently enabled before updating the stats and updates on the
corresponding map. Remove the TAG_STATS_MAP since we don't need to worry
about uid stats overflow problem. All the stats can be stored in the
same map until system server scrapes the stats and clean it up.
Bug: 79171384
Test: dumpsys netd trafficcontroller
CtsUsageStatsTestCases
Change-Id: Ic79e382f51bf21eee78c4cac5a8a97edaf3654cd
Change the netd bpf program to the new format. Adding map definition and
necessary helper functions to the kernel program code. Move the netd bpf
programs out of bpfloader to a new directory.
Test: dumpsys netd trafficcontroller
Bug: 112334572
Change-Id: I9287285d188e966193532b1522b5d3e67e32e930
Chenbo Fengauthored and Joel Fernandescommited 2019-01-07 20:17:42 -05:00
Apply the git clang format on the bpf project to make sure the existing
code compliance with the standard.
Test: project compiles and bpfMapTest pass.
Bug: 112334572
Change-Id: I4774aa2a197be2c671f6fb307c1fc9b71edfeeec
Rename the bpf support library in android to libbpf_android to make
it compatible with external bcc project. Fix the Android.bp file to
prevent build break.
Bug: 112334572
Test: No build breakage.
Change-Id: I24ae8aaf8ca8afdded5e46d21f0deec68d6030da