diff options
author | Hung-ying Tyan <tyanh@google.com> | 2009-07-13 18:49:43 +0800 |
---|---|---|
committer | Hung-ying Tyan <tyanh@google.com> | 2009-07-13 19:31:08 +0800 |
commit | c22ce6a738bbd757c71f8778defb015ea81ab33c (patch) | |
tree | c0e32bee7a5dbc9637f59d13cdf2d2857e543da0 /packages/VpnServices/src/com/android/server/vpn | |
parent | 575eb92885c150ccbfa257c9a6fdcb19a04baf0c (diff) | |
download | frameworks_base-c22ce6a738bbd757c71f8778defb015ea81ab33c.zip frameworks_base-c22ce6a738bbd757c71f8778defb015ea81ab33c.tar.gz frameworks_base-c22ce6a738bbd757c71f8778defb015ea81ab33c.tar.bz2 |
Remove host IP from related VPN classes.
...since the daemon (racoon) gets the information by itself.
Diffstat (limited to 'packages/VpnServices/src/com/android/server/vpn')
4 files changed, 2 insertions, 49 deletions
diff --git a/packages/VpnServices/src/com/android/server/vpn/L2tpIpsecPskService.java b/packages/VpnServices/src/com/android/server/vpn/L2tpIpsecPskService.java index 6abf81c..7b3ddf8 100644 --- a/packages/VpnServices/src/com/android/server/vpn/L2tpIpsecPskService.java +++ b/packages/VpnServices/src/com/android/server/vpn/L2tpIpsecPskService.java @@ -30,12 +30,11 @@ class L2tpIpsecPskService extends VpnService<L2tpIpsecPskProfile> { @Override protected void connect(String serverIp, String username, String password) throws IOException { - String hostIp = getHostIp(); L2tpIpsecPskProfile p = getProfile(); // IPSEC AndroidServiceProxy ipsecService = startService(IPSEC_DAEMON); - ipsecService.sendCommand(hostIp, serverIp, L2tpService.L2TP_PORT, + ipsecService.sendCommand(serverIp, L2tpService.L2TP_PORT, p.getPresharedKey()); sleep(2000); // 2 seconds diff --git a/packages/VpnServices/src/com/android/server/vpn/L2tpIpsecService.java b/packages/VpnServices/src/com/android/server/vpn/L2tpIpsecService.java index 825953c..e2d4ff4 100644 --- a/packages/VpnServices/src/com/android/server/vpn/L2tpIpsecService.java +++ b/packages/VpnServices/src/com/android/server/vpn/L2tpIpsecService.java @@ -30,11 +30,9 @@ class L2tpIpsecService extends VpnService<L2tpIpsecProfile> { @Override protected void connect(String serverIp, String username, String password) throws IOException { - String hostIp = getHostIp(); - // IPSEC AndroidServiceProxy ipsecService = startService(IPSEC_DAEMON); - ipsecService.sendCommand(hostIp, serverIp, L2tpService.L2TP_PORT, + ipsecService.sendCommand(serverIp, L2tpService.L2TP_PORT, getUserkeyPath(), getUserCertPath(), getCaCertPath()); sleep(2000); // 2 seconds diff --git a/packages/VpnServices/src/com/android/server/vpn/MtpdHelper.java b/packages/VpnServices/src/com/android/server/vpn/MtpdHelper.java index 16d253a..5fac799 100644 --- a/packages/VpnServices/src/com/android/server/vpn/MtpdHelper.java +++ b/packages/VpnServices/src/com/android/server/vpn/MtpdHelper.java @@ -48,7 +48,6 @@ class MtpdHelper { "linkname", VPN_LINKNAME, "name", username, "password", password, - "ipparam", serverIp + "@" + vpnService.getGatewayIp(), "refuse-eap", "nodefaultroute", "usepeerdns", "idle", "1800", "mtu", "1400", diff --git a/packages/VpnServices/src/com/android/server/vpn/VpnService.java b/packages/VpnServices/src/com/android/server/vpn/VpnService.java index 47baf48..b2a9445 100644 --- a/packages/VpnServices/src/com/android/server/vpn/VpnService.java +++ b/packages/VpnServices/src/com/android/server/vpn/VpnService.java @@ -20,7 +20,6 @@ import android.app.Notification; import android.app.NotificationManager; import android.app.PendingIntent; import android.content.Context; -import android.net.NetworkUtils; import android.net.vpn.VpnManager; import android.net.vpn.VpnProfile; import android.net.vpn.VpnState; @@ -30,11 +29,8 @@ import android.util.Log; import java.io.IOException; import java.net.InetAddress; -import java.net.NetworkInterface; -import java.net.Socket; import java.net.UnknownHostException; import java.util.ArrayList; -import java.util.Enumeration; import java.util.List; /** @@ -69,7 +65,6 @@ abstract class VpnService<E extends VpnProfile> { private String mVpnDns1 = ""; private String mVpnDns2 = ""; private String mOriginalDomainSuffices; - private String mHostIp; private long mStartTime; // VPN connection start time @@ -108,14 +103,6 @@ abstract class VpnService<E extends VpnProfile> { } /** - * Returns the host IP for establishing the VPN connection. - */ - protected String getHostIp() throws IOException { - if (mHostIp == null) mHostIp = reallyGetHostIp(); - return mHostIp; - } - - /** * Returns the IP address of the specified host name. */ protected String getIp(String hostName) throws IOException { @@ -123,21 +110,6 @@ abstract class VpnService<E extends VpnProfile> { } /** - * Returns the IP address of the default gateway. - */ - protected String getGatewayIp() throws IOException { - Enumeration<NetworkInterface> ifces = - NetworkInterface.getNetworkInterfaces(); - for (; ifces.hasMoreElements(); ) { - NetworkInterface ni = ifces.nextElement(); - int gateway = NetworkUtils.getDefaultRoute(ni.getName()); - if (gateway == 0) continue; - return toInetAddress(gateway).getHostAddress(); - } - throw new IOException("Default gateway is not available"); - } - - /** * Sets the system property. The method is blocked until the value is * settled in. * @param name the name of the property @@ -407,21 +379,6 @@ abstract class VpnService<E extends VpnProfile> { } } - private String reallyGetHostIp() throws IOException { - Enumeration<NetworkInterface> ifces = - NetworkInterface.getNetworkInterfaces(); - for (; ifces.hasMoreElements(); ) { - NetworkInterface ni = ifces.nextElement(); - int gateway = NetworkUtils.getDefaultRoute(ni.getName()); - if (gateway == 0) continue; - Enumeration<InetAddress> addrs = ni.getInetAddresses(); - for (; addrs.hasMoreElements(); ) { - return addrs.nextElement().getHostAddress(); - } - } - throw new IOException("Host IP is not available"); - } - protected void sleep(int ms) { try { Thread.currentThread().sleep(ms); |