Move uidOwnerMap dump to BpfNetMaps

Before this CL
....
mUidOwnerMap:
10050  IIF_MATCH LOCKDOWN_VPN_MATCH 0
10061  HAPPY_BOX_MATCH
10091  HAPPY_BOX_MATCH IIF_MATCH LOCKDOWN_VPN_MATCH 0
....

After this CL
....
sUidOwnerMap:
  10050 IIF_MATCH LOCKDOWN_VPN_MATCH 0
  10061 HAPPY_BOX_MATCH
  10091 HAPPY_BOX_MATCH IIF_MATCH LOCKDOWN_VPN_MATCH 0
....

Bug: 217624062
Test: dumpsys connectivity trafficcontroller, atest BpfNetMapsTest
Change-Id: I0e2358e462824273a89fcba6e19e75a233f9fe18
This commit is contained in:
Motomu Utsumi
2022-09-02 17:01:25 +09:00
parent 310850f210
commit 956d86ccdf
4 changed files with 98 additions and 67 deletions

View File

@@ -697,26 +697,6 @@ void TrafficController::dump(int fd, bool verbose) {
dw.println("mConfigurationMap read stats map configure failed with error: %s",
configuration.error().message().c_str());
}
dumpBpfMap("mUidOwnerMap", dw, "");
const auto printUidMatchInfo = [&dw, this](const uint32_t& key, const UidOwnerValue& value,
const BpfMap<uint32_t, UidOwnerValue>&) {
if (value.rule & IIF_MATCH) {
auto ifname = mIfaceIndexNameMap.readValue(value.iif);
if (ifname.ok()) {
dw.println("%u %s %s", key, uidMatchTypeToString(value.rule).c_str(),
ifname.value().name);
} else {
dw.println("%u %s %u", key, uidMatchTypeToString(value.rule).c_str(), value.iif);
}
} else {
dw.println("%u %s", key, uidMatchTypeToString(value.rule).c_str());
}
return base::Result<void>();
};
res = mUidOwnerMap.iterateWithValue(printUidMatchInfo);
if (!res.ok()) {
dw.println("mUidOwnerMap print end with error: %s", res.error().message().c_str());
}
}
} // namespace net