From bdd5ab8874368c559048a8b51d59aa03e4095851 Mon Sep 17 00:00:00 2001 From: ludi Date: Sat, 20 May 2017 14:15:09 -0700 Subject: [PATCH] Remove return value of ipSecAddSecurityAssociation Bug:38350493 Test: runtest frameworks-net Change-Id: I48f8462d94e8c4e95d6766c1ce7f24b8a596b743 --- .../java/com/android/server/IpSecService.java | 55 +++++++++---------- 1 file changed, 25 insertions(+), 30 deletions(-) diff --git a/services/core/java/com/android/server/IpSecService.java b/services/core/java/com/android/server/IpSecService.java index ec275cc6f7..5350f42267 100644 --- a/services/core/java/com/android/server/IpSecService.java +++ b/services/core/java/com/android/server/IpSecService.java @@ -605,38 +605,33 @@ public class IpSecService extends IIpSecService.Stub { spis[direction] = mSpiRecords.get(c.getSpiResourceId(direction)); int spi = spis[direction].getSpi(); try { - int result = - getNetdInstance() - .ipSecAddSecurityAssociation( - resourceId, - c.getMode(), - direction, - (c.getLocalAddress() != null) - ? c.getLocalAddress().getHostAddress() - : "", - (c.getRemoteAddress() != null) - ? c.getRemoteAddress().getHostAddress() - : "", - (c.getNetwork() != null) - ? c.getNetwork().getNetworkHandle() - : 0, - spi, - (auth != null) ? auth.getName() : "", - (auth != null) ? auth.getKey() : null, - (auth != null) ? auth.getTruncationLengthBits() : 0, - (crypt != null) ? crypt.getName() : "", - (crypt != null) ? crypt.getKey() : null, - (crypt != null) ? crypt.getTruncationLengthBits() : 0, - encapType, - encapLocalPort, - encapRemotePort); - if (result != spi) { - // TODO: cleanup the first SA if creation of second SA fails - return new IpSecTransformResponse( - IpSecManager.Status.SPI_UNAVAILABLE, INVALID_RESOURCE_ID); - } + getNetdInstance() + .ipSecAddSecurityAssociation( + resourceId, + c.getMode(), + direction, + (c.getLocalAddress() != null) + ? c.getLocalAddress().getHostAddress() + : "", + (c.getRemoteAddress() != null) + ? c.getRemoteAddress().getHostAddress() + : "", + (c.getNetwork() != null) + ? c.getNetwork().getNetworkHandle() + : 0, + spi, + (auth != null) ? auth.getName() : "", + (auth != null) ? auth.getKey() : null, + (auth != null) ? auth.getTruncationLengthBits() : 0, + (crypt != null) ? crypt.getName() : "", + (crypt != null) ? crypt.getKey() : null, + (crypt != null) ? crypt.getTruncationLengthBits() : 0, + encapType, + encapLocalPort, + encapRemotePort); } catch (ServiceSpecificException e) { // FIXME: get the error code and throw is at an IOException from Errno Exception + return new IpSecTransformResponse(IpSecManager.Status.RESOURCE_UNAVAILABLE); } } // Both SAs were created successfully, time to construct a record and lock it away