ClatUtils - implement getClatProgFd()

Test: atest netd_unit_test
Bug: 65674744
Signed-off-by: Maciej Żenczykowski <maze@google.com>
Change-Id: I74464c2ed27ac650e3ce6c23a9301b028a9da97c
diff --git a/server/ClatUtils.cpp b/server/ClatUtils.cpp
index 727e6d7..e972513 100644
--- a/server/ClatUtils.cpp
+++ b/server/ClatUtils.cpp
@@ -61,5 +61,11 @@
     return (fd == -1) ? -errno : fd;
 }
 
+int getClatProgFd(bool with_ethernet_header) {
+    const int fd =
+            bpf::bpfFdGet(with_ethernet_header ? CLAT_PROG_ETHER_PATH : CLAT_PROG_RAWIP_PATH, 0);
+    return (fd == -1) ? -errno : fd;
+}
+
 }  // namespace net
 }  // namespace android