Index: eth_drv/arp.inc
===================================================================
--- eth_drv/arp.inc	(revision 669)
+++ eth_drv/arp.inc	(working copy)
@@ -1,3 +1,4 @@
+$Revision$
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 ;;                                                              ;;
 ;; Copyright (C) KolibriOS team 2004-2007. All rights reserved. ;;
@@ -20,9 +21,6 @@
 ;;                                                              ;;
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 
-$Revision$
-
-
 ARP_NO_ENTRY                equ  0
 ARP_VALID_MAPPING           equ  1
 ARP_AWAITING_RESPONSE       equ  2
Index: eth_drv/drivers/3c59x.inc
===================================================================
--- eth_drv/drivers/3c59x.inc	(revision 669)
+++ eth_drv/drivers/3c59x.inc	(working copy)
@@ -1,3 +1,4 @@
+$Revision$
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 ;;                                                              ;;
 ;; Copyright (C) KolibriOS team 2004-2007. All rights reserved. ;;
@@ -5,9 +6,6 @@
 ;;                                                              ;;
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 
-$Revision$
-
-
 ;; Copyright (c) 2004, Endre Kozma <endre.kozma@axelero.hu>
 ;; All rights reserved.
 ;;
Index: eth_drv/drivers/i8255x.inc
===================================================================
--- eth_drv/drivers/i8255x.inc	(revision 669)
+++ eth_drv/drivers/i8255x.inc	(working copy)
@@ -1,3 +1,4 @@
+$Revision$
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 ;;                                                                 ;;
 ;; Copyright (C) KolibriOS team 2004-2007. All rights reserved.    ;;
@@ -24,9 +25,7 @@
 ;;                                                                 ;;
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 
-$Revision$
 
-
 ;********************************************************************
 ;   Interface
 ;      I8255x_reset
Index: eth_drv/drivers/pcnet32.inc
===================================================================
--- eth_drv/drivers/pcnet32.inc	(revision 669)
+++ eth_drv/drivers/pcnet32.inc	(working copy)
@@ -1,3 +1,4 @@
+$Revision$
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 ;;                                                                  ;;
 ;; Copyright (C) KolibriOS team 2004-2007. All rights reserved.     ;;
@@ -21,10 +22,6 @@
 ;;  See file COPYING for details                                    ;;
 ;;                                                                  ;;
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
-
-$Revision$
-
-
 ;macro PutStr X
 ;{
 ; local .__xyz1
Index: eth_drv/drivers/rtl8029.inc
===================================================================
--- eth_drv/drivers/rtl8029.inc	(revision 669)
+++ eth_drv/drivers/rtl8029.inc	(working copy)
@@ -1,3 +1,4 @@
+$Revision$
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 ;;                                                                 ;;
 ;; Copyright (C) KolibriOS team 2004-2007. All rights reserved.    ;;
@@ -26,7 +27,6 @@
 ;;                                                                 ;;
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 
-$Revision$
 
 
 ;********************************************************************
Index: eth_drv/drivers/rtl8139.inc
===================================================================
--- eth_drv/drivers/rtl8139.inc	(revision 669)
+++ eth_drv/drivers/rtl8139.inc	(working copy)
@@ -1,3 +1,4 @@
+$Revision$
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 ;;                                                                 ;;
 ;; Copyright (C) KolibriOS team 2004-2007. All rights reserved.    ;;
@@ -29,10 +30,6 @@
 ;;  10.01.2007 Bugfix for l8139_transmit from Paolo Franchetti     ;;
 ;;                                                                 ;;
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
-
-$Revision$
-
-
 	ETH_ALEN	       equ 6
 	ETH_HLEN	       equ (2 * ETH_ALEN + 2)
 	ETH_ZLEN	       equ 60 ; 60 + 4bytes auto payload for
Index: eth_drv/drivers/rtl8169.inc
===================================================================
--- eth_drv/drivers/rtl8169.inc	(revision 669)
+++ eth_drv/drivers/rtl8169.inc	(working copy)
@@ -1,3 +1,4 @@
+$Revision$
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 ;;                                                                 ;;
 ;; Copyright (C) KolibriOS team 2004-2007. All rights reserved.    ;;
@@ -26,9 +27,6 @@
 ;;                                                                 ;;
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 
-$Revision$
-
-
 	ETH_ALEN	       equ 6
 	ETH_HLEN	       equ (2 * ETH_ALEN + 2)
 	ETH_ZLEN	       equ 60 ; 60 + 4bytes auto payload for
Index: eth_drv/drivers/sis900.inc
===================================================================
--- eth_drv/drivers/sis900.inc	(revision 669)
+++ eth_drv/drivers/sis900.inc	(working copy)
@@ -1,3 +1,4 @@
+$Revision$
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 ;;                                                                    ;;
 ;; Copyright (C) KolibriOS team 2004-2007. All rights reserved.       ;;
@@ -24,10 +25,6 @@
 ;;    Revision Look up table and SIS635 Mac Address by Jarek Pelczar  ;;
 ;;                                                                    ;;
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
-
-$Revision$
-
-
 ;********************************************************************
 ;   Interface
 ;      SIS900_reset
Index: eth_drv/ethernet.inc
===================================================================
--- eth_drv/ethernet.inc	(revision 669)
+++ eth_drv/ethernet.inc	(working copy)
@@ -1,3 +1,4 @@
+$Revision$
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 ;;                                                                 ;;
 ;; Copyright (C) KolibriOS team 2004-2007. All rights reserved.    ;;
@@ -32,9 +33,6 @@
 ;;                                                                 ;;
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 
-$Revision$
-
-
 ;********************************************************************
 ;   Interface
 ;      ethernet_driver   called by stack_handler in stack.inc
Index: eth_drv/pci.inc
===================================================================
--- eth_drv/pci.inc	(revision 669)
+++ eth_drv/pci.inc	(working copy)
@@ -1,3 +1,4 @@
+$Revision$
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 ;;                                                              ;;
 ;; Copyright (C) KolibriOS team 2004-2007. All rights reserved. ;;
@@ -5,9 +6,6 @@
 ;;                                                              ;;
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 
-$Revision$
-
-
 ;***************************************************************************
 ;
 ;  PCI CODE FOLLOWS
Index: icmp.inc
===================================================================
--- icmp.inc	(revision 669)
+++ icmp.inc	(working copy)
@@ -1,3 +1,4 @@
+$Revision$
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 ;;                                                              ;;
 ;; Copyright (C) KolibriOS team 2004-2007. All rights reserved. ;;
@@ -20,9 +21,7 @@
 ;;	This implemetation of ICMP proto supports message of ECHO type.
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 
-$Revision$
 
-
 struc ICMP_PACKET
 {  .Type            db   ?  ;+00
    .Code            db   ?  ;+01
Index: ip.inc
===================================================================
--- ip.inc	(revision 669)
+++ ip.inc	(working copy)
@@ -1,3 +1,4 @@
+$Revision$
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 ;;                                                                 ;;
 ;;  IP.INC                                                         ;;
@@ -12,9 +13,6 @@
 ;;                                                                 ;;
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 
-$Revision$
-
-
 ; IP underlying protocols numbers
 PROTOCOL_ICMP     equ      1
 PROTOCOL_TCP      equ      6
Index: queue.inc
===================================================================
--- queue.inc	(revision 669)
+++ queue.inc	(working copy)
@@ -1,3 +1,4 @@
+$Revision$
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 ;;                                                              ;;
 ;; Copyright (C) KolibriOS team 2004-2007. All rights reserved. ;;
@@ -16,9 +17,7 @@
 ;;                                                              ;;
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 
-$Revision$
 
-
 ;*******************************************************************
 ;   Interface
 ;
Index: socket.inc
===================================================================
--- socket.inc	(revision 669)
+++ socket.inc	(working copy)
@@ -1,3 +1,4 @@
+$Revision$
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 ;;                                                              ;;
 ;; Copyright (C) KolibriOS team 2004-2007. All rights reserved. ;;
@@ -29,9 +30,6 @@
 ;;                                                              ;;
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 
-$Revision$
-
-
 ;
 ;  Socket Descriptor + Buffer
 ;
@@ -112,6 +110,12 @@
   SOCKET SOCKET
 end virtual
 
+;LV
+;uglobal
+; isn: dd 1     ;Initial Sequence Number, 1 - BSD like
+;endg
+;/LV
+
 ; simple macro calcing real memory address of SOCKET struct by socket's
 macro	Index2RealAddr reg
 {
@@ -275,6 +279,28 @@
     mov     [eax + SOCKET.LocalIP], ebx
     mov     [eax + SOCKET.RemoteIP], edx
     mov     [eax + SOCKET.rxDataCount], dword 0
+    ;
+    ; LV
+    ; get ISN
+    ; RFC 793
+    mov     ebx, [timer_ticks]
+    shl     ebx, 11           ;x2048
+    ;Convert to INET format
+    mov     ecx, ebx
+    shr     ecx, 16
+    ; Fill ISS
+    mov     byte [eax + SOCKET.ISS], ch
+    mov     byte [eax + SOCKET.ISS+1], cl
+    mov     byte [eax + SOCKET.ISS+2], bh
+    mov     byte [eax + SOCKET.ISS+3], bl
+    ; Fill SND_NXT
+    mov     byte [eax + SOCKET.SND_NXT], ch
+    mov     byte [eax + SOCKET.SND_NXT+1], cl
+    mov     byte [eax + SOCKET.SND_NXT+2], bh
+    mov     byte [eax + SOCKET.SND_NXT+3], bl
+    ;
+    ; /LV
+    
 
     ; Now fill in TCB state
     mov     ebx, TCB_LISTEN
Index: stack.inc
===================================================================
--- stack.inc	(revision 669)
+++ stack.inc	(working copy)
@@ -1,3 +1,4 @@
+$Revision$
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 ;;                                                              ;;
 ;; Copyright (C) KolibriOS team 2004-2007. All rights reserved. ;;
@@ -21,7 +22,6 @@
 ;;                                                              ;;
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 
-$Revision$
 
 
 ;*******************************************************************
Index: tcp.inc
===================================================================
--- tcp.inc	(revision 669)
+++ tcp.inc	(working copy)
@@ -1,3 +1,4 @@
+$Revision$
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 ;;                                                              ;;
 ;; Copyright (C) KolibriOS team 2004-2007. All rights reserved. ;;
@@ -7,7 +8,7 @@
 ;;                                                              ;;
 ;;  TCP Processes for Menuet OS  TCP/IP stack                   ;;
 ;;                                                              ;;
-;;  Version 0.6  4th July 2004                                  ;;
+;;  Version 0.6a  29th October 2007                             ;;
 ;;                                                              ;;
 ;;  Copyright 2002 Mike Hibbett, mikeh@oceanfree.net            ;;
 ;;                                                              ;;
@@ -15,11 +16,20 @@
 ;;  v0.6 : Added reset handling in the established state        ;;
 ;;         Added a timer per socket to allow delays when        ;;
 ;;         rx window gets below 1KB                             ;;
+;;                                                              ;;
+;;  v0.6a : Добавлена зависимость ISN от времени, MSS в         ;;
+;;          SYN пакете, идентификатор IP пакета изменяется (LV) ;;
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 
-$Revision$
+; LV
+; ╤ўхЄўшъ - шфхэЄшЇшърЄюЁ IP яръхЄр
+uglobal
+   ip_id: dw 0
+endg
+; Maximal segment size
+MSS		   equ        768 - 40
+; /LV
 
-
 ; TCP TCB states
 TCB_LISTEN         equ        1
 TCB_SYN_SENT       equ        2
@@ -467,14 +477,25 @@
     add     eax, 20 + 20           ; add IP header and TCP header lengths
     mov     [edx + 2], ah
     mov     [edx + 3], al
-    xor     al, al
-    mov     [edx + 4], al
+	
+; LV
+    ;xor     al, al
+	inc     word [ip_id]
+	mov     ax, [ip_id]
+;/LV	
+	
+    mov     [edx + 4], ah
     mov     [edx + 5], al
+	
     mov     al, 0x40
     mov     [edx + 6], al
     xor     al, al
     mov     [edx + 7], al
-    mov     al, 0x20
+    ;
+    ;   TTL = 32 ????
+    ;        vvvvvvvv
+    ;mov     al, 0x20
+    mov     al, 0x40
     mov     [edx + 8], al
     mov     al, 6                         ; TCP protocol
     mov     [edx + 9], al
@@ -511,6 +532,57 @@
     mov     ax, 0
     mov     [edx + 20 + 18], ax
 
+    ;LV
+    ;  Некоторые серверы требуют опциональное поле mss
+    ;  в пакете с флагом SYN
+    ;
+    mov     al, [edx + 33]
+    test    al, 02h              ;SYN flag
+    jz      btp_not_syn
+
+    ; SYN Flag set
+    ; data offset ( 0x60 )
+    mov     al, 0x60
+    mov     [edx + 20 + 12], al
+
+    ; скорректировать размер в заголовке IP 
+    mov     ah, [edx + 2]
+    mov     al, [edx + 3]
+
+    add     ax, 4         ; + option MSS size
+
+    mov     [edx + 2], ah
+    mov     [edx + 3], al
+    
+
+    ; MSS Option
+
+    mov     al, 0x02             ;Type MSS
+    mov     [edx + 20 + 20], al
+
+    mov     al, 0x04             ;Length Option
+    mov     [edx + 20 + 21], al
+
+    mov     ax, MSS
+    mov     [edx + 20 + 22], ah  
+    mov     [edx + 20 + 23], al
+
+
+    pop     ecx                  ; count of bytes to send
+    mov     ebx, ecx            ; need the length later
+
+    cmp     ebx, 0
+    jz      btp_001
+
+    mov     edi, edx
+    add     edi, 44
+    cld
+    rep     movsb               ; copy the data across
+    jmp     btp_001
+
+btp_not_syn:
+    ;/LV
+
     ; data offset ( 0x50 )
     mov     al, 0x50
     mov     [edx + 20 + 12], al
@@ -536,7 +608,15 @@
     mov     [pseudoHeader+4], eax
     mov     ax, 0x0600            ; 0 + protocol
     mov     [pseudoHeader+8], ax
-    add     ebx, 20
+
+    ;LV
+    movzx   eax, byte [edx + 20 + 12]  ; TCP header size
+    shr     eax, 4
+    shl     eax, 2   ;x 4
+    
+    ;add     ebx, 20
+    add     ebx, eax
+    ;/LV
     mov     eax, ebx
     mov     [pseudoHeader+10], ah
     mov     [pseudoHeader+11], al
@@ -544,6 +624,7 @@
     mov     eax, pseudoHeader
     mov     [checkAdd1], eax
     mov     [checkSize1], word 12
+
     mov     eax, edx
     add     eax, 20
     mov     [checkAdd2], eax
Index: udp.inc
===================================================================
--- udp.inc	(revision 669)
+++ udp.inc	(working copy)
@@ -1,3 +1,4 @@
+$Revision$
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 ;;                                                              ;;
 ;; Copyright (C) KolibriOS team 2004-2007. All rights reserved. ;;
@@ -20,9 +21,7 @@
 ;;                                                              ;;
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 
-$Revision$
 
-
 ;*******************************************************************
 ;   Interface
 ;
