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

Commit 006ba183 authored by Yan Yan's avatar Yan Yan
Browse files

Revert "Add three new IKE options in IkeSessionParamsUtils"

This reverts commit de1dca7c.

Reason for revert: This commit will be cherry picked for QPR
release and is accessing new IPsec API constants
that will not be released until mainline October train. This
commit fails to maintain the compatibility with IPsec
module that is older than the October version.
Bug: 242231517
Test: atest IkeSessionParamsUtilsTest
Change-Id: Iff0dcc32025dad3016257655205beaf2e842f24c
parent 32b24365
Loading
Loading
Loading
Loading
+0 −10
Original line number Diff line number Diff line
@@ -72,13 +72,6 @@ public final class IkeSessionParamsUtils {
    private static final String NATT_KEEPALIVE_DELAY_SEC_KEY = "NATT_KEEPALIVE_DELAY_SEC_KEY";
    private static final String IKE_OPTIONS_KEY = "IKE_OPTIONS_KEY";

    // TODO: Use the IKE API when they are exposed
    @VisibleForTesting(visibility = Visibility.PRIVATE)
    public static final int IKE_OPTION_AUTOMATIC_ADDRESS_FAMILY_SELECTION = 6;

    @VisibleForTesting(visibility = Visibility.PRIVATE)
    public static final int IKE_OPTION_AUTOMATIC_NATT_KEEPALIVES = 7;

    private static final Set<Integer> IKE_OPTIONS = new ArraySet<>();

    static {
@@ -87,9 +80,6 @@ public final class IkeSessionParamsUtils {
        IKE_OPTIONS.add(IkeSessionParams.IKE_OPTION_MOBIKE);
        IKE_OPTIONS.add(IkeSessionParams.IKE_OPTION_FORCE_PORT_4500);
        IKE_OPTIONS.add(IkeSessionParams.IKE_OPTION_INITIAL_CONTACT);
        IKE_OPTIONS.add(IkeSessionParams.IKE_OPTION_REKEY_MOBILITY);
        IKE_OPTIONS.add(IKE_OPTION_AUTOMATIC_ADDRESS_FAMILY_SELECTION);
        IKE_OPTIONS.add(IKE_OPTION_AUTOMATIC_NATT_KEEPALIVES);
    }

    /** Serializes an IkeSessionParams to a PersistableBundle. */
+14 −22
Original line number Diff line number Diff line
@@ -134,33 +134,13 @@ public class IkeSessionParamsUtilsTest {
        verifyPersistableBundleEncodeDecodeIsLossless(params);
    }

    private static IkeSessionParams.Builder createBuilderMinimumWithEap() throws Exception {
        final X509Certificate serverCaCert = createCertFromPemFile("self-signed-ca.pem");

        final byte[] eapId = "test@android.net".getBytes(StandardCharsets.US_ASCII);
        final int subId = 1;
        final EapSessionConfig eapConfig =
                new EapSessionConfig.Builder()
                        .setEapIdentity(eapId)
                        .setEapSimConfig(subId, APPTYPE_USIM)
                        .setEapAkaConfig(subId, APPTYPE_USIM)
                        .build();
        return createBuilderMinimum().setAuthEap(serverCaCert, eapConfig);
    }

    @Test
    public void testEncodeDecodeParamsWithIkeOptions() throws Exception {
        final IkeSessionParams params =
                createBuilderMinimumWithEap()
                createBuilderMinimum()
                        .addIkeOption(IkeSessionParams.IKE_OPTION_ACCEPT_ANY_REMOTE_ID)
                        .addIkeOption(IkeSessionParams.IKE_OPTION_EAP_ONLY_AUTH)
                        .addIkeOption(IkeSessionParams.IKE_OPTION_MOBIKE)
                        .addIkeOption(IkeSessionParams.IKE_OPTION_FORCE_PORT_4500)
                        .addIkeOption(IkeSessionParams.IKE_OPTION_INITIAL_CONTACT)
                        .addIkeOption(IkeSessionParams.IKE_OPTION_REKEY_MOBILITY)
                        .addIkeOption(
                                IkeSessionParamsUtils.IKE_OPTION_AUTOMATIC_ADDRESS_FAMILY_SELECTION)
                        .addIkeOption(IkeSessionParamsUtils.IKE_OPTION_AUTOMATIC_NATT_KEEPALIVES)
                        .build();
        verifyPersistableBundleEncodeDecodeIsLossless(params);
    }
@@ -196,7 +176,19 @@ public class IkeSessionParamsUtilsTest {

    @Test
    public void testEncodeRecodeParamsWithEapAuth() throws Exception {
        final IkeSessionParams params = createBuilderMinimumWithEap().build();
        final X509Certificate serverCaCert = createCertFromPemFile("self-signed-ca.pem");

        final byte[] eapId = "test@android.net".getBytes(StandardCharsets.US_ASCII);
        final int subId = 1;
        final EapSessionConfig eapConfig =
                new EapSessionConfig.Builder()
                        .setEapIdentity(eapId)
                        .setEapSimConfig(subId, APPTYPE_USIM)
                        .setEapAkaConfig(subId, APPTYPE_USIM)
                        .build();

        final IkeSessionParams params =
                createBuilderMinimum().setAuthEap(serverCaCert, eapConfig).build();
        verifyPersistableBundleEncodeDecodeIsLossless(params);
    }
}