Kernel version 0.9 : TCP, ACK problem solved! some additional fixes including corrected TCP payload length computation

This commit is contained in:
Rémy GIBERT 2017-03-19 22:47:54 +01:00
parent 28ac2e8a66
commit a3c4b4f1fc
12 changed files with 173 additions and 140 deletions

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -21,8 +21,8 @@ INSDRV UTHERNET.DRV 000E3A123456
#INSDRV UTHER2.AI.DRV 0008DC123456
#INSDRV LANCEGS.DRV
STARTPROC TCPIP
#STARTPROC DHCPCLNT
#STARTPROC TELNETD
STARTPROC DHCPCLNT
STARTPROC TELNETD
#STARTPROC HTTPD
#NFSMOUNT 192.168.1.5:/A2OSX /MNT/A2OSX
#CIFSMOUNT 192.168.1.5:/MSSHARE /MNT/MSSHARE

View File

@ -218,25 +218,33 @@ READBLOCK php
lda PacketPageDATA+1,x
ldy PacketPageDATA,x
and /PP.RxEvent.RxOK+PP.RxEvent.IA+PP.RxEvent.Brdcast+PP.RxEvent.Runt
beq .9
bne .1
lda RTDATA+1,x discard RxStatus
lda #ERR.DEV.NOFRAME
.9 plp
sec
rts
.1 lda RTDATA+1,x discard RxStatus
lda RTDATA,x
ldy RTDATA+1,x get RxLength
sty Size+1
lda RTDATA+1,x
sta Size+1
lda RTDATA,x
lda RTDATA,x get RxLength
sta Size
clc
adc #2
>PUSHA Size+2
tya
tay
lda Size+1
adc #0
>PUSHA
>PUSHYA
>PUSHBI 0
>SYSCALL GetMem
bcs .99
bcs .9
>STYA ZPTmpPTR
stx .8+1
@ -287,12 +295,6 @@ READBLOCK php
plp
clc
rts
.9 lda #ERR.DEV.NOFRAME
.99 plp
sec
rts
*--------------------------------------
WRITEBLOCK php
sei
@ -389,8 +391,11 @@ OPEN jsr CLOSE
lda #PP.RxCTL.LID+PP.RxCTL.RxOKA+PP.RxCTL.IA+PP.RxCTL.BroadcastA+PP.RxCTL.RuntA
sta PacketPageDATA,x
>LDYAI PP.MAC
>STYA PacketPagePTR,x
lda /PP.MAC
sta PacketPagePTR+1,x
lda #PP.MAC
sta PacketPagePTR,x
>LDYA MAC
>STYA PacketPageDATA,x
>LDYAI PP.MAC+2
@ -428,14 +433,14 @@ CLOSE ldx DEVSLOTx0
lda #PP.SelfCTL.LID+PP.SelfCTL.RESET
sta PacketPageDATA,x
ldy #0
.1 lda /PP.SelfST
lda /PP.SelfST
sta PacketPagePTR+1,x
lda #PP.SelfST
sta PacketPagePTR,x
lda PacketPageDATA+1,x
ldy #0
.1 lda PacketPageDATA+1,x
lda PacketPageDATA,x
and #PP.SelfST.InitDone

View File

@ -1,6 +1,6 @@
PR#3
PREFIX /A2OSX.SRC
LOMEM $A00
LOMEM $900
INC 1
AUTO 6
.LIST OFF
@ -361,6 +361,7 @@ DNS.EXPIRE >LDYA L.DNS.CACHE
DNS.FREE ldy #S.DNSCACHE.hNAME
lda (ZPCachePtr),y
beq .1
>SYSCALL FreeMemA
.1 lda #0
sta (ZPCachePtr)
@ -368,6 +369,7 @@ DNS.FREE ldy #S.DNSCACHE.hNAME
*--------------------------------------
DNS.POLL lda hDNSSocket1
beq .8
jsr SKT.ReadA
bcs .8
jsr DNS.DecodeMsg

View File

