Compare commits

..
Author SHA1 Message Date
Leency 5139f994c4 kernel/network: fix ARP remove on devices other than 0
Check kernel codestyle / Check kernel codestyle (pull_request) Successful in 21s
Test PR / Build (ru_RU) (pull_request) Successful in 1m55s
Test PR / Build (es_ES) (pull_request) Successful in 2m0s
Test PR / Build (en_US) (pull_request) Successful in 2m4s
arp_api .remove forgot the per-device table offset, so it deleted
from device 0's table and shifted device 1's entries into it.
2026-09-30 08:42:55 +03:00
4 changed files with 7 additions and 74 deletions

No files matched your search

+1 -8
View File
@@ -463,7 +463,7 @@ proc kernel_alloc stdcall, size:dword
and eax, -PAGE_SIZE;
mov [size], eax
and eax, eax
jz .err0
jz .err
mov ebx, eax
shr ebx, 12
mov [pages_count], ebx
@@ -509,13 +509,6 @@ proc kernel_alloc stdcall, size:dword
pop ebx
ret
.err:
mov eax, [lin_addr]
test eax, eax
jz .err0
mov ecx, [pages_count]
call release_pages
stdcall free_kernel_space, [lin_addr]
.err0:
xor eax, eax
pop edi
pop ebx
+1 -59
View File
@@ -1397,9 +1397,7 @@ proc create_ring_buffer stdcall, size:dword, flags:dword
mov [page_tabs + edi], eax
mov [page_tabs + edi + edx], eax
invlpg [ebx]
add ebx, [size]
invlpg [ebx] ; the mirror half
sub ebx, [size]
invlpg [ebx+0x10000]
add eax, 0x1000
add ebx, 0x1000
add edi, 4
@@ -1418,62 +1416,6 @@ proc create_ring_buffer stdcall, size:dword, flags:dword
ret
endp
; Same as create_ring_buffer, but from non-contiguous pages.
; Not for DMA. Free with kernel_free.
align 4
proc create_ring_buffer_sparse stdcall, size:dword, flags:dword
locals
buf_ptr dd ?
endl
mov eax, [size]
test eax, eax
jz .fail
add eax, eax
stdcall alloc_kernel_space, eax
test eax, eax
jz .fail
mov [buf_ptr], eax
push ebx esi edi
mov ebx, eax ; page being mapped
mov esi, [size] ; distance to its mirror
mov edi, esi
shr edi, 12 ; pages left
.page:
call alloc_page
test eax, eax
jz .mm_fail
or eax, [flags]
mov edx, ebx
shr edx, 12
mov [page_tabs + edx*4], eax
invlpg [ebx]
lea edx, [ebx + esi]
shr edx, 12
mov [page_tabs + edx*4], eax
invlpg [ebx + esi]
add ebx, PAGE_SIZE
dec edi
jnz .page
mov eax, [buf_ptr]
pop edi esi ebx
ret
.mm_fail:
mov eax, [buf_ptr]
mov ecx, [size]
shr ecx, 11 ; both halves, in pages
call release_pages
stdcall free_kernel_space, [buf_ptr]
pop edi esi ebx
xor eax, eax
.fail:
ret
endp
align 4
proc print_mem
+4 -2
View File
@@ -688,10 +688,12 @@ arp_api:
; ecx = # entry
cmp ecx, [ARP_entries + eax]
jae .error
imul ecx, sizeof.ARP_entry
lea esi, [ARP_table + ecx]
mov edi, eax
shr edi, 2
mov esi, edi
imul esi, sizeof.ARP_entry*ARP_TABLE_SIZE
imul ecx, sizeof.ARP_entry
lea esi, [ARP_table + esi + ecx]
call arp_del_entry
ret
+1 -5
View File
@@ -198,10 +198,6 @@ ends
SOCKET_STRUCT_SIZE = 4096 ; in bytes
if sizeof.STREAM_SOCKET > SOCKET_STRUCT_SIZE
err "STREAM_SOCKET does not fit in SOCKET_STRUCT_SIZE"
end if
SOCKET_QUEUE_SIZE = 10 ; maximum number of incoming packets queued for 1 socket
; the incoming packet queue for sockets is placed in the socket struct itself, at this location from start
SOCKET_QUEUE_LOCATION = (SOCKET_STRUCT_SIZE - SOCKET_QUEUE_SIZE*sizeof.socket_queue_entry - sizeof.queue)
@@ -1651,7 +1647,7 @@ socket_ring_create:
mov esi, eax
push edx
stdcall create_ring_buffer_sparse, SOCKET_BUFFER_SIZE, PG_SWR
stdcall create_ring_buffer, SOCKET_BUFFER_SIZE, PG_SWR
pop edx
test eax, eax
jz .fail