diff options
Diffstat (limited to 'server/TetherController.cpp')
| -rw-r--r-- | server/TetherController.cpp | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/server/TetherController.cpp b/server/TetherController.cpp index c987d634..b56480a9 100644 --- a/server/TetherController.cpp +++ b/server/TetherController.cpp @@ -42,6 +42,7 @@ #include <android-base/unique_fd.h> #include <cutils/properties.h> #include <log/log.h> +#include <netdutils/DumpWriter.h> #include <netdutils/StatusOr.h> #include "Controllers.h" @@ -59,6 +60,8 @@ using android::base::Join; using android::base::Pipe; using android::base::StringPrintf; using android::base::unique_fd; +using android::netdutils::DumpWriter; +using android::netdutils::ScopedIndent; using android::netdutils::statusFromErrno; using android::netdutils::StatusOr; @@ -919,5 +922,34 @@ StatusOr<TetherController::TetherStatsList> TetherController::getTetherStats() { return statsList; } +void TetherController::dumpIfaces(DumpWriter& dw) { + dw.println("Interface pairs:"); + + ScopedIndent ifaceIndent(dw); + for (const auto& it : mFwdIfaces) { + dw.println("%s -> %s %s", it.first.c_str(), it.second.iface.c_str(), + (it.second.active ? "ACTIVE" : "DISABLED")); + } +} + +void TetherController::dump(DumpWriter& dw) { + std::lock_guard guard(lock); + + ScopedIndent tetherControllerIndent(dw); + dw.println("TetherController"); + dw.incIndent(); + + dw.println("Forwarding requests: " + Join(mForwardingRequests, ' ')); + if (mDnsNetId != 0) { + dw.println(StringPrintf("DNS: netId %d servers [%s]", mDnsNetId, + Join(mDnsForwarders, ", ").c_str())); + } + if (mDaemonPid != 0) { + dw.println("dnsmasq PID: %d", mDaemonPid); + } + + dumpIfaces(dw); +} + } // namespace net } // namespace android |
