Convert return error code in XfrmController to Status
Bug: 62056515
Test: runtest -x tests/netd_integration_test.cpp
Change-Id: I70022ba00f76776c3de05b7df33ce2be840d75ce
diff --git a/server/NetdNativeService.cpp b/server/NetdNativeService.cpp
index 771ebda..3a4fbb9 100644
--- a/server/NetdNativeService.cpp
+++ b/server/NetdNativeService.cpp
@@ -70,16 +70,6 @@
}
}
-binder::Status getXfrmStatus(int xfrmCode) {
- switch(xfrmCode) {
- case 0:
- return binder::Status::ok();
- case -ENOENT:
- return binder::Status::fromServiceSpecificError(xfrmCode);
- }
- return binder::Status::fromExceptionCode(xfrmCode);
-}
-
#define ENFORCE_DEBUGGABLE() { \
char value[PROPERTY_VALUE_MAX + 1]; \
if (property_get("ro.debuggable", value, NULL) != 1 \
@@ -380,7 +370,7 @@
// Necessary locking done in IpSecService and kernel
ENFORCE_PERMISSION(CONNECTIVITY_INTERNAL);
ALOGD("ipSecAllocateSpi()");
- return getXfrmStatus(gCtls->xfrmCtrl.ipSecAllocateSpi(
+ return asBinderStatus(gCtls->xfrmCtrl.ipSecAllocateSpi(
transformId,
direction,
localAddress,
@@ -405,7 +395,7 @@
// Necessary locking done in IpSecService and kernel
ENFORCE_PERMISSION(CONNECTIVITY_INTERNAL);
ALOGD("ipSecAddSecurityAssociation()");
- return getXfrmStatus(gCtls->xfrmCtrl.ipSecAddSecurityAssociation(
+ return asBinderStatus(gCtls->xfrmCtrl.ipSecAddSecurityAssociation(
transformId, mode, direction, localAddress, remoteAddress,
underlyingNetworkHandle,
spi,
@@ -423,7 +413,7 @@
// Necessary locking done in IpSecService and kernel
ENFORCE_PERMISSION(CONNECTIVITY_INTERNAL);
ALOGD("ipSecDeleteSecurityAssociation()");
- return getXfrmStatus(gCtls->xfrmCtrl.ipSecDeleteSecurityAssociation(
+ return asBinderStatus(gCtls->xfrmCtrl.ipSecDeleteSecurityAssociation(
transformId,
direction,
localAddress,
@@ -441,7 +431,7 @@
// Necessary locking done in IpSecService and kernel
ENFORCE_PERMISSION(CONNECTIVITY_INTERNAL);
ALOGD("ipSecApplyTransportModeTransform()");
- return getXfrmStatus(gCtls->xfrmCtrl.ipSecApplyTransportModeTransform(
+ return asBinderStatus(gCtls->xfrmCtrl.ipSecApplyTransportModeTransform(
socket,
transformId,
direction,
@@ -455,7 +445,7 @@
// Necessary locking done in IpSecService and kernel
ENFORCE_PERMISSION(CONNECTIVITY_INTERNAL);
ALOGD("ipSecRemoveTransportModeTransform()");
- return getXfrmStatus(gCtls->xfrmCtrl.ipSecRemoveTransportModeTransform(
+ return asBinderStatus(gCtls->xfrmCtrl.ipSecRemoveTransportModeTransform(
socket));
}