summaryrefslogtreecommitdiffstats
path: root/src/net/tcp.c
diff options
context:
space:
mode:
authorMichael Brown2014-03-05 18:30:06 +0100
committerMichael Brown2014-03-07 18:30:01 +0100
commit859664ea2a9201332da5320fe38081365c0f032a (patch)
treec619008e347edb79de3acd409933151e67f516d2 /src/net/tcp.c
parent[netdevice] Mark devices as open before calling open() method (diff)
downloadipxe-859664ea2a9201332da5320fe38081365c0f032a.tar.gz
ipxe-859664ea2a9201332da5320fe38081365c0f032a.tar.xz
ipxe-859664ea2a9201332da5320fe38081365c0f032a.zip
[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>
Diffstat (limited to 'src/net/tcp.c')
-rw-r--r--src/net/tcp.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/net/tcp.c b/src/net/tcp.c
index 548bd4d9..3fbcfd0c 100644
--- a/src/net/tcp.c
+++ b/src/net/tcp.c
@@ -890,6 +890,9 @@ static int tcp_rx_ack ( struct tcp_connection *tcp, uint32_t ack,
}
}
+ /* Update window size */
+ tcp->snd_win = win;
+
/* Ignore ACKs that don't actually acknowledge any new data.
* (In particular, do not stop the retransmission timer; this
* 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,
pending_put ( &tcp->pending_flags );
}
- /* Update SEQ and sent counters, and window size */
+ /* Update SEQ and sent counters */
tcp->snd_seq = ack;
tcp->snd_sent = 0;
- tcp->snd_win = win;
/* Remove any acknowledged data from transmit queue */
tcp_process_tx_queue ( tcp, len, NULL, 1 );