Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 6ca9b98b authored by Sanket Khidkikar's avatar Sanket Khidkikar Committed by Steve Kondik
Browse files

server: Treat non-default route as host route

When constructing ip route command in addRouteWithMetric,
we used to check whether the given route is a host route.
In some cases, the isHostRoute() check can return false for
non-default routes. To make this check more foolproof,
check whether a route is non-default in order to treat it
as a host route.

Change-Id: I5e396e67e1c82bbe22600c47f1e52cc7c750cdc6
parent 05b50049
Loading
Loading
Loading
Loading
+4 −2
Original line number Diff line number Diff line
/*
 * Copyright (C) 2007 The Android Open Source Project
 * Copyright (c) 2010-2013, The Linux Foundation. All rights reserved.
 * Copyright (c) 2010-2014, The Linux Foundation. All rights reserved.
 *
 * Not a Contribution. Apache license notifications and license are
 * retained for attribution purposes only.
@@ -1940,7 +1940,9 @@ public class NetworkManagementService extends INetworkManagementService.Stub
        cmd.appendArg(iface);
        cmd.appendArg(metric);

        if (route.isHostRoute()) {
        // If route is not default then
        // implicitly treat it as a host route
        if (!route.isDefaultRoute()) {
            cmd.appendArg(route.getDestination().getAddress().getHostAddress());
        }