summaryrefslogtreecommitdiff
path: root/core/java
diff options
context:
space:
mode:
authorRobert Greenwalt <rgreenwalt@google.com>2013-04-11 13:48:16 -0700
committerRobert Greenwalt <rgreenwalt@google.com>2013-04-12 11:22:52 -0700
commitca441ee2f0d53c3d3a00b2a9aa96c064378fd535 (patch)
tree72c5acb6646c66d42b93ba58dce3a4aaa634cc94 /core/java
parentbd286426fae833ddbef0646b267e2a31eee4939b (diff)
Add new route.hasGateway() api
Fixes issues brought in by change to isHostRoute. isHostRoute was technically correct, but the callers really wanted hasNextHop behavior. bug:8597268 Change-Id: I360761ccfa98b2ba34642f717a78fa71ec1bae4f
Diffstat (limited to 'core/java')
-rw-r--r--core/java/android/net/RouteInfo.java7
1 files changed, 7 insertions, 0 deletions
diff --git a/core/java/android/net/RouteInfo.java b/core/java/android/net/RouteInfo.java
index cc3c5f7cffaf..1d051dde497d 100644
--- a/core/java/android/net/RouteInfo.java
+++ b/core/java/android/net/RouteInfo.java
@@ -60,6 +60,7 @@ public class RouteInfo implements Parcelable {
private final boolean mIsDefault;
private final boolean mIsHost;
+ private final boolean mHasGateway;
/**
* Constructs a RouteInfo object.
@@ -97,6 +98,8 @@ public class RouteInfo implements Parcelable {
gateway = Inet6Address.ANY;
}
}
+ mHasGateway = (!gateway.isAnyLocalAddress());
+
mDestination = new LinkAddress(NetworkUtils.getNetworkPart(destination.getAddress(),
destination.getNetworkPrefixLength()), destination.getNetworkPrefixLength());
mGateway = gateway;
@@ -171,6 +174,10 @@ public class RouteInfo implements Parcelable {
return mIsHost;
}
+ public boolean hasGateway() {
+ return mHasGateway;
+ }
+
public String toString() {
String val = "";
if (mDestination != null) val = mDestination.toString();