diff options
| author | Ratan Gupta <ratagupt@in.ibm.com> | 2018-05-04 17:23:16 +0530 |
|---|---|---|
| committer | Ratan Gupta <ratagupt@in.ibm.com> | 2018-05-04 17:23:16 +0530 |
| commit | 4a5f08a8b800d7505d7e570c2f0ce20ba197e665 (patch) | |
| tree | 77550d371fdb9600e55b1135954dd51c72d731ec | |
| parent | 057ff0daf0fd4d2617c5e50e2f9a095e06e3c24b (diff) | |
| download | phosphor-networkd-4a5f08a8b800d7505d7e570c2f0ce20ba197e665.tar.gz phosphor-networkd-4a5f08a8b800d7505d7e570c2f0ce20ba197e665.zip | |
Don't update the route entry for the existing network
As per the linux routing policy it always takes the
first matched route for the given network.
Change-Id: I1d9722fd773f3ba4619225f9d06d1db7da9b69c5
Signed-off-by: Ratan Gupta <ratagupt@in.ibm.com>
| -rw-r--r-- | routing_table.cpp | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/routing_table.cpp b/routing_table.cpp index 54b3f86..6630a58 100644 --- a/routing_table.cpp +++ b/routing_table.cpp @@ -151,7 +151,15 @@ void Table::parseRoutes(const nlmsghdr* nlHdr) gatewayStr = inet_ntoa(gateWayAddr); Entry route(dstStr, gatewayStr, ifName); - routeList.emplace(std::make_pair(dstStr, std::move(route))); + // if there is already existing route for this network + // then ignore the next one as it would not be used by the + // routing policy + // So don't update the route entry for the network for which + // there is already a route exist. + if (routeList.find(dstStr) == routeList.end()) + { + routeList.emplace(std::make_pair(dstStr, std::move(route))); + } } Map Table::getRoutes() |

