Fixed bug in TCP_input.listen, clarified some of the debug output (net branch)

git-svn-id: svn://kolibrios.org@2555 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
hidnplayr 2012-04-03 18:26:53 +00:00
parent 07aba6c98f
commit a1174dce46
4 changed files with 27 additions and 18 deletions

View File

@ -162,7 +162,7 @@ local .exit
align 4 align 4
ARP_input: ARP_input:
DEBUGF 1,"ARP_Handler - start\n" DEBUGF 1,"ARP_input - start\n"
cmp ecx, sizeof.ARP_header cmp ecx, sizeof.ARP_header
jb .exit jb .exit
@ -172,7 +172,7 @@ ARP_input:
cmp [edx + ARP_header.Opcode], ARP_REP_OPCODE cmp [edx + ARP_header.Opcode], ARP_REP_OPCODE
jne .maybe_request jne .maybe_request
DEBUGF 1,"ARP_Handler - it's a reply packet from %u.%u.%u.%u\n",\ DEBUGF 1,"ARP_input - it's a reply packet from %u.%u.%u.%u\n",\
[edx + ARP_header.SenderIP]:1, [edx + ARP_header.SenderIP+1]:1, [edx + ARP_header.SenderIP+2]:1, [edx + ARP_header.SenderIP+3]:1 [edx + ARP_header.SenderIP]:1, [edx + ARP_header.SenderIP+1]:1, [edx + ARP_header.SenderIP+2]:1, [edx + ARP_header.SenderIP+3]:1
mov ecx, [NumARP] mov ecx, [NumARP]
@ -192,12 +192,12 @@ ARP_input:
jmp .exit jmp .exit
.gotit: .gotit:
DEBUGF 1,"ARP_Handler - found matching entry\n" DEBUGF 1,"ARP_input - found matching entry\n"
cmp [esi + ARP_entry.TTL], ARP_STATIC_ENTRY ; if it is a static entry, dont touch it cmp [esi + ARP_entry.TTL], ARP_STATIC_ENTRY ; if it is a static entry, dont touch it
je .exit je .exit
DEBUGF 1,"ARP_Handler - updating entry\n" DEBUGF 1,"ARP_input - updating entry\n"
mov [esi + ARP_entry.Status], ARP_VALID_MAPPING mov [esi + ARP_entry.Status], ARP_VALID_MAPPING
mov [esi + ARP_entry.TTL], ARP_ENTRY_TTL mov [esi + ARP_entry.TTL], ARP_ENTRY_TTL
@ -262,7 +262,7 @@ ARP_input:
; mov ax , ETHER_ARP ; mov ax , ETHER_ARP
; stosw ; stosw
DEBUGF 1,"ARP_Handler - Sending reply \n" DEBUGF 1,"ARP_input - Sending reply \n"
call [ebx + NET_DEVICE.transmit] call [ebx + NET_DEVICE.transmit]
ret ret
@ -271,7 +271,7 @@ ARP_input:
call kernel_free call kernel_free
add esp, 4 ; pop (balance stack) add esp, 4 ; pop (balance stack)
DEBUGF 1,"ARP_Handler - exiting\n" DEBUGF 1,"ARP_input - exiting\n"
ret ret
@ -447,7 +447,10 @@ ARP_del_entry:
align 4 align 4
ARP_IP_to_MAC: ARP_IP_to_MAC:
DEBUGF 1,"ARP_IP_to_MAC\n" DEBUGF 1,"ARP_IP_to_MAC: %u.%u", al, ah
rol eax, 16
DEBUGF 1,".%u.%u\n", al, ah
rol eax, 16
cmp eax, 0xffffffff cmp eax, 0xffffffff
je .broadcast je .broadcast

View File

@ -621,7 +621,7 @@ IPv4_output:
add ecx, sizeof.IPv4_header add ecx, sizeof.IPv4_header
mov di , ETHER_IPv4 mov di , ETHER_IPv4
call ETH_output call ETH_output
jz .error jz .eth_error
add esp, 6 ; pop the mac add esp, 6 ; pop the mac
@ -644,12 +644,20 @@ IPv4_output:
DEBUGF 1,"IPv4 Packet for device %x created successfully\n", ebx DEBUGF 1,"IPv4 Packet for device %x created successfully\n", ebx
ret ret
.error: .eth_error:
add esp, 6 DEBUGF 1,"IPv4_output: ethernet error\n"
add esp, 6+2+4
sub edi, edi
ret
.arp_error: .arp_error:
DEBUGF 1,"IPv4_output: ARP error (0x%x)\n", eax
add esp, 4+4+4+2+2 add esp, 4+4+4+2+2
sub edi, edi
ret
.too_large: .too_large:
DEBUGF 1,"IPv4_output: Failed\n" DEBUGF 1,"IPv4_output: error: Packet too large!\n"
sub edi, edi sub edi, edi
ret ret

View File

@ -187,8 +187,6 @@ TCP_input:
pop [eax + TCP_SOCKET.LocalPort] pop [eax + TCP_SOCKET.LocalPort]
mov [eax + TCP_SOCKET.t_state], TCPS_LISTEN mov [eax + TCP_SOCKET.t_state], TCPS_LISTEN
; mov [ebx + SOCKET.lock], 0
mov ebx, eax mov ebx, eax
jmp .LISTEN jmp .LISTEN
@ -462,7 +460,7 @@ TCP_input:
; Passive Open ; Passive Open
align 4 align 4
.LISTEN: .LISTEN:
DEBUGF 1,"TCP state: listen\n" DEBUGF 1,"TCP state: listen\n"
@ -477,7 +475,7 @@ align 4
;;; TODO: check if it's a broadcast or multicast, and drop if so ;;; TODO: check if it's a broadcast or multicast, and drop if so
push dword [edi + 4] ; Ipv4 destination addres push dword [edi] ; Ipv4 source addres
pop [ebx + IP_SOCKET.RemoteIP] pop [ebx + IP_SOCKET.RemoteIP]
push [edx + TCP_header.SourcePort] push [edx + TCP_header.SourcePort]

View File

@ -424,7 +424,7 @@ TCP_output:
mov eax, [eax + IP_SOCKET.RemoteIP] ; dest ip mov eax, [eax + IP_SOCKET.RemoteIP] ; dest ip
mov di, IP_PROTO_TCP shl 8 + 128 mov di, IP_PROTO_TCP shl 8 + 128
call IPv4_output call IPv4_output
jz .fail jz .ip_error
;----------------------------------------- ;-----------------------------------------
; Move TCP header from stack to TCP packet ; Move TCP header from stack to TCP packet
@ -527,7 +527,7 @@ TCP_output:
ret ret
.fail: .ip_error:
pop ecx pop ecx
add esp, ecx add esp, ecx
pop eax pop eax
@ -538,7 +538,7 @@ TCP_output:
call mutex_unlock call mutex_unlock
popa popa
DEBUGF 1,"TCP_output: failed\n" DEBUGF 1,"TCP_output: IP error\n"
ret ret