diff options
author | Nathan Harold <nharold@google.com> | 2018-05-12 00:01:00 +0000 |
---|---|---|
committer | Android (Google) Code Review <android-gerrit@google.com> | 2018-05-12 00:01:00 +0000 |
commit | f8f683fea2855ffb2d13ea93cfad1dada399c072 (patch) | |
tree | 51e319fbef4b05d051c2ac1c01d4c6b89f0dadc5 | |
parent | 27bf1efefd96698077888ea6f40b5002b4075191 (diff) | |
parent | 2aade863cd191a7b04caff4daa0bcef43ccdd8e1 (diff) | |
download | netd-f8f683fea2855ffb2d13ea93cfad1dada399c072.tar.gz |
Merge changes from topic "fix-xfrm-vts-bindertest" into pi-dev
* changes:
Exempt Unsupported Devs from XfrmControllerInit
Fix Errno Sign For XfrmController
-rw-r--r-- | server/XfrmController.cpp | 6 | ||||
-rw-r--r-- | tests/binder_test.cpp | 10 |
2 files changed, 13 insertions, 3 deletions
diff --git a/server/XfrmController.cpp b/server/XfrmController.cpp index d762878e..8a891eb7 100644 --- a/server/XfrmController.cpp +++ b/server/XfrmController.cpp @@ -1346,7 +1346,8 @@ int XfrmController::addVirtualTunnelInterface(const std::string& deviceName, flags |= NLM_F_EXCL | NLM_F_CREATE; } - int ret = sendNetlinkRequest(action, flags, iov, ARRAY_SIZE(iov), nullptr); + // sendNetlinkRequest returns -errno + int ret = -1 * sendNetlinkRequest(action, flags, iov, ARRAY_SIZE(iov), nullptr); if (ret) { ALOGE("Error in %s virtual tunnel interface. Error Code: %d", isUpdate ? "updating" : "adding", ret); @@ -1383,7 +1384,8 @@ int XfrmController::removeVirtualTunnelInterface(const std::string& deviceName) uint16_t action = RTM_DELLINK; uint16_t flags = NLM_F_REQUEST | NLM_F_ACK; - int ret = sendNetlinkRequest(action, flags, iov, ARRAY_SIZE(iov), nullptr); + // sendNetlinkRequest returns -errno + int ret = -1 * sendNetlinkRequest(action, flags, iov, ARRAY_SIZE(iov), nullptr); if (ret) { ALOGE("Error in removing virtual tunnel interface %s. Error Code: %d", iflaIfNameStrValue, ret); diff --git a/tests/binder_test.cpp b/tests/binder_test.cpp index 50feba47..257a076d 100644 --- a/tests/binder_test.cpp +++ b/tests/binder_test.cpp @@ -293,6 +293,9 @@ TEST_F(BinderTest, TestVirtualTunnelInterface) { } } +// IPsec tests are not run in 32 bit mode; both 32-bit kernels and +// mismatched ABIs (64-bit kernel with 32-bit userspace) are unsupported. +#if INTPTR_MAX != INT32_MAX #define RETURN_FALSE_IF_NEQ(_expect_, _ret_) \ do { if ((_expect_) != (_ret_)) return false; } while(false) bool BinderTest::allocateIpSecResources(bool expectOk, int32_t *spi) { @@ -313,11 +316,15 @@ bool BinderTest::allocateIpSecResources(bool expectOk, int32_t *spi) { return (status.ok() == expectOk); } - TEST_F(BinderTest, TestXfrmControllerInit) { netdutils::Status status; status = XfrmController::Init(); SCOPED_TRACE(status); + + // Older devices or devices with mismatched Kernel/User ABI cannot support the IPsec + // feature. + if (status.code() == EOPNOTSUPP) return; + ASSERT_TRUE(status.ok()); int32_t spi = 0; @@ -345,6 +352,7 @@ TEST_F(BinderTest, TestXfrmControllerInit) { ASSERT_TRUE(status.ok()); } +#endif static int bandwidthDataSaverEnabled(const char *binary) { std::vector<std::string> lines = listIptablesRule(binary, "bw_data_saver"); |