net: tcp: Simple zero window probe implementation

When peer reports a zero length receive window, the TCP stack block any
outgoing data from being queued. In case no further ACK comes from the
peer, the whole communication could stall. Fix this by sending a simple
Zero Window Probe, when we detect a Zero Length Window.

Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
This commit is contained in:
Robert Lubos 2022-03-24 11:12:01 +01:00 committed by Carles Cufí
commit ce93fae60b

View file

@ -2193,6 +2193,10 @@ int net_tcp_queue_data(struct net_context *context, struct net_pkt *pkt)
k_mutex_lock(&conn->lock, K_FOREVER); k_mutex_lock(&conn->lock, K_FOREVER);
if (tcp_window_full(conn)) { if (tcp_window_full(conn)) {
if (conn->send_win == 0) {
tcp_out_ext(conn, ACK, NULL, conn->seq - 1);
}
/* Trigger resend if the timer is not active */ /* Trigger resend if the timer is not active */
/* TODO: use k_work_delayable for send_data_timer so we don't /* TODO: use k_work_delayable for send_data_timer so we don't
* have to directly access the internals of the legacy object. * have to directly access the internals of the legacy object.