From e2bb5f11aa6db2d244acf124468fdb68de3aa8f7 Mon Sep 17 00:00:00 2001 From: Adam Sampson Date: Fri, 10 Aug 2018 22:40:46 +0100 Subject: [PATCH] WIP: More TCP tracing. --- src/system/tcp.275 | 26 ++++++++++++++++++++++++-- 1 file changed, 24 insertions(+), 2 deletions(-) diff --git a/src/system/tcp.275 b/src/system/tcp.275 index 2d0f83b5..f518d7c3 100755 --- a/src/system/tcp.275 +++ b/src/system/tcp.275 @@ -2097,6 +2097,7 @@ TSI02: CAMN A,XBPORT(I) ; Loop til we find it CAME B,XBHOST(I) TSI03: AOBJN I,TSI02 JUMPL I,TSI05 ; Jump if found existing connection + BUG INFO,[tsi03 no existing conn] JRST TSISQ ; Jump if no existing connection. TSI04: SKIPE XBSTAT(I) ; Found "closed" connection???? @@ -2110,6 +2111,7 @@ TSI04: SKIPE XBSTAT(I) ; Found "closed" connection???? TSI05: DPB I,[PK$TCB (R)] ; Store TCB index in packet info MOVEM J,XBNADR(I) ; Save host-table idx of addr this seg is from. HRRZ J,XBSTAT(I) ; Get connection state + BUG INFO,[tcpis conn exists, TCB index=],OCT,I,[ state=],OCT,J CAIL J,.XSTOT ; Highest possible state. BUG HALT,[TCP: Bad conn state] METER("TCP: IS all states") @@ -2131,6 +2133,7 @@ TSI05: DPB I,[PK$TCB (R)] ; Store TCB index in packet info ; end of seg is out of window. It should simply ; expand the window! LDB D,[TH$SEQ (H)] ; Get sequence number + BUG INFO,[tcpis seq number=],OCT,D JUMPG TT,TSI10 ; Jump if data present. JUMPL TT,TSIF03 ; No data. Jump if error (neg data!) @@ -2303,7 +2306,10 @@ TSI53: LDB A,[TH$ACK (H)] ; Get ACK field ; Handle ACK while in open state (also other receive-OK states) TSI54: LDB A,[TH$ACK (H)] ; Get ACK field + MOVE B,XBSNXT(I) ;XXX + BUG INFO,[tsi54 nxt (=<)],OCT,B MOVE B,XBSUNA(I) ; Need one CMPSEQ arg in AC + BUG INFO,[tsi54 ack in open state ACK=],OCT,A,[ una (=<)],OCT,B ; Test: snd.una =< seg.ack =< snd.nxt ; If seg.ack < snd.una, go to TSI60 and ignore the ACK. ; If seg.ack > snd.nxt, go to TSISAK to drop segment (ACKing) @@ -2311,6 +2317,7 @@ TSI54: LDB A,[TH$ACK (H)] ; Get ACK field ; ACK is fine. Update SND.UNA and clean up retransmit queue. TSI54X: MOVEM A,XBSUNA(I) ; Update snd.una + BUG INFO,[tsi54x ack fine] ; Must check retransmit queue slowly to find right place to flush, ; if any. @@ -2424,7 +2431,8 @@ TSI57: CAIN J,.XSOPN ; Skip other checks if state is OPEN (normal) ; Check the URG bit. The only states which get to this ; point are OPEN, FIN-WAIT-1, and FIN-WAIT-2. -TSI60: TLNN E,(TC%URG) ; Segment has urgent pointer set? +TSI60: BUG INFO,[tsi60 check urg bits=],OCT,E + TLNN E,(TC%URG) ; Segment has urgent pointer set? JRST TSI70 ; Nope, on to next step. LDB A,[TH$UP (H)] ; Get SEG.UP (urgent ptr from segment) @@ -2437,6 +2445,7 @@ TSI70: TRNE E,%TSIFL ; If segment being flushed after ACK/URG, JRST TSIF70 ; flush it now! LDB A,[PK$TDL (R)] ; Find # bytes of real data in segment + BUG INFO,[tsi70 data bytes=],OCT,A JUMPLE A,TSI80 ; If none, no text processing. TLNE E,(TC%FIN) ; Check that # bytes data == seg.len @@ -2599,30 +2608,42 @@ XSMTRS: OFFSET -. TSIF01: METER("TCP: ISeg cksm errs ") + BUG INFO,[fls cksm err] JRST TSIFL TSIF02: METER("TCP: IS zero port/addr") + BUG INFO,[fls zero port] JRST TSIFL TSIF03: METER("TCP: IS fl neg data") + BUG INFO,[fls neg data] JRST TSIFL ;TSIF10: ; Flush this later (retain til get new .METER LIST) METER("TCP: IS fls Seq # err") + BUG INFO,[fls seq # err] JRST TSIFL TSIF50: METER("TCP: IS fls Seq no ACK ") + BUG INFO,[fls seq no ack] JRST TSIFL TSIF55: METER("TCP: IS fls CLO & FIN not ACKed") + BUG INFO,[fls clo fna] JRST TSIFL TSIF56: METER("TCP: IS fls CLA & FIN not ACKed") + BUG INFO,[fls cla fna] JRST TSIFL TSIF70: METER("TCP: IS fls seqerr processed A/U/R") + BUG INFO,[fls seqerr] JRST TSISNE ; Go respond with ACK TSIF80: METER("TCP: IS fls FINchk state") + BUG INFO,[fls finchk] JRST TSIFL TSIF2A: METER("TCP: IS fls random RST") + BUG INFO,[fls random rst] JRST TSIFL TSIF2B: METER("TCP: IS fls Fresh SYN already on SYNQ") + BUG INFO,[fls fresh syn] JRST TSIFL TSIF90: METER("TCP: IS fls processed seg") + BUG INFO,[fls processed] JRST TSIFL ; Come here to flush the datagram/segment and return. @@ -2663,7 +2684,8 @@ TSOACK: MOVSI T,(TC%ACK) ; Send an ACK immediately ; (1) see if it matches any wild listens; if so, process. ; (2) see if it's OK to start up a server for it; if so, process. -TSISQ: TLNE E,(TC%RST) ; If it has RST set, +TSISQ: BUG INFO,[tsisq flags=],OCT,E + TLNE E,(TC%RST) ; If it has RST set, JRST TSIF2A ; Go drop it quietly. TLNE E,(TC%ACK) ; If ACK, can't be a valid request either JRST TSISAR ; Go send a RST in response (with SEQ=SEG.ACK)