Merge "Remove return value of ipSecAddSecurityAssociation"
This commit is contained in:
@@ -605,38 +605,33 @@ public class IpSecService extends IIpSecService.Stub {
|
|||||||
spis[direction] = mSpiRecords.get(c.getSpiResourceId(direction));
|
spis[direction] = mSpiRecords.get(c.getSpiResourceId(direction));
|
||||||
int spi = spis[direction].getSpi();
|
int spi = spis[direction].getSpi();
|
||||||
try {
|
try {
|
||||||
int result =
|
getNetdInstance()
|
||||||
getNetdInstance()
|
.ipSecAddSecurityAssociation(
|
||||||
.ipSecAddSecurityAssociation(
|
resourceId,
|
||||||
resourceId,
|
c.getMode(),
|
||||||
c.getMode(),
|
direction,
|
||||||
direction,
|
(c.getLocalAddress() != null)
|
||||||
(c.getLocalAddress() != null)
|
? c.getLocalAddress().getHostAddress()
|
||||||
? c.getLocalAddress().getHostAddress()
|
: "",
|
||||||
: "",
|
(c.getRemoteAddress() != null)
|
||||||
(c.getRemoteAddress() != null)
|
? c.getRemoteAddress().getHostAddress()
|
||||||
? c.getRemoteAddress().getHostAddress()
|
: "",
|
||||||
: "",
|
(c.getNetwork() != null)
|
||||||
(c.getNetwork() != null)
|
? c.getNetwork().getNetworkHandle()
|
||||||
? c.getNetwork().getNetworkHandle()
|
: 0,
|
||||||
: 0,
|
spi,
|
||||||
spi,
|
(auth != null) ? auth.getName() : "",
|
||||||
(auth != null) ? auth.getName() : "",
|
(auth != null) ? auth.getKey() : null,
|
||||||
(auth != null) ? auth.getKey() : null,
|
(auth != null) ? auth.getTruncationLengthBits() : 0,
|
||||||
(auth != null) ? auth.getTruncationLengthBits() : 0,
|
(crypt != null) ? crypt.getName() : "",
|
||||||
(crypt != null) ? crypt.getName() : "",
|
(crypt != null) ? crypt.getKey() : null,
|
||||||
(crypt != null) ? crypt.getKey() : null,
|
(crypt != null) ? crypt.getTruncationLengthBits() : 0,
|
||||||
(crypt != null) ? crypt.getTruncationLengthBits() : 0,
|
encapType,
|
||||||
encapType,
|
encapLocalPort,
|
||||||
encapLocalPort,
|
encapRemotePort);
|
||||||
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);
|
|
||||||
}
|
|
||||||
} catch (ServiceSpecificException e) {
|
} catch (ServiceSpecificException e) {
|
||||||
// FIXME: get the error code and throw is at an IOException from Errno Exception
|
// 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
|
// Both SAs were created successfully, time to construct a record and lock it away
|
||||||
|
|||||||
Reference in New Issue
Block a user