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
|
format MS COFF
|
||||||
|
|
||||||
@ -1258,6 +1258,7 @@ int_handler:
|
|||||||
test ax, PCNET_CSR_RINT
|
test ax, PCNET_CSR_RINT
|
||||||
jz @f
|
jz @f
|
||||||
|
|
||||||
|
.receiver_test_loop:
|
||||||
movzx eax, [ebx + device.cur_rx]
|
movzx eax, [ebx + device.cur_rx]
|
||||||
; and eax, PCNET_RX_RING_MOD_MASK
|
; and eax, PCNET_RX_RING_MOD_MASK
|
||||||
mov edi, eax
|
mov edi, eax
|
||||||
@ -1288,6 +1289,7 @@ int_handler:
|
|||||||
test eax, eax ; Test if we allocated succesfully
|
test eax, eax ; Test if we allocated succesfully
|
||||||
jz .abort ;
|
jz .abort ;
|
||||||
|
|
||||||
|
push .receiver_test_loop ;
|
||||||
push ecx ; for eth_receiver
|
push ecx ; for eth_receiver
|
||||||
push eax ;
|
push eax ;
|
||||||
|
|
||||||
|
@ -345,8 +345,8 @@ ARP_add_entry:
|
|||||||
test ecx, ecx
|
test ecx, ecx
|
||||||
jz .add
|
jz .add
|
||||||
|
|
||||||
mov eax, dword[esp + ARP_ENTRY.MAC]
|
mov eax, dword[esp + 4 + ARP_ENTRY.MAC]
|
||||||
mov bx , word[esp + ARP_ENTRY.MAC + 4]
|
mov bx , word[esp + 4 + ARP_ENTRY.MAC + 4]
|
||||||
mov esi, ARPTable
|
mov esi, ARPTable
|
||||||
|
|
||||||
.loop:
|
.loop:
|
||||||
@ -357,7 +357,7 @@ ARP_add_entry:
|
|||||||
|
|
||||||
cmp dword[esi + ARP_ENTRY.TTL], 0xFFFF ; static entry
|
cmp dword[esi + ARP_ENTRY.TTL], 0xFFFF ; static entry
|
||||||
jne .notstatic
|
jne .notstatic
|
||||||
cmp dword[esp + ARP_ENTRY.TTL], 0xFFFF
|
cmp dword[esp + 4 + ARP_ENTRY.TTL], 0xFFFF
|
||||||
jne .error
|
jne .error
|
||||||
.notstatic:
|
.notstatic:
|
||||||
|
|
||||||
@ -386,10 +386,8 @@ ARP_add_entry:
|
|||||||
pop eax
|
pop eax
|
||||||
|
|
||||||
.exit:
|
.exit:
|
||||||
pop ebx ; return addr
|
|
||||||
add esp, ARP_ENTRY.size
|
|
||||||
DEBUGF 1,"Exiting\n"
|
DEBUGF 1,"Exiting\n"
|
||||||
jmp ebx
|
ret ARP_ENTRY.size
|
||||||
|
|
||||||
.error:
|
.error:
|
||||||
|
|
||||||
@ -639,7 +637,8 @@ ARP_API:
|
|||||||
mov edi, esp
|
mov edi, esp
|
||||||
mov ecx, ARP_ENTRY.size/2
|
mov ecx, ARP_ENTRY.size/2
|
||||||
rep movsw
|
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:
|
.remove:
|
||||||
; ecx = # entry
|
; ecx = # entry
|
||||||
|
@ -529,7 +529,7 @@ IPv4_create_packet:
|
|||||||
cmp ecx, 1480
|
cmp ecx, 1480
|
||||||
jg .exit_
|
jg .exit_
|
||||||
|
|
||||||
cmp ebx, ebx ; if dest ip = 0
|
test ebx, ebx ; if dest ip = 0
|
||||||
jnz .ip_ok ; and local ip is valid
|
jnz .ip_ok ; and local ip is valid
|
||||||
; use local ip instead
|
; use local ip instead
|
||||||
cmp [IP_LIST],0xffffffff ;
|
cmp [IP_LIST],0xffffffff ;
|
||||||
|
@ -177,9 +177,8 @@ checksum_1:
|
|||||||
popf
|
popf
|
||||||
jnc .end
|
jnc .end
|
||||||
|
|
||||||
lodsb
|
add dh, [esi]
|
||||||
shl ax, 8
|
adc edx, 0
|
||||||
add edx, eax
|
|
||||||
|
|
||||||
.end:
|
.end:
|
||||||
|
|
||||||
|
@ -210,8 +210,6 @@ UDP_socket_send:
|
|||||||
; Create the pseudoheader in stack,
|
; Create the pseudoheader in stack,
|
||||||
; (now that we still have all the variables that are needed.)
|
; (now that we still have all the variables that are needed.)
|
||||||
push dword IP_PROTO_UDP shl 8
|
push dword IP_PROTO_UDP shl 8
|
||||||
push eax
|
|
||||||
push ebx
|
|
||||||
|
|
||||||
add ecx, UDP_Packet.Data
|
add ecx, UDP_Packet.Data
|
||||||
|
|
||||||
@ -222,12 +220,12 @@ UDP_socket_send:
|
|||||||
cmp edi, -1
|
cmp edi, -1
|
||||||
je .fail
|
je .fail
|
||||||
|
|
||||||
mov [esp + 8 + 12], eax ; pointer to buffer start
|
mov [esp + 8 + 4], eax ; pointer to buffer start
|
||||||
mov [esp + 8 + 12 + 4], edx ; buffer size
|
mov [esp + 8 + 4 + 4], edx ; buffer size
|
||||||
|
|
||||||
rol cx, 8
|
rol cx, 8
|
||||||
mov [edi + UDP_Packet.Length], cx
|
mov [edi + UDP_Packet.Length], cx
|
||||||
mov [esp + 8 + 10], cx
|
mov [esp + 8 + 2], cx
|
||||||
ror cx, 8
|
ror cx, 8
|
||||||
|
|
||||||
pop esi
|
pop esi
|
||||||
@ -237,7 +235,7 @@ UDP_socket_send:
|
|||||||
shr ecx, 2
|
shr ecx, 2
|
||||||
rep movsd
|
rep movsd
|
||||||
mov ecx, [esp]
|
mov ecx, [esp]
|
||||||
and cx , 3
|
and ecx, 3
|
||||||
rep movsb
|
rep movsb
|
||||||
pop ecx edi
|
pop ecx edi
|
||||||
|
|
||||||
@ -249,6 +247,8 @@ UDP_socket_send:
|
|||||||
mov esi, edi
|
mov esi, edi
|
||||||
call checksum_1
|
call checksum_1
|
||||||
; Checksum for pseudoheader
|
; Checksum for pseudoheader
|
||||||
|
pushd [edi-4] ; destination address
|
||||||
|
pushd [edi-8] ; source address
|
||||||
mov ecx, 12
|
mov ecx, 12
|
||||||
mov esi, esp
|
mov esi, esp
|
||||||
call checksum_1
|
call checksum_1
|
||||||
|
Loading…
Reference in New Issue
Block a user