Android S requires devices to support eBPF.
Test: builds, atest, TreeHugger
Bug: 167500195
Signed-off-by: Maciej Żenczykowski <maze@google.com>
Change-Id: I62fb97f79103515f5a2fd531cfa36356d21a4a6f
Maciej Żenczykowskicommited 2021-01-12 02:08:55 +00:00
Long term we don't even want reset() to exist.
It's simply not useful since only the bpfloader can create maps,
and thus all we can do is construct from pre-existing pinned bpf
path - and we should never destroy/unpin/delete these.
Similarly the move constructor is probably spurious.
Basically the only real use for reset() is in tests,
and even there the overall utility is not clear.
Hence, in the mean time, make it harder to use incorrectly,
and harder to use in general.
To do that we get rid of reset() -> you must call reset(-1)
and we eliminate the ability to call reset(unique_fd)
which has unclear fd-leaking semantics.
Also remove a spot where it is called spuriously.
Test: build, atest
Bug: 129773125
Signed-off-by: Maciej Żenczykowski <maze@google.com>
Change-Id: Ia018224aca0005ab68809b350595485ccd3f1bd3
Maciej Żenczykowskicommited 2020-01-30 08:59:53 +00:00
Test: build, atest
mMapFd no longer shows up in this file
Bug: 129773125
Signed-off-by: Maciej Żenczykowski <maze@google.com>
Change-Id: Ie49f0027d0f04565426ed800b079800b364dd049
Maciej Żenczykowskicommited 2020-01-29 22:43:10 -08:00
Remove libnetdutils dependency because bpf is being used for things other
than networking these days, and we don't want to make libnetdutils
vendor-available in the future. libbase provides an alternative type now.
Bug: 140330870
Test: atest libbpf_android_test netd_integration_test netd_unit_test
libnetdbpf_test bpf_module_test
Change-Id: I72ae8cd7f58a49bfc7dcb914a332a4c4bad5dea5
Steven Morelandcommited 2020-01-21 10:47:33 -08:00
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
We don't have the appropriate selinux privs to create the maps anyway.
Test: builds (when combined with system/netd change)
'git grep getOrCreate' in system/{bpf,netd} comes up empty
atest netd_unit_test netd_integration_test libbpf_android_test
Bug: 65674744
Bug: 129654883
Signed-off-by: Maciej Żenczykowski <maze@google.com>
Change-Id: Idffbce5b28b723943c6495cfafdecddc7a0f4e67
Maciej Żenczykowskicommited 2019-04-01 16:54:08 -07: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
For older devices that doesn't have bpf support, skip the bpf native
tests so we don't get false alarms. Fixed some compiler warning and
added the clang-format check.
Test: ./libnetdbpf_test/libnetdbpf_test
Bug: 119526856
Change-Id: Icb73a8ee9b9dff9a0da28b96578e1245f1f3724f
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