Fixed bugs in TCP (crash when closing socket, crash when responding to segment that has no socket)

git-svn-id: svn://kolibrios.org@3270 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
hidnplayr 2013-02-24 17:12:10 +00:00
parent ac6e97fffd
commit 4fe36c5853
3 changed files with 10 additions and 10 deletions

View File

@ -639,7 +639,7 @@ TCP_process_input:
mov eax, ebx
call TCP_close
;;;TODO: update stats
jmp .drop_with_reset
jmp .drop_with_reset_no_socket
;----------------------------------------
; Remove data beyond right edge of window (700-736)
@ -770,14 +770,14 @@ TCP_process_input:
;;; TODO: update stats (tcp drops)
mov eax, ebx
call TCP_close
jmp .drop
jmp .drop_no_socket
.rst_close:
DEBUGF 1,"TCP_input: Closing with reset\n"
mov eax, ebx
call TCP_close
jmp .drop
jmp .drop_no_socket
.no_rst:
@ -1596,13 +1596,12 @@ align 4
ret
.drop_with_reset_no_socket:
DEBUGF 1,"TCP_input: Drop with reset (no socket)\n"
test [edx + TCP_header.Flags], TH_RST
jnz .drop_no_socket
;;; if its a multicast/broadcast, also drop
;;; TODO: if its a multicast/broadcast, also drop
test [edx + TCP_header.Flags], TH_ACK
jnz .respond_seg_ack

View File

@ -318,7 +318,7 @@ TCP_respond:
;-------------------------
; TCP_respond.segment:
; TCP_respond_segment:
;
; IN: edx = segment ptr (a previously received segment)
; edi = ptr to dest and src IPv4 addresses
@ -327,7 +327,7 @@ TCP_respond:
align 4
TCP_respond_segment:
DEBUGF 1,"TCP_respond_segment: frame=%x flags=%c\n", edx, cl
DEBUGF 1,"TCP_respond_segment: frame=%x flags=%x\n", edx, cl
;---------------------
; Create the IP packet
@ -336,7 +336,7 @@ TCP_respond_segment:
mov ebx, [edi + 4]
mov eax, [edi]
mov ecx, sizeof.TCP_header
mov di , IP_PROTO_TCP shl 8 + 128
mov di, IP_PROTO_TCP shl 8 + 128
call IPv4_output
jz .error
pop esi cx
@ -368,12 +368,11 @@ TCP_respond_segment:
;---------------------
; Fill in the checksum
.checksum:
lea esi, [edi - sizeof.TCP_header]
mov ecx, sizeof.TCP_header
TCP_checksum (esi - sizeof.IPv4_header + IPv4_header.DestinationAddress),\ ; FIXME
(esi - sizeof.IPv4_header + IPv4_header.SourceAddress)
mov [esi+TCP_header.Checksum], dx
mov [esi + TCP_header.Checksum], dx
;--------------------
; And send the segment

View File

@ -57,6 +57,7 @@ TCP_usrclosed:
.wait1:
mov [eax + TCP_SOCKET.t_state], TCPS_FIN_WAIT_1
; TODO: set timer?
pop ebx
ret
@ -67,6 +68,7 @@ TCP_usrclosed:
.disc:
call SOCKET_is_disconnected
; TODO: set timer?
.ret:
pop ebx
ret