From f986b74d682674cd9767726ea5bb880caa0ba60c Mon Sep 17 00:00:00 2001 From: hidnplayr Date: Mon, 31 Dec 2012 13:04:38 +0000 Subject: [PATCH] Fixed and simplified ARP_add_entry. (Previous versions worked only for one entry) git-svn-id: svn://kolibrios.org@3147 a494cfbc-eb01-0410-851d-a64ba20cac60 --- kernel/branches/net/network/ARP.inc | 32 ++++++++++---------------- kernel/branches/net/network/socket.inc | 2 +- 2 files changed, 13 insertions(+), 21 deletions(-) diff --git a/kernel/branches/net/network/ARP.inc b/kernel/branches/net/network/ARP.inc index 2699891ab8..413be188f2 100644 --- a/kernel/branches/net/network/ARP.inc +++ b/kernel/branches/net/network/ARP.inc @@ -182,7 +182,6 @@ ARP_input: mov eax, [edx + ARP_header.SenderIP] mov esi, ARP_table - .loop: cmp [esi + ARP_entry.IP], eax je .gotit @@ -190,6 +189,7 @@ ARP_input: dec ecx jnz .loop + DEBUGF 1,"ARP_input: no matching entry found\n" jmp .exit .gotit: @@ -352,15 +352,14 @@ ARP_add_entry: DEBUGF 1,"ARP_add_entry: " mov ecx, [NumARP] - test ecx, ecx ; first entry? - jz .add cmp ecx, ARP_TABLE_SIZE ; list full ? jae .error mov eax, dword [esi + ARP_entry.MAC] - mov bx , word [esi + ARP_entry.MAC + 4] - mov edi, ARP_table + mov bx, word [esi + ARP_entry.MAC + 4] + xor ecx, ecx + mov edi, ARP_table .loop: cmp dword [edi + ARP_entry.MAC], eax ; Check for duplicate MAC's jne .maybe_next ; @@ -368,30 +367,23 @@ ARP_add_entry: jne .maybe_next ; cmp [edi + ARP_entry.TTL], ARP_STATIC_ENTRY - jne .notstatic + jne .add cmp [esi + ARP_entry.TTL], ARP_STATIC_ENTRY jne .error - .notstatic: - - neg ecx - add ecx, [NumARP] - jmp .add .maybe_next: - add esi, sizeof.ARP_entry - loop .loop + add edi, sizeof.ARP_entry + inc ecx + cmp ecx, ARP_TABLE_SIZE + jae .error + jmp .loop - mov ecx, [NumARP] .add: - push ecx - imul ecx, sizeof.ARP_entry - lea edi, [ecx + ARP_table] + mov eax, ecx + mov ecx, sizeof.ARP_entry/2 rep movsw - - lea esi, [edi - sizeof.ARP_entry] inc [NumARP] - pop eax DEBUGF 1,"entry=%u\n", eax ret diff --git a/kernel/branches/net/network/socket.inc b/kernel/branches/net/network/socket.inc index 3871e03812..b77eda4b45 100644 --- a/kernel/branches/net/network/socket.inc +++ b/kernel/branches/net/network/socket.inc @@ -1090,7 +1090,7 @@ SOCKET_set_opt: align 4 SOCKET_debug: - DEBUGF 1,"SOCKET_debug\n" +; DEBUGF 1,"SOCKET_debug\n" mov edi, edx