Get bpf level when check bpf support
Instead of return boolean, bpf support check now returns a integer
represent the current bpf level on device. This level is used to decide
if the device support some advanced bpf feature such as map_in_map and
bpf cgroup socket filter. Delete the binder call for bpf status check
since no one is using it.
Bug: 111441138
Test: libnetdbpf_test, netd_integration_test
Change-Id: Ib70c07647ffe491d493b4582b4b4b0eba7caf3a9
diff --git a/server/TrafficController.h b/server/TrafficController.h
index 35bea4a..1576882 100644
--- a/server/TrafficController.h
+++ b/server/TrafficController.h
@@ -86,7 +86,7 @@
* Check if the current device have the bpf traffic stats accounting service
* running.
*/
- bool checkBpfStatsEnable();
+ bpf::BpfLevel getBpfLevel();
/*
* Add the interface name and index pair into the eBPF map.
@@ -204,7 +204,7 @@
netdutils::Status addMatch(BpfMap<uint32_t, uint8_t>& map, uint32_t uid,
UidOwnerMatchType match) REQUIRES(mOwnerMatchMutex);
- bool ebpfSupported;
+ bpf::BpfLevel mBpfLevel;
std::mutex mOwnerMatchMutex;