瀏覽代碼

[tcp] Update window even if ACK does not acknowledge new data

iPXE currently ignores ACKs which do not acknowledge any new data.
(In particular, it does not stop the retransmission timer; this is
done to prevent an immediate retransmission if a duplicate ACK is
received while the transmit queue is non-empty.)

If a peer provides a window size of zero and later sends a duplicate
ACK to update the window size, this update will therefore be ignored
and iPXE will never be able to transmit data.

Fix by updating the window size even for ACKs which do not acknowledge
new data.

Reported-by: Wissam Shoukair <wissams@mellanox.com>
Signed-off-by: Michael Brown <mcb30@ipxe.org>
tags/v1.20.1
Michael Brown 10 年之前
父節點
當前提交
859664ea2a
共有 1 個檔案被更改,包括 4 行新增2 行删除
  1. 4
    2
      src/net/tcp.c

+ 4
- 2
src/net/tcp.c 查看文件

@@ -890,6 +890,9 @@ static int tcp_rx_ack ( struct tcp_connection *tcp, uint32_t ack,
890 890
 		}
891 891
 	}
892 892
 
893
+	/* Update window size */
894
+	tcp->snd_win = win;
895
+
893 896
 	/* Ignore ACKs that don't actually acknowledge any new data.
894 897
 	 * (In particular, do not stop the retransmission timer; this
895 898
 	 * avoids creating a sorceror's apprentice syndrome when a
@@ -911,10 +914,9 @@ static int tcp_rx_ack ( struct tcp_connection *tcp, uint32_t ack,
911 914
 		pending_put ( &tcp->pending_flags );
912 915
 	}
913 916
 
914
-	/* Update SEQ and sent counters, and window size */
917
+	/* Update SEQ and sent counters */
915 918
 	tcp->snd_seq = ack;
916 919
 	tcp->snd_sent = 0;
917
-	tcp->snd_win = win;
918 920
 
919 921
 	/* Remove any acknowledged data from transmit queue */
920 922
 	tcp_process_tx_queue ( tcp, len, NULL, 1 );

Loading…
取消
儲存