net: ip: save TCP seq/ack values in tcp_synack_received

The tcp_synack_received() function ends with a call to send_ack().
However, if we don't update the sequence and ACK values, we'll send back
headers with 0 values and the destination will try resending over and
over.

Fix this by saving the seq and ack values when a TCP_SYN is flagged
in the header (which should be the case almost any time this function
is used as a callback).

Change-Id: I57f07ce719f2b6e2fb34c96c867d2e1c37f342ba
Signed-off-by: Michael Scott <michael.scott@linaro.org>
This commit is contained in:
Michael Scott 2017-01-10 09:22:43 -08:00 committed by Tomasz Bursztyka
commit a972d03ce7

View file

@ -848,6 +848,11 @@ static enum net_verdict tcp_synack_received(struct net_conn *conn,
NET_ASSERT(net_nbuf_iface(buf));
if (NET_TCP_FLAGS(buf) & NET_TCP_SYN) {
context->tcp->send_ack =
sys_get_be32(NET_TCP_BUF(buf)->seq) + 1;
context->tcp->recv_max_ack = context->tcp->send_seq + 1;
}
/*
* If we receive SYN, we send SYN-ACK and go to SYN_RCVD state.
*/