Skip to content

Commit bafc9f2

Browse files
rlubosdanieldegrasse
authored andcommitted
net: tcp: Fix handling of keep-alive probes
Keep-alive probes have seq number set to SND.NXT - 1 and may or may not contain an octet of data. The latter case was not handled properly therefore add a special case when validating seq number to response to keep-alive probes. Signed-off-by: Robert Lubos <[email protected]> (cherry picked from commit d93c5d6)
1 parent 30de5e8 commit bafc9f2

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

subsys/net/ip/tcp.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2805,7 +2805,9 @@ static enum net_verdict tcp_in(struct tcp *conn, struct net_pkt *pkt)
28052805
/* send ACK for non-RST packet */
28062806
if (FL(&fl, &, RST)) {
28072807
net_stats_update_tcp_seg_rsterr(net_pkt_iface(pkt));
2808-
} else if ((len > 0) || FL(&fl, &, FIN)) {
2808+
} else if ((len > 0) || FL(&fl, &, FIN) ||
2809+
/* Keep-alive probe */
2810+
((len == 0) && FL(&fl, &, ACK))) {
28092811
tcp_out(conn, ACK);
28102812
}
28112813
k_mutex_unlock(&conn->lock);

0 commit comments

Comments
 (0)