From 977528bad7442f8f2ac1c1149f3f0386e478a73b Mon Sep 17 00:00:00 2001 From: Fu Siyuan Date: Tue, 12 Jul 2016 09:47:58 +0800 Subject: [PATCH] MdeModulePkg: Fix bug in TCP which not sending out ACK in certain circumstance. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Consider the situation as shown in below chart. The last ACK message has acknowledged the Tcb->RcvWl2, and all the segments until Tcb->RcvNxt have been received by TCP driver. The Tcb->RcvNxt is not acknowledged due to the delayed ACK. In this case an incoming segment (Seg->Seq, Seg->End) should not be accepted by TCP driver, and an immediate ACK is required. Current TcpSeqAcceptable() thought it’s an acceptable segment incorrectly, it continues the TcpInput() process instead of sending out an ACK and droping the segment immediately. Tcb->RcvWl2 Tcb->RcvNxt Tcb->RcvWl2 + Tcb->RcvWnd Seg->Seq Seg->End | | | | | | | ---+-----+---------------+-------------+--------------------------+----------- <----Acceptable Range--- --> Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Fu Siyuan Reviewed-By: Eugene Cohen Reviewed-By: Wu Jiaxin Reviewed-By: Ye Ting --- MdeModulePkg/Universal/Network/Tcp4Dxe/Tcp4Input.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/MdeModulePkg/Universal/Network/Tcp4Dxe/Tcp4Input.c b/MdeModulePkg/Universal/Network/Tcp4Dxe/Tcp4Input.c index 11936ad7f1..b7f329be7a 100644 --- a/MdeModulePkg/Universal/Network/Tcp4Dxe/Tcp4Input.c +++ b/MdeModulePkg/Universal/Network/Tcp4Dxe/Tcp4Input.c @@ -32,7 +32,7 @@ TcpSeqAcceptable ( IN TCP_SEG *Seg ) { - return (TCP_SEQ_LEQ (Tcb->RcvWl2, Seg->End) && + return (TCP_SEQ_LEQ (Tcb->RcvNxt, Seg->End) && TCP_SEQ_LT (Seg->Seq, Tcb->RcvWl2 + Tcb->RcvWnd)); }