Only apply VPN isolation if it's fully routed
VPN is considered fully routed if both IPv4 and IPv6 have either a default route or a prohibit route. Bug: 145332510 Test: atest FrameworksNetTests Change-Id: I59cf48552bca98092d1212e3d718fd420add5458
This commit is contained in:
parent
3402ee64ed
commit
ab8cf306ea
1 changed files with 146 additions and 1 deletions
|
|
@ -425,6 +425,16 @@ public final class RouteInfo implements Parcelable {
|
|||
return mType == RTN_UNICAST && mDestination.getPrefixLength() == 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* Indicates if this route is an unreachable default route.
|
||||
*
|
||||
* @return {@code true} if it's an unreachable route with prefix length of 0.
|
||||
* @hide
|
||||
*/
|
||||
private boolean isUnreachableDefaultRoute() {
|
||||
return mType == RTN_UNREACHABLE && mDestination.getPrefixLength() == 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* Indicates if this route is an IPv4 default route.
|
||||
* @hide
|
||||
|
|
@ -433,6 +443,14 @@ public final class RouteInfo implements Parcelable {
|
|||
return isDefaultRoute() && mDestination.getAddress() instanceof Inet4Address;
|
||||
}
|
||||
|
||||
/**
|
||||
* Indicates if this route is an IPv4 unreachable default route.
|
||||
* @hide
|
||||
*/
|
||||
public boolean isIPv4UnreachableDefault() {
|
||||
return isUnreachableDefaultRoute() && mDestination.getAddress() instanceof Inet4Address;
|
||||
}
|
||||
|
||||
/**
|
||||
* Indicates if this route is an IPv6 default route.
|
||||
* @hide
|
||||
|
|
@ -441,6 +459,14 @@ public final class RouteInfo implements Parcelable {
|
|||
return isDefaultRoute() && mDestination.getAddress() instanceof Inet6Address;
|
||||
}
|
||||
|
||||
/**
|
||||
* Indicates if this route is an IPv6 unreachable default route.
|
||||
* @hide
|
||||
*/
|
||||
public boolean isIPv6UnreachableDefault() {
|
||||
return isUnreachableDefaultRoute() && mDestination.getAddress() instanceof Inet6Address;
|
||||
}
|
||||
|
||||
/**
|
||||
* Indicates if this route is a host route (ie, matches only a single host address).
|
||||
*
|
||||
|
|
|
|||
Loading…
Reference in a new issue