Merge "Address leftover comments on aosp/2194515"
diff --git a/OWNERS b/OWNERS
index a29a33b..39ccf1f 100644
--- a/OWNERS
+++ b/OWNERS
@@ -1,3 +1,4 @@
+# Bug component: 31808
 set noparent
 file:platform/packages/modules/Connectivity:master:/OWNERS_core_networking
 
diff --git a/server/NetdNativeService.cpp b/server/NetdNativeService.cpp
index 466d8ba..c8aa12e 100644
--- a/server/NetdNativeService.cpp
+++ b/server/NetdNativeService.cpp
@@ -664,9 +664,8 @@
                                                           int32_t interfaceId) {
     // Necessary locking done in IpSecService and kernel
     ENFORCE_NETWORK_STACK_PERMISSIONS();
-    netdutils::Status result = gCtls->xfrmCtrl.ipSecAddTunnelInterface(
-            deviceName, localAddress, remoteAddress, iKey, oKey, interfaceId, false);
-    return binder::Status::ok();
+    return asBinderStatus(gCtls->xfrmCtrl.ipSecAddTunnelInterface(
+            deviceName, localAddress, remoteAddress, iKey, oKey, interfaceId, false));
 }
 
 binder::Status NetdNativeService::ipSecUpdateTunnelInterface(const std::string& deviceName,
@@ -676,16 +675,14 @@
                                                              int32_t interfaceId) {
     // Necessary locking done in IpSecService and kernel
     ENFORCE_NETWORK_STACK_PERMISSIONS();
-    netdutils::Status result = gCtls->xfrmCtrl.ipSecAddTunnelInterface(
-            deviceName, localAddress, remoteAddress, iKey, oKey, interfaceId, true);
-    return binder::Status::ok();
+    return asBinderStatus(gCtls->xfrmCtrl.ipSecAddTunnelInterface(
+            deviceName, localAddress, remoteAddress, iKey, oKey, interfaceId, true));
 }
 
 binder::Status NetdNativeService::ipSecRemoveTunnelInterface(const std::string& deviceName) {
     // Necessary locking done in IpSecService and kernel
     ENFORCE_NETWORK_STACK_PERMISSIONS();
-    netdutils::Status result = gCtls->xfrmCtrl.ipSecRemoveTunnelInterface(deviceName);
-    return binder::Status::ok();
+    return asBinderStatus(gCtls->xfrmCtrl.ipSecRemoveTunnelInterface(deviceName));
 }
 
 binder::Status NetdNativeService::setIPv6AddrGenMode(const std::string& ifName,
diff --git a/server/OWNERS b/server/OWNERS
deleted file mode 100644
index 03fedf7..0000000
--- a/server/OWNERS
+++ /dev/null
@@ -1,3 +0,0 @@
-# Bug component: 31808
-lorenzo@google.com
-maze@google.com
diff --git a/tests/binder_test.cpp b/tests/binder_test.cpp
index 2df42a6..0709204 100644
--- a/tests/binder_test.cpp
+++ b/tests/binder_test.cpp
@@ -50,6 +50,7 @@
 #include <android-base/scopeguard.h>
 #include <android-base/stringprintf.h>
 #include <android-base/strings.h>
+#include <android-base/test_utils.h>
 #include <android/multinetwork.h>
 #include <binder/IPCThreadState.h>
 #include <bpf/BpfMap.h>
@@ -3518,23 +3519,6 @@
 
 namespace {
 
-class ScopedUidChange {
-  public:
-    explicit ScopedUidChange(uid_t uid) : mInputUid(uid) {
-        mStoredUid = geteuid();
-        if (mInputUid == mStoredUid) return;
-        EXPECT_TRUE(seteuid(uid) == 0);
-    }
-    ~ScopedUidChange() {
-        if (mInputUid == mStoredUid) return;
-        EXPECT_TRUE(seteuid(mStoredUid) == 0);
-    }
-
-  private:
-    uid_t mInputUid;
-    uid_t mStoredUid;
-};
-
 void clearQueue(int tunFd) {
     char buf[4096];
     int ret;
@@ -5191,6 +5175,7 @@
 }
 
 TEST_F(MDnsBinderTest, EventListenerTest) {
+    SKIP_WITH_HWASAN;  // TODO(b/253513842): Re-enable.
     // Start the Binder thread pool.
     android::ProcessState::self()->startThreadPool();
 
diff --git a/tests/bpf_base_test.cpp b/tests/bpf_base_test.cpp
index 8a21506..f164b2f 100644
--- a/tests/bpf_base_test.cpp
+++ b/tests/bpf_base_test.cpp
@@ -77,8 +77,6 @@
 }
 
 TEST_F(BpfBasicTest, TestSocketFilterSetUp) {
-    SKIP_IF_EXTENDED_BPF_NOT_SUPPORTED;
-
     ASSERT_EQ(0, access(CGROUP_SOCKET_PROG_PATH, R_OK));
     ASSERT_EQ(0, access(UID_PERMISSION_MAP_PATH, R_OK));
 }
diff --git a/tests/test_utils.h b/tests/test_utils.h
index de6c221..2564255 100644
--- a/tests/test_utils.h
+++ b/tests/test_utils.h
@@ -21,6 +21,9 @@
 #include <string>
 #include <vector>
 
+#include <gtest/gtest.h>
+#include <unistd.h>
+
 int randomUid();
 
 std::vector<std::string> runCommand(const std::string& command);
@@ -37,3 +40,21 @@
 
 bool ipRouteExists(const char* ipVersion, const char* table,
                    const std::vector<std::string>& ipRouteSubstrings);
+
+// Require root (for seteuid).
+class ScopedUidChange {
+  public:
+    explicit ScopedUidChange(uid_t uid) : mInputUid(uid) {
+        mStoredUid = geteuid();
+        if (mInputUid == mStoredUid) return;
+        EXPECT_TRUE(seteuid(uid) == 0);
+    }
+    ~ScopedUidChange() {
+        if (mInputUid == mStoredUid) return;
+        EXPECT_TRUE(seteuid(mStoredUid) == 0);
+    }
+
+  private:
+    uid_t mInputUid;
+    uid_t mStoredUid;
+};