summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLorenzo Colitti <lorenzo@google.com>2015-01-23 05:57:37 +0000
committerAndroid (Google) Code Review <android-gerrit@google.com>2015-01-23 05:57:38 +0000
commit78d51c2292b5a3b56be1b1e92bc67b70f4eebce4 (patch)
tree613a267800ae56d54bbf912d93459d40baa42fbc
parentb443610bcb9a1f0d8e64b55c7d6e53bc54d7ec43 (diff)
parentb2053114562830369a9d060e79f0c9eff4be27e7 (diff)
downloadframeworks_base-78d51c2292b5a3b56be1b1e92bc67b70f4eebce4.zip
frameworks_base-78d51c2292b5a3b56be1b1e92bc67b70f4eebce4.tar.gz
frameworks_base-78d51c2292b5a3b56be1b1e92bc67b70f4eebce4.tar.bz2
Merge "Use the proper IpPrefix and LinkAddress constructors in VPN code." into lmp-mr1-dev
-rw-r--r--core/java/android/net/VpnService.java2
-rw-r--r--core/java/com/android/internal/net/VpnConfig.java9
2 files changed, 4 insertions, 7 deletions
diff --git a/core/java/android/net/VpnService.java b/core/java/android/net/VpnService.java
index f6b6978..c26af06 100644
--- a/core/java/android/net/VpnService.java
+++ b/core/java/android/net/VpnService.java
@@ -501,7 +501,7 @@ public class VpnService extends Service {
}
}
}
- mRoutes.add(new RouteInfo(new LinkAddress(address, prefixLength), null));
+ mRoutes.add(new RouteInfo(new IpPrefix(address, prefixLength), null));
mConfig.updateAllowedFamilies(address);
return this;
}
diff --git a/core/java/com/android/internal/net/VpnConfig.java b/core/java/com/android/internal/net/VpnConfig.java
index c5d9db4..921f1fe 100644
--- a/core/java/com/android/internal/net/VpnConfig.java
+++ b/core/java/com/android/internal/net/VpnConfig.java
@@ -24,6 +24,7 @@ import android.content.pm.PackageManager;
import android.content.pm.PackageManager.NameNotFoundException;
import android.content.pm.ResolveInfo;
import android.content.res.Resources;
+import android.net.IpPrefix;
import android.net.LinkAddress;
import android.net.Network;
import android.net.RouteInfo;
@@ -117,9 +118,7 @@ public class VpnConfig implements Parcelable {
String[] routes = routesStr.trim().split(" ");
for (String route : routes) {
//each route is ip/prefix
- String[] split = route.split("/");
- RouteInfo info = new RouteInfo(new LinkAddress
- (InetAddress.parseNumericAddress(split[0]), Integer.parseInt(split[1])), null);
+ RouteInfo info = new RouteInfo(new IpPrefix(route), null);
this.routes.add(info);
updateAllowedFamilies(info.getDestination().getAddress());
}
@@ -132,9 +131,7 @@ public class VpnConfig implements Parcelable {
String[] addresses = addressesStr.trim().split(" ");
for (String address : addresses) {
//each address is ip/prefix
- String[] split = address.split("/");
- LinkAddress addr = new LinkAddress(InetAddress.parseNumericAddress(split[0]),
- Integer.parseInt(split[1]));
+ LinkAddress addr = new LinkAddress(address);
this.addresses.add(addr);
updateAllowedFamilies(addr.getAddress());
}