Really we need to fix the inheritance to make
BpfMapRO the parent class of BpfMap:
but that's a far more difficult thing to do,
so in the short term we punt like this.
This makes BpfMapRO a little bit more usable,
and allows a slow transition across the codebase...
Test: TreeHugger
Signed-off-by: Maciej Żenczykowski <maze@google.com>
Change-Id: I1c5112db70e9e523c113cba536fbe19422b4d3f3
(we don't yet do anything with it, but at least in strace we should
now see more detailed errors from the kernel)
Test: TreeHugger
Signed-off-by: Maciej Żenczykowski <maze@google.com>
Change-Id: I6a34a0e7e866bbde41daef23870ad90dceee6ded
this way is more obviously not calling dup_with_cloexec
Test: TreeHugger
Signed-off-by: Maciej Żenczykowski <maze@google.com>
Change-Id: I4e1ce3b0a42ccea638332ae451e291e025d57895
to replace less safe uses of BpfMap.reset(create(type, keysize, valuesize, entries, flags))
Meant to be used in tests only.
Bug:
Test: TreeHugger
Signed-off-by: Maciej Żenczykowski <maze@google.com>
Change-Id: I869f1f935bcf5d00702c42bc46d6094ea552addc
not perfect due to this being in a header file, so multiple copies
potentially exist, but it's really simple, and works nearly as well.
Test: TreeHugger
Signed-off-by: Maciej Żenczykowski <maze@google.com>
Change-Id: Id90c6933d57bc12f4dd640c8918fd0885c7474cf
We switch back to int from ParcelFileDescriptor,
and eliminate all calls to close(). Bpf Map FDs
now live till process exit.
Bug: 230880517
Test: TreeHugger, atest com.android.networkstack.tethering.BpfMapTest
Signed-off-by: Maciej Żenczykowski <maze@google.com>
Change-Id: I89b6dc88ea56cb1e50695f8daf54ed79bce3fba2
This will allow healthd to filter uevent packets, if needed
Bug: 203462310
Test: Ensure that healthd can build if it uses bpf filters
Change-Id: I97bfe9509a6934444f656508176495bba38381be
TCA_U32_ACT was missed when converting from the u32 filter to matchall.
Interestingly, cls_matchall does not seem to validate this type as the
kernel happily accepted this configuration (which absolutely should not
happen as TCA_U32_ACT is greater than __TCA_MATCHALL_MAX).
Bug: 218840346
Test: atest CtsNetTestCases:RateLimitTest
Change-Id: Ia24683cbd5fbd10084163db6e6a4415ec03f6f3f
The art apex already has access to bpf_headers which includes bpf_syscall_wrappers,
but this extra line is needed to switch it away from needlessly linking libbpf_android.
Since these are header files only, this annotation is kind of pointless,
but it does turn out to be needed...
Test: TreeHugger
Signed-off-by: Maciej Żenczykowski <maze@google.com>
Change-Id: I9e4d3373cea488080304e31ed7c8708aec988933
this doesn't appear to make sense now that it's available to vendors
Test: TreeHugger
Signed-off-by: Maciej Żenczykowski <maze@google.com>
Change-Id: If2d24fa8eccfb5c12832fb191a8560b024751db7
Attach bpf program to cgroup with flags, support 'BPF_F_ALLOW_OVERRIDE'
and 'BPF_F_ALLOW_MULTI'; corresponding to detach a single bpf program in
a cgroup.
Test: m
Signed-off-by: KaiWen Zheng <zhengkaiwen5@xiaomi.corp-partner.google.com>
Change-Id: I9a4d2dcb249c6c628e3f1287d7d5d1879b722bd6
This way, users of libnet_utils_device_common_bpfjni do not also have to
separately list the required libtcutils.
Test: build, boots
Change-Id: Id40863de83b6c40b79f38d638299626f7e025810
Added SPDX-license-identifier-Apache-2.0 to:
common/native/nettestutils/Android.bp
Bug: 68860345
Bug: 151177513
Bug: 151953481
Test: m all
Change-Id: If5fcd4735fe82f336227626a443bba1d74201722
Correct the indentation style of libclat in the follows
bpf_headers/Android.bp
bpf_syscall_wrappers/Android.bp
Test: build
Change-Id: I7cdd354141124fa8f7b4a864ddd937bef4676302
The bpf_headers no need to explicitly specify visibility for
system/netd/libnetdbpf. The libnetdbpf depends on
bpf_connectivity_headers, which exports bpf_headers already.
Bug: 202086915
Test: m
Change-Id: I09a073b14dc74511ba9dc09a89ae6e89dff51f4d
BPF_ANNOTATE_KV_PAIR is used by libbpf to associate each map with its
BTF information. This is ignored for programs compiled without BTF
information.
Bug: 203823368
Test: build & boot; confirm all bpf progs load successfully
Test: compile time_in_state.o with -g; confirm BTF is loaded
Signed-off-by: Connor O'Brien <connoro@google.com>
Change-Id: I45f294945d48106d39d1d105ac4f49311459a19d
* changes:
Move logging helper to own file
Add tc police support in TcUtils.java
Add tc police support to jni lib
Add functionality to attach tc-police action to ingress qdisc
Add tests for adding / deleting bpf filter
Add support to attach / replace / detach clsact qdisc to libtcutils
Add tests for libtcutils
Fix kernelversion.h
The library provides a helper function that can retrieve dumpsys
results from a specific service. It can also take dumpsys arguments.
Bug: 29761778
Bug: 202086915
Test: test in Ib4aeb385ab80187feb39b659274a0aee20a4a5ed
Change-Id: Ib2ab8b6e4136bd3cbc52b025e53a1fa0c4e91709