summaryrefslogtreecommitdiff
path: root/server/TetherController.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'server/TetherController.cpp')
-rw-r--r--server/TetherController.cpp22
1 files changed, 21 insertions, 1 deletions
diff --git a/server/TetherController.cpp b/server/TetherController.cpp
index 09eb1ecb..6f2ee099 100644
--- a/server/TetherController.cpp
+++ b/server/TetherController.cpp
@@ -221,6 +221,11 @@ void TetherController::maybeInitMaps() {
mBpfStatsMap.reset(fd);
mBpfStatsMap.clear();
}
+ fd = getTetherLimitMapFd();
+ if (fd >= 0) {
+ mBpfLimitMap.reset(fd);
+ mBpfLimitMap.clear();
+ }
}
const std::set<std::string>& TetherController::getIpfwdRequesterList() const {
@@ -1129,7 +1134,7 @@ std::string l2ToString(const uint8_t* addr, size_t len) {
} // namespace
void TetherController::dumpBpf(DumpWriter& dw) {
- if (!mBpfIngressMap.isValid() || !mBpfStatsMap.isValid()) {
+ if (!mBpfIngressMap.isValid() || !mBpfStatsMap.isValid() || !mBpfLimitMap.isValid()) {
dw.println("BPF not supported");
return;
}
@@ -1170,6 +1175,21 @@ void TetherController::dumpBpf(DumpWriter& dw) {
dw.println("Error printing BPF stats map: %s", ret.error().message().c_str());
}
dw.decIndent();
+
+ dw.println("BPF limit: iif -> bytes");
+ const auto printLimitMap = [&dw](const uint32_t& key, const uint64_t& value,
+ const BpfMap<uint32_t, uint64_t>&) {
+ dw.println("%u -> %" PRIu64, key, value);
+
+ return Result<void>();
+ };
+
+ dw.incIndent();
+ ret = mBpfLimitMap.iterateWithValue(printLimitMap);
+ if (!ret.ok()) {
+ dw.println("Error printing BPF limit map: %s", ret.error().message().c_str());
+ }
+ dw.decIndent();
}
void TetherController::dump(DumpWriter& dw) {