@ -1,6 +1,6 @@
PR#3
PREFIX /A2OSX.SRC
LOMEM $A00
LOMEM $900
INC 1
AUTO 6
.LIST OFF
@ -110,7 +110,9 @@ SKT.New.Listen sec
lda #S.SOCKET.TCP.STATUS.SYNSENT
sta (ZPPtrSKT),y
.8 ldx TmpOffset
.8 lda TmpOffset
ora #$80
tax
>LDYA ZPTmpPtr3
clc
rts
@ -120,7 +122,7 @@ SKT.New.Listen sec
.99 rts
*--------------------------------------
SKT.New.TCB >PUSHWI S.TCB
>PUSHBI S.MEM.F.INIT0
>PUSHBI 0
>SYSCALL GetMem
bcs .9
@ -130,6 +132,12 @@ SKT.New.TCB >PUSHWI S.TCB
ldy #S.SOCKET.SQ.hTCB
sta (ZPTmpPtr3),y
ldx #S.TCB.OUTUSED+1
.1 stz SKT.TCBCache,x
dex
bpl .1
lda #K.TCP.WSIZE
sta SKT.TCBCache+S.TCB.INFREE
sta SKT.TCBCache+S.TCB.OUTFREE
@ -178,7 +186,8 @@ SKT.New.TCB >PUSHWI S.TCB
* A = hSocket
* ##Out :
*\--------------------------------------
SKT.CloseA cmp #K.SKTTABLE.SIZE
SKT.CloseA and #$7f
cmp #K.SKTTABLE.SIZE
bcs .9
jsr SKT.GetA.I
@ -249,42 +258,53 @@ SKT.CloseA cmp #K.SKTTABLE.SIZE
* ##Out :
* Y,A = pS.SOCKET
*\--------------------------------------
SKT.GetA cmp #K.SKTTABLE.SIZE
bcs SKT.GetA.9
SKT.GetA jsr SKT.GetA.I
jsr SKT.GetA.I
bcs SKT.GetA.9
bcs .9
>LDYA ZPPtrSKT
rts
SKT.GetA.I pha
.9 rts
SKT.GetA.I and #$7f
cmp #K.SKTTABLE.SIZE
bcs .9
pha
lda hSocketTable
>SYSCALL GetMemPtrA
>STYA ZPPtrSKT
plx
pla
beq .8
.1 lda ZPPtrSKT
stz .1+1
lsr
ror .1+1
lsr
ror .1+1
lsr
ror .1+1
pha
lda ZPPtrSKT
clc
adc #S.SOCKET
.1 adc #$ff
sta ZPPtrSKT
bcc .2
inc ZPPtrSKT+1
.2 dex
bne .1
pla
adc ZPPtrSKT+1
sta ZPPtrSKT+1
.8 lda (ZPPtrSKT)
beq SKT.GetA.9
beq .9
clc
rts
SKT.GetA.9 lda #ERR.SKT.BAD
.9 lda #ERR.SKT.BAD
sec
rts
*/--------------------------------------
@ -651,16 +671,16 @@ SKT.AddToQueueA sta .2+1
*--------------------------------------
SKT.AckDataToSktOut
ldy #S.TCP.ACK.NUMBER+3 Get new ACK number from FrameIn...
ldx #3 Substract old SEQ from socket
ldx #3 Substract old ACK from socket
sec
.1 lda (ZPFrameInPtr),y
pha
sbc SKT.TCBCache+S.TCB.SEQNUM,x
sbc SKT.TCBCache+S.TCB.ACKNUM,x
sta TmpDWord,x
pla
sta SKT.TCBCache+S.TCB.SEQNUM,x
sta SKT.TCBCache+S.TCB.ACKNUM,x
dey
dex
bpl .1
@ -701,8 +721,6 @@ SKT.AckDataToSktOut
* Dst : hInMem/INHEAD
*--------------------------------------
SKT.AddDataToSktIn
jsr SKT.GetTCB
ldx SKT.TCBCache+S.TCB.INFREE
cpx ZPDataInLen
lda SKT.TCBCache+S.TCB.INFREE+1
@ -770,6 +788,7 @@ SKT.AddDataToSktIn
sec
sbc ZPDataInLen
sta SKT.TCBCache+S.TCB.INFREE
lda SKT.TCBCache+S.TCB.INFREE+1
sbc ZPDataInLen+1
sta SKT.TCBCache+S.TCB.INFREE+1
@ -778,6 +797,7 @@ SKT.AddDataToSktIn
clc
adc ZPDataInLen
sta SKT.TCBCache+S.TCB.INUSED
lda SKT.TCBCache+S.TCB.INUSED+1
adc ZPDataInLen+1
sta SKT.TCBCache+S.TCB.INUSED+1
@ -938,31 +958,34 @@ SKT.GetDataFromSktOut
.5 lda SKT.TCBCache+S.TCB.OUTFREE
clc
adc ZPDataInLen
adc ZPDataOutLen
sta SKT.TCBCache+S.TCB.OUTFREE
lda SKT.TCBCache+S.TCB.OUTFREE+1
adc ZPDataInLen+1
adc ZPDataOutLen+1
sta SKT.TCBCache+S.TCB.OUTFREE+1
lda SKT.TCBCache+S.TCB.OUTUSED
sec
sbc ZPDataInLen
sbc ZPDataOutLen
sta SKT.TCBCache+S.TCB.OUTUSED
lda SKT.TCBCache+S.TCB.OUTUSED+1
sbc ZPDataInLen+1
sbc ZPDataOutLen+1
sta SKT.TCBCache+S.TCB.OUTUSED+1
lda SKT.TCBCache+S.TCB.SEQNUM
lda SKT.TCBCache+S.TCB.SEQNUM+3
clc
adc ZPDataInLen
sta SKT.TCBCache+S.TCB.SEQNUM
lda SKT.TCBCache+S.TCB.SEQNUM+1
adc ZPDataInLen+1
sta SKT.TCBCache+S.TCB.SEQNUM+1
adc ZPDataOutLen
sta SKT.TCBCache+S.TCB.SEQNUM+3
lda SKT.TCBCache+S.TCB.SEQNUM+2
adc ZPDataOutLen+1
sta SKT.TCBCache+S.TCB.SEQNUM+2
bcc .8
inc SKT.TCBCache+S.TCB.SEQNUM+2
inc SKT.TCBCache+S.TCB.SEQNUM+1
bne .8
inc SKT.TCBCache+S.TCB.SEQNUM+3
inc SKT.TCBCache+S.TCB.SEQNUM
.8 clc
rts
@ -971,13 +994,18 @@ SKT.GetDataFromSktOut
* In:
* Src : hInMem/INTAIL
* Dst : ZPDataOutPtr/ZPDataOutLen
* CS : Text Mode
* CC : Binary Mode
* bTextMode
* Out:
* Y,A = bytes read
*--------------------------------------
SKT.GetDataFromSktIn
ldy #S.SOCKET.SQ.hInMem
lda SKT.TCBCache+S.TCB.INUSED
ora SKT.TCBCache+S.TCB.INUSED+1
bne .10
sec
rts NO DATA
.10 ldy #S.SOCKET.SQ.hInMem
lda (ZPPtrSKT),y
>SYSCALL GetMemPtrA
>STYA ZPTmpPtr1 Make ZPTmpPtr1=buffer base
@ -1089,19 +1117,19 @@ SKT.GetDataFromSktIn
sbc ZPTmpPtr3+1
sta SKT.TCBCache+S.TCB.INUSED+1
lda SKT.TCBCache+S.TCB.ACKNUM
lda SKT.TCBCache+S.TCB.ACKNUM+3
clc
adc ZPTmpPtr3
sta SKT.TCBCache+S.TCB.ACKNUM
sta SKT.TCBCache+S.TCB.ACKNUM+3
lda SKT.TCBCache+S.TCB.ACKNUM+1
lda SKT.TCBCache+S.TCB.ACKNUM+2
adc ZPTmpPtr3+1
sta SKT.TCBCache+S.TCB.ACKNUM+1
sta SKT.TCBCache+S.TCB.ACKNUM+2
bcc .80
inc SKT.TCBCache+S.TCB.ACKNUM+2
inc SKT.TCBCache+S.TCB.ACKNUM+1
bne .80
inc SKT.TCBCache+S.TCB.ACKNUM+3
inc SKT.TCBCache+S.TCB.ACKNUM
.80 jsr SKT.StoreTCB

