Add XFRM-I support to IpSecService

This change adds support for XFRM-I to all IpSecService netd calls.
Fallback logic is in netd, and thus both VTI and XFRM-I parameters are
always passed down to IpSecService.

Bug: 78589502
Test: All java, CTS tests passing
Change-Id: Ie4186f0ad7e50763b21831f6fa411b5ee436de78
This commit is contained in:
Benedict Wong
2018-09-06 11:31:25 -07:00
parent 683441d87a
commit 5d74984c24
2 changed files with 70 additions and 28 deletions

View File

@@ -69,6 +69,9 @@ public final class IpSecConfig implements Parcelable {
private int mMarkValue;
private int mMarkMask;
// XFRM interface id
private int mXfrmInterfaceId;
/** Set the mode for this IPsec transform */
public void setMode(int mode) {
mMode = mode;
@@ -145,6 +148,10 @@ public final class IpSecConfig implements Parcelable {
mMarkMask = mask;
}
public void setXfrmInterfaceId(int xfrmInterfaceId) {
mXfrmInterfaceId = xfrmInterfaceId;
}
// Transport or Tunnel
public int getMode() {
return mMode;
@@ -202,6 +209,10 @@ public final class IpSecConfig implements Parcelable {
return mMarkMask;
}
public int getXfrmInterfaceId() {
return mXfrmInterfaceId;
}
// Parcelable Methods
@Override
@@ -225,6 +236,7 @@ public final class IpSecConfig implements Parcelable {
out.writeInt(mNattKeepaliveInterval);
out.writeInt(mMarkValue);
out.writeInt(mMarkMask);
out.writeInt(mXfrmInterfaceId);
}
@VisibleForTesting
@@ -247,6 +259,7 @@ public final class IpSecConfig implements Parcelable {
mNattKeepaliveInterval = c.mNattKeepaliveInterval;
mMarkValue = c.mMarkValue;
mMarkMask = c.mMarkMask;
mXfrmInterfaceId = c.mXfrmInterfaceId;
}
private IpSecConfig(Parcel in) {
@@ -267,6 +280,7 @@ public final class IpSecConfig implements Parcelable {
mNattKeepaliveInterval = in.readInt();
mMarkValue = in.readInt();
mMarkMask = in.readInt();
mXfrmInterfaceId = in.readInt();
}
@Override
@@ -301,6 +315,8 @@ public final class IpSecConfig implements Parcelable {
.append(mMarkValue)
.append(", mMarkMask=")
.append(mMarkMask)
.append(", mXfrmInterfaceId=")
.append(mXfrmInterfaceId)
.append("}");
return strBuilder.toString();
@@ -332,10 +348,10 @@ public final class IpSecConfig implements Parcelable {
&& lhs.mNattKeepaliveInterval == rhs.mNattKeepaliveInterval
&& lhs.mSpiResourceId == rhs.mSpiResourceId
&& IpSecAlgorithm.equals(lhs.mEncryption, rhs.mEncryption)
&& IpSecAlgorithm.equals(
lhs.mAuthenticatedEncryption, rhs.mAuthenticatedEncryption)
&& IpSecAlgorithm.equals(lhs.mAuthenticatedEncryption, rhs.mAuthenticatedEncryption)
&& IpSecAlgorithm.equals(lhs.mAuthentication, rhs.mAuthentication)
&& lhs.mMarkValue == rhs.mMarkValue
&& lhs.mMarkMask == rhs.mMarkMask);
&& lhs.mMarkMask == rhs.mMarkMask
&& lhs.mXfrmInterfaceId == rhs.mXfrmInterfaceId);
}
}