Add dump function for trafficController
Add a dumpsys helper function in trafficController to dump out the
information of the trafficController that is running on device. If
trafficController is running bpf programs, dump out all the program
location status and all the map content to dumpsys.
Test: dumpsys netd should trafficController information.
bug: 74411823
Change-Id: Ica83c11b6d1debb59f9c3a703d5b5cfc264844c4
diff --git a/server/TrafficController.h b/server/TrafficController.h
index bc16d39..2d58dd9 100644
--- a/server/TrafficController.h
+++ b/server/TrafficController.h
@@ -51,6 +51,8 @@
namespace android {
namespace net {
+class DumpWriter;
+
class TrafficController {
public:
TrafficController();
@@ -113,9 +115,13 @@
int updateOwnerMapEntry(const base::unique_fd& map_fd, uid_t uid, FirewallRule rule,
FirewallType type);
+ void dump(DumpWriter& dw, bool verbose);
+
int replaceUidsInMap(const base::unique_fd& map_fd, const std::vector<int32_t> &uids,
FirewallRule rule, FirewallType type);
+ static const String16 DUMP_KEYWORD;
+
int toggleUidOwnerMap(ChildChain chain, bool enable);
private: