forked from KolibriOS/kolibrios
Some fixes in net branch:
* pseudoheader for UDP checksum was wrong * network checksum for data with odd length was wrong * stack issues in ARP_add_entry fixed * more correct checking for new packets in pcnet driver git-svn-id: svn://kolibrios.org@1251 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
parent
441819a385
commit
b35a874c08
@ -10,7 +10,7 @@
|
||||
;; ;;
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
|
||||
$Revision$
|
||||
; $Revision$
|
||||
|
||||
format MS COFF
|
||||
|
||||
@ -1258,6 +1258,7 @@ int_handler:
|
||||
test ax, PCNET_CSR_RINT
|
||||
jz @f
|
||||
|
||||
.receiver_test_loop:
|
||||
movzx eax, [ebx + device.cur_rx]
|
||||
; and eax, PCNET_RX_RING_MOD_MASK
|
||||
mov edi, eax
|
||||
@ -1288,6 +1289,7 @@ int_handler:
|
||||
test eax, eax ; Test if we allocated succesfully
|
||||
jz .abort ;
|
||||
|
||||
push .receiver_test_loop ;
|
||||
push ecx ; for eth_receiver
|
||||
push eax ;
|
||||
|
||||
|
@ -345,8 +345,8 @@ ARP_add_entry:
|
||||
test ecx, ecx
|
||||
jz .add
|
||||
|
||||
mov eax, dword[esp + ARP_ENTRY.MAC]
|
||||
mov bx , word[esp + ARP_ENTRY.MAC + 4]
|
||||
mov eax, dword[esp + 4 + ARP_ENTRY.MAC]
|
||||
mov bx , word[esp + 4 + ARP_ENTRY.MAC + 4]
|
||||
mov esi, ARPTable
|
||||
|
||||
.loop:
|
||||
@ -357,7 +357,7 @@ ARP_add_entry:
|
||||
|
||||
cmp dword[esi + ARP_ENTRY.TTL], 0xFFFF ; static entry
|
||||
jne .notstatic
|
||||
cmp dword[esp + ARP_ENTRY.TTL], 0xFFFF
|
||||
cmp dword[esp + 4 + ARP_ENTRY.TTL], 0xFFFF
|
||||
jne .error
|
||||
.notstatic:
|
||||
|
||||
@ -386,10 +386,8 @@ ARP_add_entry:
|
||||
pop eax
|
||||
|
||||
.exit:
|
||||
pop ebx ; return addr
|
||||
add esp, ARP_ENTRY.size
|
||||
DEBUGF 1,"Exiting\n"
|
||||
jmp ebx
|
||||
ret ARP_ENTRY.size
|
||||
|
||||
.error:
|
||||
|
||||
@ -639,7 +637,8 @@ ARP_API:
|
||||
mov edi, esp
|
||||
mov ecx, ARP_ENTRY.size/2
|
||||
rep movsw
|
||||
jmp ARP_add_entry ;out: eax = entry number, -1 on error
|
||||
call ARP_add_entry ;out: eax = entry number, -1 on error
|
||||
ret
|
||||
|
||||
.remove:
|
||||
; ecx = # entry
|
||||
|
@ -529,7 +529,7 @@ IPv4_create_packet:
|
||||
cmp ecx, 1480
|
||||
jg .exit_
|
||||
|
||||
cmp ebx, ebx ; if dest ip = 0
|
||||
test ebx, ebx ; if dest ip = 0
|
||||
jnz .ip_ok ; and local ip is valid
|
||||
; use local ip instead
|
||||
cmp [IP_LIST],0xffffffff ;
|
||||
|
@ -177,9 +177,8 @@ checksum_1:
|
||||
popf
|
||||
jnc .end
|
||||
|
||||
lodsb
|
||||
shl ax, 8
|
||||
add edx, eax
|
||||
add dh, [esi]
|
||||
adc edx, 0
|
||||
|
||||
.end:
|
||||
|
||||
|
@ -210,8 +210,6 @@ UDP_socket_send:
|
||||
; Create the pseudoheader in stack,
|
||||
; (now that we still have all the variables that are needed.)
|
||||
push dword IP_PROTO_UDP shl 8
|
||||
push eax
|
||||
push ebx
|
||||
|
||||
add ecx, UDP_Packet.Data
|
||||
|
||||
@ -222,12 +220,12 @@ UDP_socket_send:
|
||||
cmp edi, -1
|
||||
je .fail
|
||||
|
||||
mov [esp + 8 + 12], eax ; pointer to buffer start
|
||||
mov [esp + 8 + 12 + 4], edx ; buffer size
|
||||
mov [esp + 8 + 4], eax ; pointer to buffer start
|
||||
mov [esp + 8 + 4 + 4], edx ; buffer size
|
||||
|
||||
rol cx, 8
|
||||
mov [edi + UDP_Packet.Length], cx
|
||||
mov [esp + 8 + 10], cx
|
||||
mov [esp + 8 + 2], cx
|
||||
ror cx, 8
|
||||
|
||||
pop esi
|
||||
@ -237,7 +235,7 @@ UDP_socket_send:
|
||||
shr ecx, 2
|
||||
rep movsd
|
||||
mov ecx, [esp]
|
||||
and cx , 3
|
||||
and ecx, 3
|
||||
rep movsb
|
||||
pop ecx edi
|
||||
|
||||
@ -249,6 +247,8 @@ UDP_socket_send:
|
||||
mov esi, edi
|
||||
call checksum_1
|
||||
; Checksum for pseudoheader
|
||||
pushd [edi-4] ; destination address
|
||||
pushd [edi-8] ; source address
|
||||
mov ecx, 12
|
||||
mov esi, esp
|
||||
call checksum_1
|
||||
|
Loading…
Reference in New Issue
Block a user