forked from KolibriOS/kolibrios
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
This commit is contained in:
parent
2033224063
commit
f986b74d68
@ -182,7 +182,6 @@ ARP_input:
|
|||||||
|
|
||||||
mov eax, [edx + ARP_header.SenderIP]
|
mov eax, [edx + ARP_header.SenderIP]
|
||||||
mov esi, ARP_table
|
mov esi, ARP_table
|
||||||
|
|
||||||
.loop:
|
.loop:
|
||||||
cmp [esi + ARP_entry.IP], eax
|
cmp [esi + ARP_entry.IP], eax
|
||||||
je .gotit
|
je .gotit
|
||||||
@ -190,6 +189,7 @@ ARP_input:
|
|||||||
dec ecx
|
dec ecx
|
||||||
jnz .loop
|
jnz .loop
|
||||||
|
|
||||||
|
DEBUGF 1,"ARP_input: no matching entry found\n"
|
||||||
jmp .exit
|
jmp .exit
|
||||||
|
|
||||||
.gotit:
|
.gotit:
|
||||||
@ -352,15 +352,14 @@ ARP_add_entry:
|
|||||||
DEBUGF 1,"ARP_add_entry: "
|
DEBUGF 1,"ARP_add_entry: "
|
||||||
|
|
||||||
mov ecx, [NumARP]
|
mov ecx, [NumARP]
|
||||||
test ecx, ecx ; first entry?
|
|
||||||
jz .add
|
|
||||||
cmp ecx, ARP_TABLE_SIZE ; list full ?
|
cmp ecx, ARP_TABLE_SIZE ; list full ?
|
||||||
jae .error
|
jae .error
|
||||||
|
|
||||||
mov eax, dword [esi + ARP_entry.MAC]
|
mov eax, dword [esi + ARP_entry.MAC]
|
||||||
mov bx , word [esi + ARP_entry.MAC + 4]
|
mov bx, word [esi + ARP_entry.MAC + 4]
|
||||||
mov edi, ARP_table
|
|
||||||
|
|
||||||
|
xor ecx, ecx
|
||||||
|
mov edi, ARP_table
|
||||||
.loop:
|
.loop:
|
||||||
cmp dword [edi + ARP_entry.MAC], eax ; Check for duplicate MAC's
|
cmp dword [edi + ARP_entry.MAC], eax ; Check for duplicate MAC's
|
||||||
jne .maybe_next ;
|
jne .maybe_next ;
|
||||||
@ -368,30 +367,23 @@ ARP_add_entry:
|
|||||||
jne .maybe_next ;
|
jne .maybe_next ;
|
||||||
|
|
||||||
cmp [edi + ARP_entry.TTL], ARP_STATIC_ENTRY
|
cmp [edi + ARP_entry.TTL], ARP_STATIC_ENTRY
|
||||||
jne .notstatic
|
jne .add
|
||||||
cmp [esi + ARP_entry.TTL], ARP_STATIC_ENTRY
|
cmp [esi + ARP_entry.TTL], ARP_STATIC_ENTRY
|
||||||
jne .error
|
jne .error
|
||||||
.notstatic:
|
|
||||||
|
|
||||||
neg ecx
|
|
||||||
add ecx, [NumARP]
|
|
||||||
jmp .add
|
|
||||||
|
|
||||||
.maybe_next:
|
.maybe_next:
|
||||||
add esi, sizeof.ARP_entry
|
add edi, sizeof.ARP_entry
|
||||||
loop .loop
|
inc ecx
|
||||||
|
cmp ecx, ARP_TABLE_SIZE
|
||||||
|
jae .error
|
||||||
|
jmp .loop
|
||||||
|
|
||||||
mov ecx, [NumARP]
|
|
||||||
.add:
|
.add:
|
||||||
push ecx
|
mov eax, ecx
|
||||||
imul ecx, sizeof.ARP_entry
|
|
||||||
lea edi, [ecx + ARP_table]
|
|
||||||
mov ecx, sizeof.ARP_entry/2
|
mov ecx, sizeof.ARP_entry/2
|
||||||
rep movsw
|
rep movsw
|
||||||
|
|
||||||
lea esi, [edi - sizeof.ARP_entry]
|
|
||||||
inc [NumARP]
|
inc [NumARP]
|
||||||
pop eax
|
|
||||||
DEBUGF 1,"entry=%u\n", eax
|
DEBUGF 1,"entry=%u\n", eax
|
||||||
|
|
||||||
ret
|
ret
|
||||||
|
@ -1090,7 +1090,7 @@ SOCKET_set_opt:
|
|||||||
align 4
|
align 4
|
||||||
SOCKET_debug:
|
SOCKET_debug:
|
||||||
|
|
||||||
DEBUGF 1,"SOCKET_debug\n"
|
; DEBUGF 1,"SOCKET_debug\n"
|
||||||
|
|
||||||
mov edi, edx
|
mov edi, edx
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user