ClatdController - fix dump unique_fd double ownership
Should hopefully fix:
Abort message: 'failed to exchange ownership of file descriptor: fd ... is owned by unique_fd 0x..., was expected to be unowned'
Test: atest netd_unit_test
Bug: 65674744
Bug: 129654883
Signed-off-by: Maciej Żenczykowski <maze@google.com>
Change-Id: Ide661bb6521673d272654e969360ce3aa4bdff5d
diff --git a/server/ClatdController.cpp b/server/ClatdController.cpp
index 57f24f3..6f2f43b 100644
--- a/server/ClatdController.cpp
+++ b/server/ClatdController.cpp
@@ -312,15 +312,14 @@
}
}
- int fd = getClatIngressMapFd();
- if (fd < 0) return; // if unsupported just don't dump anything
- unique_fd mapFd(fd);
+ int mapFd = getClatIngressMapFd();
+ if (mapFd < 0) return; // if unsupported just don't dump anything
+ BpfMap<ClatIngressKey, ClatIngressValue> configMap(mapFd);
ScopedIndent bpfIndent(dw);
dw.println("BPF ingress map: iif(iface) nat64Prefix v6Addr -> v4Addr oif(iface)");
ScopedIndent bpfDetailIndent(dw);
- BpfMap<ClatIngressKey, ClatIngressValue> configMap(mapFd);
const auto printClatMap = [&dw](const ClatIngressKey& key, const ClatIngressValue& value,
const BpfMap<ClatIngressKey, ClatIngressValue>&) {
char iifStr[IFNAMSIZ] = "?";