Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 33f08103 authored by Yan Yan's avatar Yan Yan Committed by Automerger Merge Worker
Browse files

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

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

Change-Id: I60b4b5dea3b2f745803199a410cf013ef6e0c333
parents 0e0b0c68 c65ed07b
Loading
Loading
Loading
Loading
+3 −0
Original line number Original line Diff line number Diff line
@@ -78,6 +78,7 @@ public final class IkeSessionParamsUtils {
        IKE_OPTIONS.add(IkeSessionParams.IKE_OPTION_ACCEPT_ANY_REMOTE_ID);
        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_EAP_ONLY_AUTH);
        IKE_OPTIONS.add(IkeSessionParams.IKE_OPTION_MOBIKE);
        IKE_OPTIONS.add(IkeSessionParams.IKE_OPTION_MOBIKE);
        IKE_OPTIONS.add(IkeSessionParams.IKE_OPTION_FORCE_PORT_4500);
    }
    }


    /** Serializes an IkeSessionParams to a PersistableBundle. */
    /** Serializes an IkeSessionParams to a PersistableBundle. */
@@ -124,6 +125,8 @@ public final class IkeSessionParamsUtils {
        result.putInt(DPD_DELAY_SEC_KEY, params.getDpdDelaySeconds());
        result.putInt(DPD_DELAY_SEC_KEY, params.getDpdDelaySeconds());
        result.putInt(NATT_KEEPALIVE_DELAY_SEC_KEY, params.getNattKeepAliveDelaySeconds());
        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<>();
        final List<Integer> enabledIkeOptions = new ArrayList<>();
        for (int option : IKE_OPTIONS) {
        for (int option : IKE_OPTIONS) {
            if (params.hasIkeOption(option)) {
            if (params.hasIkeOption(option)) {
+2 −0
Original line number Original line Diff line number Diff line
@@ -55,11 +55,13 @@ public class IkeSessionParamsUtilsTest {
    private static IkeSessionParams.Builder createBuilderMinimum() {
    private static IkeSessionParams.Builder createBuilderMinimum() {
        final InetAddress serverAddress = InetAddresses.parseNumericAddress("192.0.2.100");
        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()
        return new IkeSessionParams.Builder()
                .setServerHostname(serverAddress.getHostAddress())
                .setServerHostname(serverAddress.getHostAddress())
                .addSaProposal(SaProposalUtilsTest.buildTestIkeSaProposal())
                .addSaProposal(SaProposalUtilsTest.buildTestIkeSaProposal())
                .setLocalIdentification(new IkeFqdnIdentification("client.test.android.net"))
                .setLocalIdentification(new IkeFqdnIdentification("client.test.android.net"))
                .setRemoteIdentification(new IkeFqdnIdentification("server.test.android.net"))
                .setRemoteIdentification(new IkeFqdnIdentification("server.test.android.net"))
                .addIkeOption(IkeSessionParams.IKE_OPTION_FORCE_PORT_4500)
                .setAuthPsk("psk".getBytes());
                .setAuthPsk("psk".getBytes());
    }
    }