From 0fdadb5d699b1d0a931e26de4ef9296a9c2bf062 Mon Sep 17 00:00:00 2001 From: John Hodge Date: Mon, 21 Mar 2011 16:18:55 +0800 Subject: [PATCH] IPStack - Cleanup to ARP code (slight) --- Modules/IPStack/arp.c | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/Modules/IPStack/arp.c b/Modules/IPStack/arp.c index 82382635..1e5bb073 100644 --- a/Modules/IPStack/arp.c +++ b/Modules/IPStack/arp.c @@ -81,13 +81,12 @@ tMacAddr ARP_Resolve4(tInterface *Interface, tIPv4 Address) if( IPStack_CompareAddress(4, &Address, Interface->Address, Interface->SubnetBits) == 0 ) { tRoute *route = IPStack_FindRoute(4, Interface, &Address); - if( route ) { - // If the next hop is defined, use it - // - 0.0.0.0 as the next hop means "no next hop / direct" - if( ((tIPv4*)route->NextHop)->L != 0 ) { - // Recursion: see /Recursion/ - return ARP_Resolve4(Interface, *(tIPv4*)route->NextHop); - } + // If the next hop is defined, use it + // - 0.0.0.0 as the next hop means "no next hop / direct" + if( route && ((tIPv4*)route->NextHop)->L != 0 ) + { + // Recursion: see /Recursion/ + return ARP_Resolve4(Interface, *(tIPv4*)route->NextHop); } } -- 2.20.1