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:
parent
74bc876bf5
commit
c25cd5a894
1 changed files with 9 additions and 1 deletions
|
@ -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;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue