X-Git-Url: https://git.ucc.asn.au/?a=blobdiff_plain;f=Modules%2FIPStack%2Farp.c;h=35532f6f5fc2bfb0f7dc2c49370dc4316feea1d4;hb=7758e1bf2e2a1ad35def1eb8cf9aab55d13e05a0;hp=476557e6f14cacd150793e2357b7507be20d68a0;hpb=41769c02317835472d7678d3531ecfc23df8e17a;p=tpg%2Facess2.git diff --git a/Modules/IPStack/arp.c b/Modules/IPStack/arp.c index 476557e6..35532f6f 100644 --- a/Modules/IPStack/arp.c +++ b/Modules/IPStack/arp.c @@ -73,6 +73,7 @@ tMacAddr ARP_Resolve4(tInterface *Interface, tIPv4 Address) int lastID; int i; struct sArpRequest4 req; + Sint64 timeout; ENTER("pInterface xAddress", Interface, Address); @@ -129,10 +130,16 @@ tMacAddr ARP_Resolve4(tInterface *Interface, tIPv4 Address) // Send Request Link_SendPacket(Interface->Adapter, 0x0806, req.DestMac, sizeof(struct sArpRequest4), &req); + timeout = now() + Interface->TimeoutDelay; + // Wait for a reply for(;;) { - while(lastID == giARP_LastUpdateID) Threads_Yield(); + while(lastID == giARP_LastUpdateID && now() < timeout) + Threads_Yield(); + + if( now() >= timeout ) break; // Timeout + lastID = giARP_LastUpdateID; Mutex_Acquire( &glARP_Cache4 ); @@ -145,6 +152,10 @@ tMacAddr ARP_Resolve4(tInterface *Interface, tIPv4 Address) } Mutex_Release( &glARP_Cache4 ); } + { + tMacAddr ret = {{0,0,0,0,0,0}}; + return ret; + } } /**