Skip to content

Commit

Permalink
tcp_input: if tcp->req > recvreq, send ack only when state is TCP_EST…
Browse files Browse the repository at this point in the history
…ABLISHED

The Bluetooth network on N62 does not retransmit packet, so no packet
retransmition if we drop one, we will drop packet when tcp_close_eventhandler
is register and invoke by tcp_input. then we will always early return and
never stop, the peer will only close the connection if we send reset packet.

precondition:
close -> register tcp_close_eventhandler;

tcp_input -> tcp_callback(TCP_NEWDATA) -> devif_conn_event -> tcp_close_eventhandler
-> flags &= ~TCP_NEWDATA -> NOT entry tcp_data_event -> conn->recvreq NOT increase

old flow:
tcp_input -> tcp->seqno greater than conn->rcvseq -> tcp_send(TCP_ACK)

with this patch:
tcp_input -> tcp->seqno greater than conn->rcvseq -> !TCP_ESTABLISHED
-> case TCP_FIN_WAIT_1 -> dev->d_len greater than 0 -> tcp_reset

Signed-off-by: zhanghongyu <[email protected]>
  • Loading branch information
zhhyu7 authored and Meissi-jian committed Aug 20, 2024
1 parent 6071102 commit 55b83b0
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions net/tcp/tcp_input.c
Original file line number Diff line number Diff line change
Expand Up @@ -1185,8 +1185,11 @@ static void tcp_input(FAR struct net_driver_s *dev, uint8_t domain,

tcp_input_ofosegs(dev, conn, iplen);
#endif
tcp_send(dev, conn, TCP_ACK, tcpiplen);
return;
if ((conn->tcpstateflags & TCP_STATE_MASK) <= TCP_ESTABLISHED)
{
tcp_send(dev, conn, TCP_ACK, tcpiplen);
return;
}
}
}
}
Expand Down

0 comments on commit 55b83b0

Please sign in to comment.