diff options
author | Ratan Gupta <ratagupt@in.ibm.com> | 2017-11-14 21:04:53 +0530 |
---|---|---|
committer | Ratan Gupta <ratagupt@in.ibm.com> | 2017-11-14 21:09:00 +0530 |
commit | b6242b02b12c9d2d33ccf5b17837770134f61f46 (patch) | |
tree | 5a0108a5e02cf57382ed8c137510dd0350ddbdb1 | |
parent | 603598de183757241b900b90e45f91049ea1a840 (diff) | |
download | phosphor-networkd-b6242b02b12c9d2d33ccf5b17837770134f61f46.tar.gz phosphor-networkd-b6242b02b12c9d2d33ccf5b17837770134f61f46.zip |
Correct the logic for determining the default gateway
Default gateway would be whose destination is 0 but gateway
entry should be nonzero.
Change-Id: I14b318998741e69db33ce603b2f131b49545b5de
Signed-off-by: Ratan Gupta <ratagupt@in.ibm.com>
-rw-r--r-- | routing_table.cpp | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/routing_table.cpp b/routing_table.cpp index 83d2d24..54b3f86 100644 --- a/routing_table.cpp +++ b/routing_table.cpp @@ -142,7 +142,7 @@ void Table::parseRoutes(const nlmsghdr* nlHdr) std::string dstStr; std::string gatewayStr; - if (dstAddr.s_addr == 0) + if (dstAddr.s_addr == 0 && gateWayAddr.s_addr != 0) { defaultGateway = reinterpret_cast<char*>(inet_ntoa(gateWayAddr)); } |