View File

@ -1,6 +1,6 @@
PR#3
PREFIX /A2OSX.SRC
LOMEM $A00
LOMEM $900
INC 1
AUTO 6
.LIST OFF
@ -232,7 +232,7 @@ TCP.IN.JMP.ESTBLSH
lda ZPDataInLen Incoming Data in this frame ?
ora ZPDataInLen+1
beq .2 No data, ...
jsr SKT.AddDataToSktIn yes, queue data if there is room for....
.2 ldy #S.TCP.OPTIONS
@ -292,45 +292,50 @@ TCP.IN.JMP.CLOSED
rts
*--------------------------------------
TCP.IN.SetDataInPtrAndLen
ldy #S.IP.TOTAL.LENGTH+1
lda (ZPFrameInPtr),y
sec
sbc #S.IP-S.ETH
sta ZPDataInLen
dey
lda (ZPFrameInPtr),y
sbc /S.IP-S.ETH
sta ZPDataInLen+1
ldy #S.TCP.DATAOFFSET
lda (ZPFrameInPtr),y
and #$F0 Get TCP Header len in DWORD
lsr
lsr
* clc
adc #S.IP-2
sta TmpOffset
lda #0
adc /S.IP-2
sta TmpOffset+1 TmpOffset=Data Offset in Frame
lda ZPFrameInLen
lda ZPDataInLen
sec
sbc TmpOffset
sta ZPDataInLen
lda ZPFrameInLen+1
sbc TmpOffset+1
sta ZPDataInLen+1
lda TmpOffset
clc
adc #2
sta TmpOffset
bcc .1
inc TmpOffset+1
clc
bcs .1
dec ZPDataInLen+1
.1 lda ZPFrameInPtr
adc TmpOffset
clc
adc #S.IP
sta ZPDataInPtr
lda ZPFrameInPtr+1
adc #0
adc /S.IP
sta ZPDataInPtr+1
rts
lda ZPDataInPtr
clc
adc TmpOffset
sta ZPDataInPtr
bcc .2
inc ZPDataInPtr+1
.2 rts
*--------------------------------------
TCP.OUT.SYN >LDYAI 0
jsr TCP.NewFrame
@ -406,7 +411,7 @@ TCP.OUT.I lda SKT.TCBCache+S.TCB.OUTUSED+1
ldy SKT.TCBCache+S.TCB.OUTUSED
bne .1
tax
bne .1 Y,A=0 : nothing to send

