diff --git a/kernel/trunk/network/eth_drv/arp.inc b/kernel/trunk/network/eth_drv/arp.inc index 06a76086d6..0629e935c9 100644 --- a/kernel/trunk/network/eth_drv/arp.inc +++ b/kernel/trunk/network/eth_drv/arp.inc @@ -345,23 +345,7 @@ proc arp_table_manager stdcall uses ebx esi edi ecx edx,\ je .ip_to_mac_send_request ;if ARP-table not contain an entries, we have to request IP. ;EAX will be containing a zero, it's equal to ARP_NO_ENTRY - ; first, check destination IP to see if it is on 'this' network. - ; The test is: - ; if ( destIP & subnet_mask == stack_ip & subnet_mask ) - ; destination is local - ; else - ; destination is remote, so pass to gateway - mov eax, [Index] ;eax=required IP - mov esi, eax - and esi, [subnet_mask] - mov ecx, [stack_ip] - and ecx, [subnet_mask] - cmp esi, ecx - je @f ;if we and target IP are located in the same network - mov eax, [gateway_ip] - @@: - mov ecx, dword[NumARP] imul esi, ecx, ARP_ENTRY_SIZE ;esi=current ARP-table size diff --git a/kernel/trunk/network/eth_drv/ethernet.inc b/kernel/trunk/network/eth_drv/ethernet.inc index 7cc7f59c80..5a3894d88d 100644 --- a/kernel/trunk/network/eth_drv/ethernet.inc +++ b/kernel/trunk/network/eth_drv/ethernet.inc @@ -279,6 +279,23 @@ local MACAddress dp ? ;allocate 6 bytes in the stack cmp edx, 0xffffffff je .send ; If it is broadcast, just send + ; first, check destination IP to see if it is on 'this' network. + ; The test is: + ; if ( destIP & subnet_mask == stack_ip & subnet_mask ) + ; destination is local + ; else + ; destination is remote, so pass to gateway + + mov eax, edx + and eax, [subnet_mask] + mov ecx, [stack_ip] + and ecx, [subnet_mask] + cmp eax, ecx + je .local + + mov edx, [gateway_ip] + .local: + lea eax, [MACAddress] ;cause this is local variable stdcall arp_table_manager, ARP_TABLE_IP_TO_MAC, edx, eax ;opcode,IP,MAC_ptr - Get the MAC address.