Explicitly check route type in NetworkDiagnostics

LinkProperties.getRoutes() can now return throw routes as well so we
need to check the route type before consuming it if we only intend to
use unicast routes.

Test: none
Bug: 186082280
Change-Id: I2a35170f8002a16c49584c7f85cd02f0c34f35b0
This commit is contained in:
Taras Antoshchuk
2021-08-02 18:19:55 +02:00
committed by Muhammad Hasan Khan
parent 61ef984d52
commit 698a57c268

View File

@@ -206,7 +206,7 @@ public class NetworkDiagnostics {
}
for (RouteInfo route : mLinkProperties.getRoutes()) {
if (route.hasGateway()) {
if (route.getType() == RouteInfo.RTN_UNICAST && route.hasGateway()) {
InetAddress gateway = route.getGateway();
prepareIcmpMeasurement(gateway);
if (route.isIPv6Default()) {