From 9cbcb28cd1ff629a3b28119b32b2e3bbdb78b5b5 Mon Sep 17 00:00:00 2001 From: hidnplayr Date: Mon, 7 Jun 2010 14:17:36 +0000 Subject: [PATCH] Looks like I uploaded wrong udp.inc in previous revision... git-svn-id: svn://kolibrios.org@1484 a494cfbc-eb01-0410-851d-a64ba20cac60 --- kernel/branches/net/network/udp.inc | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/kernel/branches/net/network/udp.inc b/kernel/branches/net/network/udp.inc index 62ecfd8cec..c4c7d9afe1 100644 --- a/kernel/branches/net/network/udp.inc +++ b/kernel/branches/net/network/udp.inc @@ -68,6 +68,10 @@ UDP_init: ; pointer to device struct in ebx ; UDP Packet size in ecx ; pointer to UDP Packet in edx +; +; esi = ipv4 source address +; edi = ipv4 dest address +; ; OUT: / ; ;----------------------------------------------------------------- @@ -77,20 +81,22 @@ UDP_handler: 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 + cmp [edx + UDP_Packet.Checksum], 0 + jz .no_checksum + + xchg edi, esi ; save ipv4 source address so we can look it up later push edx push esi push edi mov esi, edx - call UDP_checksum + call UDP_checksum ; this destroys edx, ecx and esi (but not edi! :) pop edx - cmp [edx + UDP_Packet.Checksum], 0 - jnz .checksum_mismatch + cmp [edx + UDP_Packet.Checksum], 0 + jnz .checksum_mismatch .no_checksum: DEBUGF 1,"UDP Checksum is correct\n" @@ -122,9 +128,7 @@ UDP_handler: cmp [eax + SOCKET_head.end + IPv4_SOCKET.RemoteIP], 0xffffffff je .ok1 -; 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 + cmp [eax + SOCKET_head.end + IPv4_SOCKET.RemoteIP], edi ; edi is IPv4 destination address jne .try_more ; Quit if the source IP is not valid, check for more sockets with this IP/PORT combination