net: tcp: Correctly determine when the TCP transmit window is full
In the stack both unacked_len and send_data_total track the amount of data for retransmission. send_data_total actually accounts the total bytes in the buffer, where unacked_len is used to control the retransmission progress. Using unacked_len is sometimes reset to 0, this can lead to more data being allowd in the send_data buffer. In worse case this can cause depletion of the net buffers, causing a stall and crash of the connection. The value send_data_total actually accounts the total amount of data in the send_data buffer, so it is the proper value to used in the tcp_window_full function. Signed-off-by: Sjors Hettinga <s.a.hettinga@gmail.com>
This commit is contained in:
parent
bc2f83f11c
commit
c668199b5d
|
@ -978,7 +978,7 @@ static int tcp_pkt_peek(struct net_pkt *to, struct net_pkt *from, size_t pos,
|
|||
|
||||
static bool tcp_window_full(struct tcp *conn)
|
||||
{
|
||||
bool window_full = !(conn->unacked_len < conn->send_win);
|
||||
bool window_full = (conn->send_data_total >= conn->send_win);
|
||||
|
||||
NET_DBG("conn: %p window_full=%hu", conn, window_full);
|
||||
|
||||
|
|
Loading…
Reference in a new issue