Subversion Repositories Kolibri OS

Rev

Rev 1774 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 1774 Rev 1830
Line 12... Line 12...
12
;;          GNU GENERAL PUBLIC LICENSE                             ;;
12
;;          GNU GENERAL PUBLIC LICENSE                             ;;
13
;;             Version 2, June 1991                                ;;
13
;;             Version 2, June 1991                                ;;
14
;;                                                                 ;;
14
;;                                                                 ;;
15
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
15
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
Line 16... Line 16...
16
 
16
 
Line 17... Line 17...
17
$Revision: 1774 $
17
$Revision: 1830 $
18
 
18
 
19
;-----------------------------------------------------------------
19
;-----------------------------------------------------------------
20
;
20
;
Line 30... Line 30...
30
;       edi = ipv4 dest   address
30
;       edi = ipv4 dest   address
31
;
31
;
32
;  OUT: /
32
;  OUT: /
33
;
33
;
34
;-----------------------------------------------------------------
34
;-----------------------------------------------------------------
-
 
35
 
35
align 4
36
align 4
36
TCP_input:
37
TCP_input:
Line 37... Line 38...
37
 
38
 
38
       DEBUGF  1,"TCP_input size=%u ", ecx
39
       DEBUGF  1,"TCP_input size=%u ", ecx
Line 151... Line 152...
151
	je	.drop_not_locked
152
	je	.drop_not_locked
Line 152... Line 153...
152
 
153
 
153
;----------------
154
;----------------
Line -... Line 155...
-
 
155
; Lock the socket
-
 
156
 
-
 
157
	cmp	[ebx + SOCKET.lock], 0
154
; Lock the socket
158
	jne	.drop_not_locked     ;;; HACK ! HACK ! dirty fucking HACK !   !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
155
 
159
 
156
	add	ebx, SOCKET.lock
160
	add	ebx, SOCKET.lock
157
	DEBUGF	1,"lock: %x\n", [ebx]
161
	DEBUGF	1,"lock: %x\n", [ebx]
Line -... Line 162...
-
 
162
	call	wait_mutex
158
	call	wait_mutex
163
	sub	ebx, SOCKET.lock
Line 159... Line 164...
159
	sub	ebx, SOCKET.lock
164
 
160
 
165
 
Line 369... Line 374...
369
; update window pointers
374
; update window pointers
370
	mov	eax, [edx + TCP_segment.AckNumber]
375
	mov	eax, [edx + TCP_segment.AckNumber]
371
	mov	[ebx + TCP_SOCKET.SND_UNA], eax
376
	mov	[ebx + TCP_SOCKET.SND_UNA], eax
Line 372... Line 377...
372
 
377
 
373
; Stop retransmit timer
378
; Stop retransmit timer
Line 374... Line 379...
374
	mov	[ebx + TCP_SOCKET.timer_ack], 0
379
	mov	[ebx + TCP_SOCKET.timer_retransmission], 0
375
 
380
 
376
; Awaken waiting processes
381
; Awaken waiting processes
377
	mov	[ebx + SOCKET.lock], 0
382
	mov	[ebx + SOCKET.lock], 0
Line 644... Line 649...
644
 
649
 
645
	mov	eax, [ebx + TCP_SOCKET.RCV_NXT]
650
	mov	eax, [ebx + TCP_SOCKET.RCV_NXT]
646
	sub	eax, [edx + TCP_segment.SequenceNumber]
651
	sub	eax, [edx + TCP_segment.SequenceNumber]
Line 647... Line 652...
647
	jle	.no_duplicate
652
	jle	.no_duplicate
Line 648... Line 653...
648
 
653
 
649
	DEBUGF	1,"Uh oh.. %x bytes of duplicate data!\n", eax
654
	DEBUGF	1,"Uh oh.. %u bytes of duplicate data!\n", eax
Line 650... Line 655...
650
 
655
 
Line 667... Line 672...
667
	and	[edx + TCP_segment.Flags], not (TH_URG)
672
	and	[edx + TCP_segment.Flags], not (TH_URG)
668
	dec	eax
673
	dec	eax
669
	jz	.no_duplicate
674
	jz	.no_duplicate
670
  .no_dup_syn:
675
  .no_dup_syn:
Line 671... Line -...
671
 
-
 
672
	DEBUGF	1,"Going to drop %u out of %u bytes\n", eax, ecx
-
 
673
 
676
 
Line 674... Line 677...
674
; eax holds number of bytes to drop
677
; eax holds number of bytes to drop
Line 675... Line 678...
675
 
678
 
676
; Check for entire duplicate packet
679
; Check for entire duplicate packet
Line -... Line 680...
-
 
680
 
-
 
681
	cmp	eax, ecx
677
 
682
	jge	.duplicate
Line 678... Line 683...
678
	cmp	eax, ecx
683
 
Line 679... Line 684...
679
	jge	.duplicate
684
	DEBUGF	1,"Going to drop %u out of %u bytes\n", eax, ecx
Line 716... Line 721...
716
;----------------------------------------
721
;----------------------------------------
717
; Update statistics for duplicate packets
722
; Update statistics for duplicate packets
Line 718... Line 723...
718
 
723
 
Line 719... Line 724...
719
;;; TODO
724
;;; TODO
Line 720... Line 725...
720
 
725
 
Line 721... Line 726...
721
	jmp	.drop	       ;;; DROP the packet ??
726
	jmp	.drop_after_ack
722
 
727
 
Line 1454... Line 1459...
1454
	and	[ebx + TCP_SOCKET.t_flags], TF_ACKNOW
1459
	and	[ebx + TCP_SOCKET.t_flags], TF_ACKNOW
Line 1455... Line 1460...
1455
 
1460
 
Line 1456... Line 1461...
1456
	mov	[ebx + SOCKET.lock], 0
1461
	mov	[ebx + SOCKET.lock], 0
1457
 
1462
 
1458
	push	ebx
1463
	push	ebx
1459
	mov	eax, ebx
1464
	mov	cl, TH_ACK
Line 1460... Line 1465...
1460
	call	TCP_output
1465
	call	TCP_respond_socket
1461
	pop	ebx
1466
	pop	ebx
1462
 
1467
 
Line 1498... Line 1503...
1498
	add	esp, 4
1503
	add	esp, 4
1499
	ret
1504
	ret
Line 1500... Line 1505...
1500
 
1505
 
Line 1501... Line -...
1501
  .respond_ack:
-
 
1502
 
-
 
1503
	mov	dl, TH_RST
1506
  .respond_ack:
-
 
1507
 
1504
 
1508
	push	ebx
1505
	push	ebx
1509
	mov	cl, TH_RST
Line 1506... Line 1510...
1506
	call	TCP_respond_segment
1510
	call	TCP_respond_socket
Line 1507... Line 1511...
1507
	pop	ebx
1511
	pop	ebx
Line 1508... Line -...
1508
 
-
 
1509
	jmp	.destroy_new_socket
-
 
1510
 
1512
 
-
 
1513
	jmp	.destroy_new_socket
1511
 
1514
 
1512
  .respond_syn:
1515
 
Line 1513... Line 1516...
1513
 
1516
  .respond_syn: