On 6/10/19 07:48, iam@xxxxxxxxxxx wrote:
So if it doesn't do anything with network stack states, why I don't see RTT for my SYN_RECV -> ESTABLISHED state changes?
You're looking at the netfilter/conntrack state (see conntrack(8)) rather than the state of the endpoint TCP stack (see ss(8)/netstat(8)).
Conntrack measures things differently because it observes from the perspective of an intermediary to the connection rather than either of the endpoints -- it commonly runs on a router somewhere in the path between them.
From the perspective of the initiator the state goes from SYN_SENT to ESTABLISHED as soon as SYN+ACK is observed, and so it is for conntrack, but because conntrack is in the middle of the path you see up to a RTT between SYN+ACK and ACK which for the initiator was instantaneous, and conversely no RTT between SYN and SYN+ACK when conntrack runs near the receiver even though that would have been a RTT for the initiator.
I imagine the actual receiver TCP stack code does what you're expecting, but it maintains its own state and has its own commands and APIs independent of the conntrack ones.