Merge "Support Ikev2VpnProfile provisioned with IkeTunnelConnectionParams" am: a2ec01c7a1 am: b241c0a1af
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/2062248 Change-Id: Ie68b25eb50bbd03aba551b10d1f95dd9559cdea4 Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
@@ -85,6 +85,7 @@ import android.net.ipsec.ike.ChildSessionParams;
|
|||||||
import android.net.ipsec.ike.IkeSession;
|
import android.net.ipsec.ike.IkeSession;
|
||||||
import android.net.ipsec.ike.IkeSessionCallback;
|
import android.net.ipsec.ike.IkeSessionCallback;
|
||||||
import android.net.ipsec.ike.IkeSessionParams;
|
import android.net.ipsec.ike.IkeSessionParams;
|
||||||
|
import android.net.ipsec.ike.IkeTunnelConnectionParams;
|
||||||
import android.net.ipsec.ike.exceptions.IkeProtocolException;
|
import android.net.ipsec.ike.exceptions.IkeProtocolException;
|
||||||
import android.os.Binder;
|
import android.os.Binder;
|
||||||
import android.os.Build.VERSION_CODES;
|
import android.os.Build.VERSION_CODES;
|
||||||
@@ -2267,6 +2268,11 @@ public class Vpn {
|
|||||||
profile.setAllowedAlgorithms(Ikev2VpnProfile.DEFAULT_ALGORITHMS);
|
profile.setAllowedAlgorithms(Ikev2VpnProfile.DEFAULT_ALGORITHMS);
|
||||||
startVpnProfilePrivileged(profile, VpnConfig.LEGACY_VPN);
|
startVpnProfilePrivileged(profile, VpnConfig.LEGACY_VPN);
|
||||||
return;
|
return;
|
||||||
|
case VpnProfile.TYPE_IKEV2_FROM_IKE_TUN_CONN_PARAMS:
|
||||||
|
// All the necessary IKE options should come from IkeTunnelConnectionParams in the
|
||||||
|
// profile.
|
||||||
|
startVpnProfilePrivileged(profile, VpnConfig.LEGACY_VPN);
|
||||||
|
return;
|
||||||
case VpnProfile.TYPE_L2TP_IPSEC_PSK:
|
case VpnProfile.TYPE_L2TP_IPSEC_PSK:
|
||||||
racoon = new String[] {
|
racoon = new String[] {
|
||||||
iface, profile.server, "udppsk", profile.ipsecIdentifier,
|
iface, profile.server, "udppsk", profile.ipsecIdentifier,
|
||||||
@@ -2709,10 +2715,23 @@ public class Vpn {
|
|||||||
resetIkeState();
|
resetIkeState();
|
||||||
mActiveNetwork = network;
|
mActiveNetwork = network;
|
||||||
|
|
||||||
final IkeSessionParams ikeSessionParams =
|
// Get Ike options from IkeTunnelConnectionParams if it's available in the
|
||||||
VpnIkev2Utils.buildIkeSessionParams(mContext, mProfile, network);
|
// profile.
|
||||||
final ChildSessionParams childSessionParams =
|
final IkeTunnelConnectionParams ikeTunConnParams =
|
||||||
VpnIkev2Utils.buildChildSessionParams(mProfile.getAllowedAlgorithms());
|
mProfile.getIkeTunnelConnectionParams();
|
||||||
|
final IkeSessionParams ikeSessionParams;
|
||||||
|
final ChildSessionParams childSessionParams;
|
||||||
|
if (ikeTunConnParams != null) {
|
||||||
|
final IkeSessionParams.Builder builder = new IkeSessionParams.Builder(
|
||||||
|
ikeTunConnParams.getIkeSessionParams()).setNetwork(network);
|
||||||
|
ikeSessionParams = builder.build();
|
||||||
|
childSessionParams = ikeTunConnParams.getTunnelModeChildSessionParams();
|
||||||
|
} else {
|
||||||
|
ikeSessionParams = VpnIkev2Utils.buildIkeSessionParams(
|
||||||
|
mContext, mProfile, network);
|
||||||
|
childSessionParams = VpnIkev2Utils.buildChildSessionParams(
|
||||||
|
mProfile.getAllowedAlgorithms());
|
||||||
|
}
|
||||||
|
|
||||||
// TODO: Remove the need for adding two unused addresses with
|
// TODO: Remove the need for adding two unused addresses with
|
||||||
// IPsec tunnels.
|
// IPsec tunnels.
|
||||||
@@ -3233,6 +3252,7 @@ public class Vpn {
|
|||||||
case VpnProfile.TYPE_IKEV2_IPSEC_USER_PASS:
|
case VpnProfile.TYPE_IKEV2_IPSEC_USER_PASS:
|
||||||
case VpnProfile.TYPE_IKEV2_IPSEC_PSK:
|
case VpnProfile.TYPE_IKEV2_IPSEC_PSK:
|
||||||
case VpnProfile.TYPE_IKEV2_IPSEC_RSA:
|
case VpnProfile.TYPE_IKEV2_IPSEC_RSA:
|
||||||
|
case VpnProfile.TYPE_IKEV2_FROM_IKE_TUN_CONN_PARAMS:
|
||||||
if (!mContext.getPackageManager().hasSystemFeature(
|
if (!mContext.getPackageManager().hasSystemFeature(
|
||||||
PackageManager.FEATURE_IPSEC_TUNNELS)) {
|
PackageManager.FEATURE_IPSEC_TUNNELS)) {
|
||||||
throw new UnsupportedOperationException(
|
throw new UnsupportedOperationException(
|
||||||
@@ -3406,6 +3426,7 @@ public class Vpn {
|
|||||||
case VpnProfile.TYPE_IKEV2_IPSEC_USER_PASS:
|
case VpnProfile.TYPE_IKEV2_IPSEC_USER_PASS:
|
||||||
case VpnProfile.TYPE_IKEV2_IPSEC_PSK:
|
case VpnProfile.TYPE_IKEV2_IPSEC_PSK:
|
||||||
case VpnProfile.TYPE_IKEV2_IPSEC_RSA:
|
case VpnProfile.TYPE_IKEV2_IPSEC_RSA:
|
||||||
|
case VpnProfile.TYPE_IKEV2_FROM_IKE_TUN_CONN_PARAMS:
|
||||||
mVpnRunner =
|
mVpnRunner =
|
||||||
new IkeV2VpnRunner(Ikev2VpnProfile.fromVpnProfile(profile));
|
new IkeV2VpnRunner(Ikev2VpnProfile.fromVpnProfile(profile));
|
||||||
mVpnRunner.start();
|
mVpnRunner.start();
|
||||||
|
|||||||
Reference in New Issue
Block a user