diff options
author | Lorenzo Colitti <lorenzo@google.com> | 2015-01-23 05:57:37 +0000 |
---|---|---|
committer | Android (Google) Code Review <android-gerrit@google.com> | 2015-01-23 05:57:38 +0000 |
commit | 78d51c2292b5a3b56be1b1e92bc67b70f4eebce4 (patch) | |
tree | 613a267800ae56d54bbf912d93459d40baa42fbc | |
parent | b443610bcb9a1f0d8e64b55c7d6e53bc54d7ec43 (diff) | |
parent | b2053114562830369a9d060e79f0c9eff4be27e7 (diff) | |
download | frameworks_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.java | 2 | ||||
-rw-r--r-- | core/java/com/android/internal/net/VpnConfig.java | 9 |
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()); } |