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>
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 @@
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));
}