Always check off-link connectivity in NetworkDiagnostics.
Currently, NetworkDiagnostics only checks off-link connectivity if one of the DNS servers is off-link. Make it check off-link connectivity in all cases by sending probes to Google Public DNS if off-link DNS servers are not specified. Bug: 22569331 Bug: 22641669 Bug: 22748900 Change-Id: I6cb0dd8491bc0c1a488631deca56722b9c1d2b3f
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user