net: tcp: Do not accept new data in retransmission mode

When TCP stack enters retransmission mode, the variable tracking the
amount of unacknowledged data is cleared. This prevents the stack from
detecting when TX window is full, which could lead to queueing unlimited
amount of data, effectively consuming all of the avaiable network
buffers.

Prevent this, by returning early from net_tcp_queue_data() in case TCP
stack is in retransmission mode. The socket layer will take care of
retrying just as in case the window is full.

Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
This commit is contained in:
Robert Lubos 2022-03-25 15:34:04 +01:00 committed by Carles Cufí
commit 0088aaefa0

View file

@ -2236,6 +2236,11 @@ int net_tcp_queue_data(struct net_context *context, struct net_pkt *pkt)
goto out;
}
if (conn->data_mode == TCP_DATA_MODE_RESEND) {
ret = -EAGAIN;
goto out;
}
len = net_pkt_get_len(pkt);
if (conn->send_data->buffer) {