ClatUtils - implement getClatMapFd()
Test: atest netd_unit_test
Bug: 65674744
Signed-off-by: Maciej Żenczykowski <maze@google.com>
Change-Id: Ia5e80f7cd82f1bd40872f88e4edd4da491450cec
diff --git a/server/ClatUtilsTest.cpp b/server/ClatUtilsTest.cpp
index 79d3440..6bd7048 100644
--- a/server/ClatUtilsTest.cpp
+++ b/server/ClatUtilsTest.cpp
@@ -22,6 +22,9 @@
#include <linux/if_arp.h>
+#include "bpf/BpfUtils.h"
+#include "netdbpf/bpf_shared.h"
+
namespace android {
namespace net {
@@ -60,5 +63,12 @@
EXPECT_EQ(ARPHRD_RAWIP, type);
}
+TEST_F(ClatUtilsTest, GetClatMapFd) {
+ SKIP_IF_BPF_NOT_SUPPORTED;
+
+ base::unique_fd ufd(getClatMapFd());
+ EXPECT_LE(3, ufd); // 0,1,2 - stdin/out/err, thus 3 <= fd
+}
+
} // namespace net
} // namespace android