From e4b0f6f30dd3b68dbcc0393483145ea7d502d431 Mon Sep 17 00:00:00 2001 From: hidnplayr Date: Mon, 7 Jun 2010 12:57:52 +0000 Subject: [PATCH] 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 --- kernel/branches/net/network/stack.inc | 5 ++--- kernel/branches/net/network/udp.inc | 18 ++++++++++-------- 2 files changed, 12 insertions(+), 11 deletions(-) diff --git a/kernel/branches/net/network/stack.inc b/kernel/branches/net/network/stack.inc index 51adbc5388..16060f016e 100644 --- a/kernel/branches/net/network/stack.inc +++ b/kernel/branches/net/network/stack.inc @@ -276,9 +276,8 @@ checksum_1: adc dh, [esi+0] adc edx, 0 - - inc ecx - inc ecx + inc esi + inc esi .no_2: popf diff --git a/kernel/branches/net/network/udp.inc b/kernel/branches/net/network/udp.inc index de37f99776..62ecfd8cec 100644 --- a/kernel/branches/net/network/udp.inc +++ b/kernel/branches/net/network/udp.inc @@ -74,20 +74,20 @@ UDP_init: align 4 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: cmp [edx + UDP_Packet.Checksum], 0 jz .no_checksum - push ecx edx + push edx push esi push edi mov esi, edx call UDP_checksum - pop edx ecx + pop edx cmp [edx + UDP_Packet.Checksum], 0 jnz .checksum_mismatch @@ -122,9 +122,9 @@ UDP_handler: cmp [eax + SOCKET_head.end + IPv4_SOCKET.RemoteIP], 0xffffffff je .ok1 - mov esi, [esp] - mov esi, [ebx + ETH_FRAME.Data + IPv4_Packet.SourceAddress] ; get the Source address from the IP Packet FIXME - cmp [eax + SOCKET_head.end + IPv4_SOCKET.RemoteIP], esi +; mov esi, [esp] ; start of data (ethernet header) +; 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], edi ;esi 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 + .checksum_mismatch: DEBUGF 2,"UDP_Handler - checksum mismatch\n" @@ -301,8 +302,9 @@ UDP_checksum: adc dl, [esp+3+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 adc dl, byte[esi+UDP_Packet.SourcePort+1]