Merge "Include PORT_4500 option when encoding IkeSessionParams" am: c65ed07b59

Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1682405

Change-Id: I60b4b5dea3b2f745803199a410cf013ef6e0c333
This commit is contained in:
Yan Yan
2021-04-21 18:24:39 +00:00
committed by Automerger Merge Worker
2 changed files with 5 additions and 0 deletions

View File

@@ -78,6 +78,7 @@ public final class IkeSessionParamsUtils {
IKE_OPTIONS.add(IkeSessionParams.IKE_OPTION_ACCEPT_ANY_REMOTE_ID);
IKE_OPTIONS.add(IkeSessionParams.IKE_OPTION_EAP_ONLY_AUTH);
IKE_OPTIONS.add(IkeSessionParams.IKE_OPTION_MOBIKE);
IKE_OPTIONS.add(IkeSessionParams.IKE_OPTION_FORCE_PORT_4500);
}
/** Serializes an IkeSessionParams to a PersistableBundle. */
@@ -124,6 +125,8 @@ public final class IkeSessionParamsUtils {
result.putInt(DPD_DELAY_SEC_KEY, params.getDpdDelaySeconds());
result.putInt(NATT_KEEPALIVE_DELAY_SEC_KEY, params.getNattKeepAliveDelaySeconds());
// TODO: b/185941731 Make sure IkeSessionParamsUtils is automatically updated when a new
// IKE_OPTION is defined in IKE module and added in the IkeSessionParams
final List<Integer> enabledIkeOptions = new ArrayList<>();
for (int option : IKE_OPTIONS) {
if (params.hasIkeOption(option)) {

View File

@@ -55,11 +55,13 @@ public class IkeSessionParamsUtilsTest {
private static IkeSessionParams.Builder createBuilderMinimum() {
final InetAddress serverAddress = InetAddresses.parseNumericAddress("192.0.2.100");
// TODO: b/185941731 Make sure all valid IKE_OPTIONS are added and validated.
return new IkeSessionParams.Builder()
.setServerHostname(serverAddress.getHostAddress())
.addSaProposal(SaProposalUtilsTest.buildTestIkeSaProposal())
.setLocalIdentification(new IkeFqdnIdentification("client.test.android.net"))
.setRemoteIdentification(new IkeFqdnIdentification("server.test.android.net"))
.addIkeOption(IkeSessionParams.IKE_OPTION_FORCE_PORT_4500)
.setAuthPsk("psk".getBytes());
}