Merge "Add xfrm mark in IpSecConfig" am: 6b3456b253
am: 4077e802ad Change-Id: I03ddca0611c4e0b41edc705cdb39b415205bb14b
This commit is contained in:
@@ -65,6 +65,10 @@ public final class IpSecConfig implements Parcelable {
|
|||||||
// An interval, in seconds between the NattKeepalive packets
|
// An interval, in seconds between the NattKeepalive packets
|
||||||
private int mNattKeepaliveInterval;
|
private int mNattKeepaliveInterval;
|
||||||
|
|
||||||
|
// XFRM mark and mask
|
||||||
|
private int mMarkValue;
|
||||||
|
private int mMarkMask;
|
||||||
|
|
||||||
/** Set the mode for this IPsec transform */
|
/** Set the mode for this IPsec transform */
|
||||||
public void setMode(int mode) {
|
public void setMode(int mode) {
|
||||||
mMode = mode;
|
mMode = mode;
|
||||||
@@ -121,6 +125,14 @@ public final class IpSecConfig implements Parcelable {
|
|||||||
mNattKeepaliveInterval = interval;
|
mNattKeepaliveInterval = interval;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void setMarkValue(int mark) {
|
||||||
|
mMarkValue = mark;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setMarkMask(int mask) {
|
||||||
|
mMarkMask = mask;
|
||||||
|
}
|
||||||
|
|
||||||
// Transport or Tunnel
|
// Transport or Tunnel
|
||||||
public int getMode() {
|
public int getMode() {
|
||||||
return mMode;
|
return mMode;
|
||||||
@@ -170,6 +182,14 @@ public final class IpSecConfig implements Parcelable {
|
|||||||
return mNattKeepaliveInterval;
|
return mNattKeepaliveInterval;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public int getMarkValue() {
|
||||||
|
return mMarkValue;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getMarkMask() {
|
||||||
|
return mMarkMask;
|
||||||
|
}
|
||||||
|
|
||||||
// Parcelable Methods
|
// Parcelable Methods
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -191,6 +211,8 @@ public final class IpSecConfig implements Parcelable {
|
|||||||
out.writeInt(mEncapSocketResourceId);
|
out.writeInt(mEncapSocketResourceId);
|
||||||
out.writeInt(mEncapRemotePort);
|
out.writeInt(mEncapRemotePort);
|
||||||
out.writeInt(mNattKeepaliveInterval);
|
out.writeInt(mNattKeepaliveInterval);
|
||||||
|
out.writeInt(mMarkValue);
|
||||||
|
out.writeInt(mMarkMask);
|
||||||
}
|
}
|
||||||
|
|
||||||
@VisibleForTesting
|
@VisibleForTesting
|
||||||
@@ -212,6 +234,8 @@ public final class IpSecConfig implements Parcelable {
|
|||||||
mEncapSocketResourceId = in.readInt();
|
mEncapSocketResourceId = in.readInt();
|
||||||
mEncapRemotePort = in.readInt();
|
mEncapRemotePort = in.readInt();
|
||||||
mNattKeepaliveInterval = in.readInt();
|
mNattKeepaliveInterval = in.readInt();
|
||||||
|
mMarkValue = in.readInt();
|
||||||
|
mMarkMask = in.readInt();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -242,6 +266,10 @@ public final class IpSecConfig implements Parcelable {
|
|||||||
.append(mAuthentication)
|
.append(mAuthentication)
|
||||||
.append(", mAuthenticatedEncryption=")
|
.append(", mAuthenticatedEncryption=")
|
||||||
.append(mAuthenticatedEncryption)
|
.append(mAuthenticatedEncryption)
|
||||||
|
.append(", mMarkValue=")
|
||||||
|
.append(mMarkValue)
|
||||||
|
.append(", mMarkMask=")
|
||||||
|
.append(mMarkMask)
|
||||||
.append("}");
|
.append("}");
|
||||||
|
|
||||||
return strBuilder.toString();
|
return strBuilder.toString();
|
||||||
@@ -275,6 +303,8 @@ public final class IpSecConfig implements Parcelable {
|
|||||||
&& IpSecAlgorithm.equals(lhs.mEncryption, rhs.mEncryption)
|
&& IpSecAlgorithm.equals(lhs.mEncryption, rhs.mEncryption)
|
||||||
&& IpSecAlgorithm.equals(
|
&& IpSecAlgorithm.equals(
|
||||||
lhs.mAuthenticatedEncryption, rhs.mAuthenticatedEncryption)
|
lhs.mAuthenticatedEncryption, rhs.mAuthenticatedEncryption)
|
||||||
&& IpSecAlgorithm.equals(lhs.mAuthentication, rhs.mAuthentication));
|
&& IpSecAlgorithm.equals(lhs.mAuthentication, rhs.mAuthentication)
|
||||||
|
&& lhs.mMarkValue == rhs.mMarkValue
|
||||||
|
&& lhs.mMarkMask == rhs.mMarkMask);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -594,7 +594,9 @@ public class IpSecService extends IIpSecService.Stub {
|
|||||||
mResourceId,
|
mResourceId,
|
||||||
mConfig.getSourceAddress(),
|
mConfig.getSourceAddress(),
|
||||||
mConfig.getDestinationAddress(),
|
mConfig.getDestinationAddress(),
|
||||||
spi);
|
spi,
|
||||||
|
mConfig.getMarkValue(),
|
||||||
|
mConfig.getMarkMask());
|
||||||
} 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
|
||||||
} catch (RemoteException e) {
|
} catch (RemoteException e) {
|
||||||
@@ -657,7 +659,7 @@ public class IpSecService extends IIpSecService.Stub {
|
|||||||
mSrvConfig
|
mSrvConfig
|
||||||
.getNetdInstance()
|
.getNetdInstance()
|
||||||
.ipSecDeleteSecurityAssociation(
|
.ipSecDeleteSecurityAssociation(
|
||||||
mResourceId, mSourceAddress, mDestinationAddress, mSpi);
|
mResourceId, mSourceAddress, mDestinationAddress, mSpi, 0, 0);
|
||||||
} 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
|
||||||
} catch (RemoteException e) {
|
} catch (RemoteException e) {
|
||||||
@@ -1190,6 +1192,8 @@ public class IpSecService extends IIpSecService.Stub {
|
|||||||
c.getDestinationAddress(),
|
c.getDestinationAddress(),
|
||||||
(c.getNetwork() != null) ? c.getNetwork().netId : 0,
|
(c.getNetwork() != null) ? c.getNetwork().netId : 0,
|
||||||
spiRecord.getSpi(),
|
spiRecord.getSpi(),
|
||||||
|
c.getMarkValue(),
|
||||||
|
c.getMarkMask(),
|
||||||
(auth != null) ? auth.getName() : "",
|
(auth != null) ? auth.getName() : "",
|
||||||
(auth != null) ? auth.getKey() : new byte[] {},
|
(auth != null) ? auth.getKey() : new byte[] {},
|
||||||
(auth != null) ? auth.getTruncationLengthBits() : 0,
|
(auth != null) ? auth.getTruncationLengthBits() : 0,
|
||||||
|
|||||||
Reference in New Issue
Block a user