summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--server/XfrmController.cpp2
-rw-r--r--tests/binder_test.cpp1
2 files changed, 2 insertions, 1 deletions
diff --git a/server/XfrmController.cpp b/server/XfrmController.cpp
index adc02b78..d9c41d4f 100644
--- a/server/XfrmController.cpp
+++ b/server/XfrmController.cpp
@@ -390,7 +390,7 @@ netdutils::Status XfrmController::flushInterfaces() {
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.find(TUNNEL_INTERFACE_PREFIX) == 0 &&
+ if (!iface.compare(0, strlen(TUNNEL_INTERFACE_PREFIX), TUNNEL_INTERFACE_PREFIX) &&
(status = removeVirtualTunnelInterface(iface)) < 0) {
ALOGE("Failed to delete ipsec tunnel %s.", iface.c_str());
return netdutils::statusFromErrno(status, "Failed to remove ipsec tunnel.");
diff --git a/tests/binder_test.cpp b/tests/binder_test.cpp
index 0913aa5f..4cbfdf24 100644
--- a/tests/binder_test.cpp
+++ b/tests/binder_test.cpp
@@ -317,6 +317,7 @@ TEST_F(BinderTest, TestXfrmControllerInit) {
ASSERT_TRUE(allocateIpSecResources(false, &spi));
status = XfrmController::Init();
+ ASSERT_TRUE(status.ok());
ASSERT_TRUE(allocateIpSecResources(true, &spi));
// Clean up