net-branch:

Fixed error in udp.inc
Fixed another error in checksum, seems to work bug-free now :)

git-svn-id: svn://kolibrios.org@1483 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
hidnplayr 2010-06-07 12:57:52 +00:00
parent 34c194bda4
commit e4b0f6f30d
2 changed files with 12 additions and 11 deletions

View File

@ -276,9 +276,8 @@ checksum_1:
adc dh, [esi+0] adc dh, [esi+0]
adc edx, 0 adc edx, 0
inc esi
inc ecx inc esi
inc ecx
.no_2: .no_2:
popf popf

View File

@ -74,20 +74,20 @@ UDP_init:
align 4 align 4
UDP_handler: UDP_handler:
DEBUGF 1,"UDP_Handler, checksum:%x\n", [edx+UDP_Packet.Checksum]:4 DEBUGF 1,"UDP_Handler, checksum:%x, size:%u\n", [edx+UDP_Packet.Checksum]:4, ecx
; First validate, checksum: ; First validate, checksum:
cmp [edx + UDP_Packet.Checksum], 0 cmp [edx + UDP_Packet.Checksum], 0
jz .no_checksum jz .no_checksum
push ecx edx push edx
push esi push esi
push edi push edi
mov esi, edx mov esi, edx
call UDP_checksum call UDP_checksum
pop edx ecx pop edx
cmp [edx + UDP_Packet.Checksum], 0 cmp [edx + UDP_Packet.Checksum], 0
jnz .checksum_mismatch jnz .checksum_mismatch
@ -122,9 +122,9 @@ UDP_handler:
cmp [eax + SOCKET_head.end + IPv4_SOCKET.RemoteIP], 0xffffffff cmp [eax + SOCKET_head.end + IPv4_SOCKET.RemoteIP], 0xffffffff
je .ok1 je .ok1
mov esi, [esp] ; mov esi, [esp] ; start of data (ethernet header)
mov esi, [ebx + ETH_FRAME.Data + IPv4_Packet.SourceAddress] ; get the Source address from the IP Packet FIXME ; mov esi, [esi + ETH_FRAME.Data + IPv4_Packet.SourceAddress] ; get the Source address from the IP Packet FIXME
cmp [eax + SOCKET_head.end + IPv4_SOCKET.RemoteIP], esi cmp [eax + SOCKET_head.end + IPv4_SOCKET.RemoteIP], edi ;esi
jne .try_more ; Quit if the source IP is not valid, check for more sockets with this IP/PORT combination jne .try_more ; Quit if the source IP is not valid, check for more sockets with this IP/PORT combination
@ -175,6 +175,7 @@ UDP_handler:
jmp .ok2 jmp .ok2
.checksum_mismatch: .checksum_mismatch:
DEBUGF 2,"UDP_Handler - checksum mismatch\n" DEBUGF 2,"UDP_Handler - checksum mismatch\n"
@ -301,8 +302,9 @@ UDP_checksum:
adc dl, [esp+3+8] adc dl, [esp+3+8]
adc dh, [esp+2+8] adc dh, [esp+2+8]
adc dl, byte[esi+UDP_Packet.Length+1]
adc dh, byte[esi+UDP_Packet.Length+0] adc dl, cl ; byte[esi+UDP_Packet.Length+1]
adc dh, ch ; byte[esi+UDP_Packet.Length+0]
; Done with pseudoheader, now do real header ; Done with pseudoheader, now do real header
adc dl, byte[esi+UDP_Packet.SourcePort+1] adc dl, byte[esi+UDP_Packet.SourcePort+1]