Jump to: navigation, search

TCP connection

133 bytes added, 11:13, 27 July 2012
fixed first half of the article
This page describes how we handle established TCP connections.
== TCP repair mode in kernel ==
The sockoption called <code>TCP_REPAIR </code> socket option was recently added to the kernel and helps 3.5 to help with doing C/R for TCP sockets.
When set this option turn the is used, a socket is switched into a special state mode, in which any action performed on it doesn'tdoes not result in any anything defined by an appropriate protocol actions, but instead rather directly puts the socket into a state, in whichshould the socket is expected to be at the end of the successfully finished operation.
E.g. For example, calling <code>connect() </code> on a repaired socket just switches one changes its state to the <code>ESTABLISHED state </code>,with the peer address set as requested.The <code>bind() </code> call forcibly binds the socket to a given address (ignoring any potential conflicts). CloseThe <code>close()-ing </code> call closes thesocket under repair happens without any transient <code>FIN_WAIT</code>/<code>TIME_WAIT</code>/etc states. Socket ,socket is silently killed.
=== Sequences ===
In order to To restore the connection properly only binding , bind() and connecting it connect() is not enough. One also needs to restore theTCP sequence numbers. To do so , the <code>TCP_REPAIR_QUEUE </code> and <code>TCP_QUEUE_SEQ </code> options were introduced.
The former one selects which queue (input or output) will be repaired and the latter gets/sets the sequence. Note, that
setting the sequence is only possible on CLOSE-d socket.

Navigation menu