Merge changes I266f8403,Ia4dc4b23
* changes: VpnSettings: hook up the legacy VPN with IConnectivityManager. VpnSettings: IPSec Hybrid RSA does not need user certificate.
This commit is contained in:
@@ -218,10 +218,10 @@ class VpnDialog extends AlertDialog implements TextWatcher, OnItemSelectedListen
|
|||||||
mView.findViewById(R.id.l2tp).setVisibility(View.VISIBLE);
|
mView.findViewById(R.id.l2tp).setVisibility(View.VISIBLE);
|
||||||
// fall through
|
// fall through
|
||||||
case VpnProfile.TYPE_IPSEC_XAUTH_RSA:
|
case VpnProfile.TYPE_IPSEC_XAUTH_RSA:
|
||||||
mView.findViewById(R.id.ipsec_ca).setVisibility(View.VISIBLE);
|
mView.findViewById(R.id.ipsec_user).setVisibility(View.VISIBLE);
|
||||||
// fall through
|
// fall through
|
||||||
case VpnProfile.TYPE_IPSEC_HYBRID_RSA:
|
case VpnProfile.TYPE_IPSEC_HYBRID_RSA:
|
||||||
mView.findViewById(R.id.ipsec_user).setVisibility(View.VISIBLE);
|
mView.findViewById(R.id.ipsec_ca).setVisibility(View.VISIBLE);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -243,7 +243,6 @@ class VpnDialog extends AlertDialog implements TextWatcher, OnItemSelectedListen
|
|||||||
|
|
||||||
case VpnProfile.TYPE_L2TP_IPSEC_RSA:
|
case VpnProfile.TYPE_L2TP_IPSEC_RSA:
|
||||||
case VpnProfile.TYPE_IPSEC_XAUTH_RSA:
|
case VpnProfile.TYPE_IPSEC_XAUTH_RSA:
|
||||||
case VpnProfile.TYPE_IPSEC_HYBRID_RSA:
|
|
||||||
return mIpsecUserCert.getSelectedItemPosition() != 0;
|
return mIpsecUserCert.getSelectedItemPosition() != 0;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
@@ -308,13 +307,13 @@ class VpnDialog extends AlertDialog implements TextWatcher, OnItemSelectedListen
|
|||||||
profile.l2tpSecret = getSecret(mProfile.l2tpSecret, mL2tpSecret);
|
profile.l2tpSecret = getSecret(mProfile.l2tpSecret, mL2tpSecret);
|
||||||
// fall through
|
// fall through
|
||||||
case VpnProfile.TYPE_IPSEC_XAUTH_RSA:
|
case VpnProfile.TYPE_IPSEC_XAUTH_RSA:
|
||||||
if (mIpsecCaCert.getSelectedItemPosition() != 0) {
|
if (mIpsecUserCert.getSelectedItemPosition() != 0) {
|
||||||
profile.ipsecCaCert = (String) mIpsecCaCert.getSelectedItem();
|
profile.ipsecUserCert = (String) mIpsecUserCert.getSelectedItem();
|
||||||
}
|
}
|
||||||
// fall through
|
// fall through
|
||||||
case VpnProfile.TYPE_IPSEC_HYBRID_RSA:
|
case VpnProfile.TYPE_IPSEC_HYBRID_RSA:
|
||||||
if (mIpsecUserCert.getSelectedItemPosition() != 0) {
|
if (mIpsecCaCert.getSelectedItemPosition() != 0) {
|
||||||
profile.ipsecUserCert = (String) mIpsecUserCert.getSelectedItem();
|
profile.ipsecCaCert = (String) mIpsecCaCert.getSelectedItem();
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -37,8 +37,10 @@ import android.view.MenuItem;
|
|||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.widget.AdapterView.AdapterContextMenuInfo;
|
import android.widget.AdapterView.AdapterContextMenuInfo;
|
||||||
|
|
||||||
|
import com.android.internal.net.VpnConfig;
|
||||||
import com.android.settings.SettingsPreferenceFragment;
|
import com.android.settings.SettingsPreferenceFragment;
|
||||||
|
|
||||||
|
import java.util.Arrays;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
|
|
||||||
public class VpnSettings extends SettingsPreferenceFragment implements
|
public class VpnSettings extends SettingsPreferenceFragment implements
|
||||||
@@ -328,7 +330,7 @@ public class VpnSettings extends SettingsPreferenceFragment implements
|
|||||||
"name", profile.username, "password", profile.password,
|
"name", profile.username, "password", profile.password,
|
||||||
"linkname", "vpn", "refuse-eap", "nodefaultroute",
|
"linkname", "vpn", "refuse-eap", "nodefaultroute",
|
||||||
"usepeerdns", "idle", "1800", "mtu", "1400", "mru", "1400",
|
"usepeerdns", "idle", "1800", "mtu", "1400", "mru", "1400",
|
||||||
(profile.mppe ? "+mppe" : "nomppe"),
|
"ipparam", profile.routes, (profile.mppe ? "+mppe" : "nomppe"),
|
||||||
};
|
};
|
||||||
break;
|
break;
|
||||||
case VpnProfile.TYPE_L2TP_IPSEC_PSK:
|
case VpnProfile.TYPE_L2TP_IPSEC_PSK:
|
||||||
@@ -338,12 +340,20 @@ public class VpnSettings extends SettingsPreferenceFragment implements
|
|||||||
"name", profile.username, "password", profile.password,
|
"name", profile.username, "password", profile.password,
|
||||||
"linkname", "vpn", "refuse-eap", "nodefaultroute",
|
"linkname", "vpn", "refuse-eap", "nodefaultroute",
|
||||||
"usepeerdns", "idle", "1800", "mtu", "1400", "mru", "1400",
|
"usepeerdns", "idle", "1800", "mtu", "1400", "mru", "1400",
|
||||||
|
"ipparam", profile.routes,
|
||||||
};
|
};
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
VpnConfig config = new VpnConfig();
|
||||||
|
config.sessionName = profile.name;
|
||||||
|
config.routes = profile.routes;
|
||||||
|
if (!profile.searchDomains.isEmpty()) {
|
||||||
|
config.searchDomains = Arrays.asList(profile.searchDomains.split(" "));
|
||||||
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
// getService().doLegacyVpn(racoon, mtpd);
|
getService().doLegacyVpn(config, racoon, mtpd);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
Log.e(TAG, "connect", e);
|
Log.e(TAG, "connect", e);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user