net/tcp: Stop TCP state machine breaking when sending locally

On any target, running a TCP server and a net shell can show the issue:
net tcp connect local_ip port

will fail. Usally it ends up by consumming all tcp connection memory.

This is because in tcp_in(), state changes will most of the time lead to
sending SYN/ACK/etc... packets under the same thread, which will run all
through net_send_data(), back to tcp_in(). Thus a forever loop on SYN ->
SYN|ACK -> SYN -> SYN|ACK until tcp connection cannot be allocated
anymore.

Fixing it by scheduling any local packet to be sent on the queue.

Fixes #38576

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
1 file changed