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
ARP_input:
DEBUGF 1,"ARP_Handler - start\n"
DEBUGF 1,"ARP_input - start\n"
cmp ecx, sizeof.ARP_header
jb .exit
@ -172,7 +172,7 @@ ARP_input:
cmp [edx + ARP_header.Opcode], ARP_REP_OPCODE
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
mov ecx, [NumARP]
@ -192,12 +192,12 @@ ARP_input:
jmp .exit
.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
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.TTL], ARP_ENTRY_TTL
@ -262,7 +262,7 @@ ARP_input:
; mov ax , ETHER_ARP
; stosw
DEBUGF 1,"ARP_Handler - Sending reply \n"
DEBUGF 1,"ARP_input - Sending reply \n"
call [ebx + NET_DEVICE.transmit]
ret
@ -271,7 +271,7 @@ ARP_input:
call kernel_free
add esp, 4 ; pop (balance stack)
DEBUGF 1,"ARP_Handler - exiting\n"
DEBUGF 1,"ARP_input - exiting\n"
ret
@ -447,7 +447,10 @@ ARP_del_entry:
align 4
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
je .broadcast

View File

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

View File

@ -187,8 +187,6 @@ TCP_input:
pop [eax + TCP_SOCKET.LocalPort]
mov [eax + TCP_SOCKET.t_state], TCPS_LISTEN
; mov [ebx + SOCKET.lock], 0
mov ebx, eax
jmp .LISTEN
@ -462,7 +460,7 @@ TCP_input:
; Passive Open
align 4
.LISTEN:
.LISTEN:
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
push dword [edi + 4] ; Ipv4 destination addres
push dword [edi] ; Ipv4 source addres
pop [ebx + IP_SOCKET.RemoteIP]
push [edx + TCP_header.SourcePort]

View File

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