View File

@ -167,7 +167,7 @@ POLL ldx #DEVMGR.READBLOCK
cpx /S.ETH.ETHERTYPE.IP
bne .9
jsr DumpFrame
* jsr DumpFrame
jmp IP.IN

View File

@ -114,11 +114,6 @@ CS.RUN >PUSHW L.Socket
ldy #hSocket
sta (pData),y
ldy #bSocketClose
lda #$ff
sta (pData),y
>LDYA L.MSG.CFG1
>SYSCALL CPrintFYA
@ -243,13 +238,10 @@ CS.DOEVENT lda (pEvent)
.9 sec do not discard TIMER event
rts
*--------------------------------------
CS.QUIT ldy #bSocketClose
CS.QUIT ldy #hSocket
lda (pData),y
beq .1
ldy #hSocket
lda (pData),y
>LIBCALL hLIBTCPIP,LIBTCPIP.SKT.CloseA
.1 lda hLIBTCPIP
@ -504,7 +496,6 @@ DHCP.REQ.LEN .EQ *-DHCP.REQ
*--------------------------------------
DS.START
TimeOut .BS 1
bSocketClose .BS 1
hSocket .BS 1
hFrame .BS 1
DS.END

View File

@ -20,25 +20,20 @@ ERR.Print >PUSHA Save EC for PrintF
cpy #ERR.Count
bne .1
.2 sty .3+1
lda L.ERR.Messages
.2 lda L.ERR.Messages
sta ZPPTR1
lda L.ERR.Messages+1
sta ZPPTR1+1
ldy #0
.3 dey
bmi .8
.3 cpy #$ff Self Modified
beq .8
lda (ZPPTR1)
sec
adc ZPPTR1
sta ZPPTR1
bcc .4
bcc .3
inc ZPPTR1+1
.4 iny
bra .3
.8 >PUSHW ZPPTR1

