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

Commit c130a2a8 authored by Yan Yan's avatar Yan Yan
Browse files

Include PORT_4500 option when encoding IkeSessionParams

This commit makes sure IKE_OPTION_FORCE_PORT_4500 is included
when converting IkeSessionParams to a PersistableBundle.

Bug: 185637142
Test: atest IkeSessionParamsUtilsTest
Change-Id: I1fcd6d26e64217091ad960a1c51659046e70a6ac
parent ea4537c9
Loading
Loading
Loading
Loading
+3 −0
Original line number 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_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)) {
+2 −0
Original line number Diff line number Diff line
@@ -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());
    }