[DO NOT MERGE] Add Tunnel Interface Prefix in INetd

Declare the ipsec tunnel interface prefix
as a constant in the NETD AIDL. This allows
the constant to be, well, constant between
the Java and native sides of the binder. Since
it is shared information, this provides an
added level of safety.

Note, this is being done as a follow-up to a
CL which created this cross-process dependency
on the name.

Bug: 74560705
Test: atest netd_integration_test;
      atest FrameworksNetTest
Change-Id: Ibc66b014692a978ebfcc7856dcc26524618668a8
diff --git a/server/XfrmController.cpp b/server/XfrmController.cpp
index d9c41d4..d762878 100644
--- a/server/XfrmController.cpp
+++ b/server/XfrmController.cpp
@@ -43,11 +43,12 @@
 #include <linux/netlink.h>
 #include <linux/xfrm.h>
 
+#define LOG_TAG "XfrmController"
 #include "android-base/stringprintf.h"
 #include "android-base/strings.h"
 #include "android-base/unique_fd.h"
+#include <android/net/INetd.h>
 #include <log/log_properties.h>
-#define LOG_TAG "XfrmController"
 #include "InterfaceController.h"
 #include "NetdConstants.h"
 #include "NetlinkCommands.h"
@@ -60,6 +61,7 @@
 #include <cutils/properties.h>
 #include <logwrap/logwrap.h>
 
+using android::net::INetd;
 using android::netdutils::Fd;
 using android::netdutils::Slice;
 using android::netdutils::Status;
@@ -85,9 +87,6 @@
 
 constexpr uint32_t INVALID_SPI = 0;
 
-// Must match TUNNEL_INTERFACE_PREFIX in IpSecService.java
-constexpr char const* TUNNEL_INTERFACE_PREFIX = "ipsec";
-
 #define XFRM_MSG_TRANS(x)                                                                          \
     case x:                                                                                        \
         return #x;
@@ -386,11 +385,12 @@
 netdutils::Status XfrmController::flushInterfaces() {
     const auto& ifaces = InterfaceController::getIfaceNames();
     RETURN_IF_NOT_OK(ifaces);
+    const String8 ifPrefix8 = String8(INetd::IPSEC_INTERFACE_PREFIX().string());
 
     for (const std::string& iface : ifaces.value()) {
         int status = 0;
         // Look for the reserved interface prefix, which must be in the name at position 0
-        if (!iface.compare(0, strlen(TUNNEL_INTERFACE_PREFIX), TUNNEL_INTERFACE_PREFIX) &&
+        if (!iface.compare(0, ifPrefix8.length(), ifPrefix8.c_str()) &&
             (status = removeVirtualTunnelInterface(iface)) < 0) {
             ALOGE("Failed to delete ipsec tunnel %s.", iface.c_str());
             return netdutils::statusFromErrno(status, "Failed to remove ipsec tunnel.");