View File

@ -106,24 +106,7 @@ CS.RUN.INIT ldx #3
jsr CS.RUN.SERVER
bcs CS.RUN.ERR
ldy #SktIndex
lda (pData),y
tay
lda (pData),y hSockets
beq .3
jsr CS.RUN.CLIENT
.3 ldy #SktIndex
lda (pData),y
inc
cmp #CONN.MAX
bne .4
lda #0
.4 sta (pData),y
bra .2
.9 >LDYA L.MSG.SKTERR
@ -161,6 +144,7 @@ CS.RUN.SERVER ldy #hSrvSocket
.2 pla
sta (pData),y
sta .4+1
>LIBCALL hLIBTCPIP,LIBTCPIP.SKT.GetA
>STYA ZPSktPtr
@ -173,16 +157,29 @@ CS.RUN.SERVER ldy #hSrvSocket
dex
bpl .3
.4 lda #$ff
>PUSHA
>LDYA L.MSG.INCOMING
>SYSCALL CPrintFYA
.8 clc
.9 rts
*--------------------------------------
CS.RUN.CLIENT sta .1+1 hSocket
CS.RUN.CLIENT ldy #SktIndex
lda (pData),y
tay
lda (pData),y hSockets
beq .8
sta .1+1 hSocket
>LIBCALL hLIBTCPIP,LIBTCPIP.SKT.GetCA
bcs .8
sta .2+1
bcc .10
tax
beq .8 NO DATA
.10 sta .2+1
>PUSHA
>LDYA L.MSG.BYTE
@ -196,7 +193,16 @@ CS.RUN.CLIENT sta .1+1 hSocket
* >LIBCALL hLIBTCPIP,LIBTCPIP.SKT.PutC
.8 clc
.8 ldy #SktIndex
lda (pData),y
inc
cmp #CONN.MAX
bne .81
lda #0
.81 sta (pData),y
clc
rts
*--------------------------------------
CS.DOEVENT sec
@ -220,9 +226,10 @@ CS.QUIT ldx #CONN.MAX
ldy #hSrvSocket
lda (pData),y
beq .3
>LIBCALL hLIBTCPIP,LIBTCPIP.SKT.CLOSEA
lda hLIBTCPIP
.3 lda hLIBTCPIP
>SYSCALL UnloadLibA
clc
rts
@ -247,7 +254,7 @@ MSG.INITOK >CSTR "TELNETD:Init Ok, Listening.\r\n"
MSG.TCPIPERR >CSTR "TELNETD:TCP/IP Not initialized properly\r\n"
MSG.SKTERR >CSTR "TELNETD:Listen Error\r\n"
MSG.ABORT >CSTR "TELNETD:User Aborted\r\n"
MSG.INCOMING >CSTR "TELNETD:Incoming Connection From : %d.%d.%d.%d\r\n"
MSG.INCOMING >CSTR "TELNETD:Incoming Connection [SKT=%h] From : %d.%d.%d.%d\r\n"
MSG.BYTE >CSTR "[%h]"
hLIBTCPIP .BS 1
*--------------------------------------