am e288b3af: Merge changes I5c994de5,I6cb0dd84 into mnc-dev

* commit 'e288b3af14421731d8f477b97e8d77588f20498b':
  Add a test for public bugs 2111 and 2136.
  Always check off-link connectivity in NetworkDiagnostics.
This commit is contained in:
Lorenzo Colitti 2015-07-28 01:20:16 +00:00 • committed by Android Git Automerger
commit 2d2a8d167e

View file

@ -661,6 +661,17 @@ public final class LinkProperties implements Parcelable {
return false;
}
/**
* Returns true if this link or any of its stacked interfaces has an IPv4 address.
*
* @return {@code true} if there is an IPv4 address, {@code false} otherwise.
*/
private boolean hasIPv4AddressOnInterface(String iface) {
return (mIfaceName.equals(iface) && hasIPv4Address()) ||
(iface != null && mStackedLinks.containsKey(iface) &&
mStackedLinks.get(iface).hasIPv4Address());
}
/**
* Returns true if this link has a global preferred IPv6 address.
*
@ -792,7 +803,7 @@ public final class LinkProperties implements Parcelable {
if (ip instanceof Inet4Address) {
// For IPv4, it suffices for now to simply have any address.
return hasIPv4Address();
return hasIPv4AddressOnInterface(bestRoute.getInterface());
} else if (ip instanceof Inet6Address) {
if (ip.isLinkLocalAddress()) {
// For now, just make sure link-local destinations have