net: tcp: Swap tcp->context backpointers
On accepting a new connection, the stack does an odd "swap" trick where it updates the struct net_tcp record on the *listening* context with the values from the new connection, and then swaps it with the empty one that got allocated for the *new* context. Unfortunately this swap forgot to swap the net_tcp "context" field backpointers, so the net_context retrieved at runtime was for the wrong connection. Surprisingly, this actually almost worked for a long time, except that the destination address would be wrong in the newer setup. Change-Id: I0c1812ddb9f9ff3e7deb60d1fd67cafd9ba96997 Signed-off-by: Andy Ross <andrew.j.ross@intel.com>
This commit is contained in:
parent
a5b694fbbc
commit
02174b8e0f
1 changed files with 2 additions and 0 deletions
|
@ -1333,6 +1333,8 @@ static enum net_verdict tcp_syn_rcvd(struct net_conn *conn,
|
|||
tmp_tcp = new_context->tcp;
|
||||
new_context->tcp = tcp;
|
||||
context->tcp = tmp_tcp;
|
||||
tcp->context = new_context;
|
||||
tmp_tcp->context = context;
|
||||
|
||||
net_tcp_change_state(tmp_tcp, NET_TCP_LISTEN);
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue