smoltcp-rs/smoltcp

Listening TCP socket may accept RST destined for other socket

george-hopkins opened this issue · 0 comments

To start with, I'm not sure this is indeed a bug:
Given two TCP sockets in listening state, each receives a SYN. Afterwards, the remote client sends a RST to each socket. After processing the first RST, one socket falls back to LISTEN. The second RST might be accepted by that socket as well, even if it is actually destined to the second socket. The second socket will be stuck in SynReceived and will be trying to send SYN+ACKs.

I was able to fix this behaviour by ignoring such packets in smoltcp::socket::tcp::Socket::accepts but this might not be the most elegant way.