X-Git-Url: https://git.ucc.asn.au/?a=blobdiff_plain;f=Modules%2FIPStack%2Farp.c;h=35532f6f5fc2bfb0f7dc2c49370dc4316feea1d4;hb=7758e1bf2e2a1ad35def1eb8cf9aab55d13e05a0;hp=9e92414bebbcde480359d6b14620c406a3183082;hpb=8051546ad5894e093211d2ec69dde6b99cdaa71d;p=tpg%2Facess2.git diff --git a/Modules/IPStack/arp.c b/Modules/IPStack/arp.c index 9e92414b..35532f6f 100644 --- a/Modules/IPStack/arp.c +++ b/Modules/IPStack/arp.c @@ -73,10 +73,12 @@ tMacAddr ARP_Resolve4(tInterface *Interface, tIPv4 Address) int lastID; int i; struct sArpRequest4 req; + Sint64 timeout; ENTER("pInterface xAddress", Interface, Address); - // Check routing tables + // Check routing tables if not on this subnet + if( IPStack_CompareAddress(4, &Address, Interface->Address, Interface->SubnetBits) == 0 ) { tRoute *route = IPStack_FindRoute(4, Interface, &Address); if( route ) { @@ -128,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 ); @@ -144,6 +152,10 @@ tMacAddr ARP_Resolve4(tInterface *Interface, tIPv4 Address) } Mutex_Release( &glARP_Cache4 ); } + { + tMacAddr ret = {{0,0,0,0,0,0}}; + return ret; + } } /**