net: tcp: Allow to acknowledge zero-length packets

Peer may send a zero-length keepalive message, probing the recv window
size - TCP stack should still reply for such packets, otherwise
connection will stall.

Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
This commit is contained in:
Robert Lubos 2022-02-18 16:57:04 +01:00 committed by Marti Bolivar
commit c25cd5a894

View file

@ -1671,6 +1671,10 @@ static void tcp_queue_recv_data(struct tcp *conn, struct net_pkt *pkt,
static bool tcp_data_received(struct tcp *conn, struct net_pkt *pkt,
size_t *len)
{
if (*len == 0) {
return false;
}
if (tcp_data_get(conn, pkt, len) < 0) {
return false;
}
@ -1687,6 +1691,10 @@ static void tcp_out_of_order_data(struct tcp *conn, struct net_pkt *pkt,
{
size_t headers_len;
if (data_len == 0) {
return;
}
headers_len = net_pkt_get_len(pkt) - data_len;
/* Get rid of protocol headers from the data */
@ -1954,7 +1962,7 @@ next_state:
}
}
if (th && len) {
if (th) {
if (th_seq(th) == conn->ack) {
if (!tcp_data_received(conn, pkt, &len)) {
break;