TCP Timers Chia-tai Tsai [email protected]. Introduction The 7 Timers for each Connection...
-
Upload
adam-cannon -
Category
Documents
-
view
228 -
download
7
Transcript of TCP Timers Chia-tai Tsai [email protected]. Introduction The 7 Timers for each Connection...
![Page 2: TCP Timers Chia-tai Tsai tai@cis.nctu.edu.tw. Introduction The 7 Timers for each Connection Connection-Establishment Timer Establish a new connection.](https://reader038.fdocuments.us/reader038/viewer/2022110101/56649e7b5503460f94b7ce2c/html5/thumbnails/2.jpg)
Introduction The 7 Timers for each Connection
Connection-Establishment Timer Establish a new connection. If a response isn’t received within 75 seconds, the
connection establishment is aborted.
Retransmission Timer Based on Round-Trip Time (RTT). TCP sends data. When this timer expires, TCP retransmit the data.
![Page 3: TCP Timers Chia-tai Tsai tai@cis.nctu.edu.tw. Introduction The 7 Timers for each Connection Connection-Establishment Timer Establish a new connection.](https://reader038.fdocuments.us/reader038/viewer/2022110101/56649e7b5503460f94b7ce2c/html5/thumbnails/3.jpg)
Introduction cont. Delay ACK Timer
Need not be acknowledged immediately. TCP waits up to 200 ms. Piggybacking
Persist Timer Based on RTT Triggered when a null window is advertised If timer expires, sender issues a probe
(between 5 and 60 s, never gives up)
![Page 4: TCP Timers Chia-tai Tsai tai@cis.nctu.edu.tw. Introduction The 7 Timers for each Connection Connection-Establishment Timer Establish a new connection.](https://reader038.fdocuments.us/reader038/viewer/2022110101/56649e7b5503460f94b7ce2c/html5/thumbnails/4.jpg)
Introduction cont. Keepalive Timer
socket option SO_KEEPALIVE. Tests if the other end is still up and running Expires after 2 hours
FIN_WAIT_2 Timer FIN_WAIT_1 -> FIN_WAIT_2 Avoid a connection in the FIN_WAIT_2 state
forever.
![Page 5: TCP Timers Chia-tai Tsai tai@cis.nctu.edu.tw. Introduction The 7 Timers for each Connection Connection-Establishment Timer Establish a new connection.](https://reader038.fdocuments.us/reader038/viewer/2022110101/56649e7b5503460f94b7ce2c/html5/thumbnails/5.jpg)
Introduction cont. 2MSL Timer (TIME_WAIT Timer)
MSL (Maximum Segment Life) 30s to 4 min Triggered when connection (client) enters
TIME_WAIT state During 2MSL, the socket pair cannot be reused.
(packets arriving during this state are discarded)
Timer Function Fast timer
Triggered every 200 ms Delay ACK Timer
Slow timer Triggered every 500 ms
![Page 6: TCP Timers Chia-tai Tsai tai@cis.nctu.edu.tw. Introduction The 7 Timers for each Connection Connection-Establishment Timer Establish a new connection.](https://reader038.fdocuments.us/reader038/viewer/2022110101/56649e7b5503460f94b7ce2c/html5/thumbnails/6.jpg)
Implements of the 7 TCP timers
![Page 7: TCP Timers Chia-tai Tsai tai@cis.nctu.edu.tw. Introduction The 7 Timers for each Connection Connection-Establishment Timer Establish a new connection.](https://reader038.fdocuments.us/reader038/viewer/2022110101/56649e7b5503460f94b7ce2c/html5/thumbnails/7.jpg)
tcp_canceltimers Function
tcp_timer.c Triggered when enters TIME_WAIT
state. All 4 timers counters are set to 0.
![Page 8: TCP Timers Chia-tai Tsai tai@cis.nctu.edu.tw. Introduction The 7 Timers for each Connection Connection-Establishment Timer Establish a new connection.](https://reader038.fdocuments.us/reader038/viewer/2022110101/56649e7b5503460f94b7ce2c/html5/thumbnails/8.jpg)
tcp_fasttime Function
tcp_timer.c Delay ACK Timer If TF_DELACK flag is set, it is
cleared and TF_ACKNOW flag is set instead.
![Page 9: TCP Timers Chia-tai Tsai tai@cis.nctu.edu.tw. Introduction The 7 Timers for each Connection Connection-Establishment Timer Establish a new connection.](https://reader038.fdocuments.us/reader038/viewer/2022110101/56649e7b5503460f94b7ce2c/html5/thumbnails/9.jpg)
tcp_slowtime Function
tcp_timer.c Handle the other 6 Timers
Connection establishment 、 retransmission 、persist 、 keepalive 、 FIN_WAIT_2 、 2MSL
Check each timer counter in all TCPCB Check if TCPCB has been deleted
![Page 10: TCP Timers Chia-tai Tsai tai@cis.nctu.edu.tw. Introduction The 7 Timers for each Connection Connection-Establishment Timer Establish a new connection.](https://reader038.fdocuments.us/reader038/viewer/2022110101/56649e7b5503460f94b7ce2c/html5/thumbnails/10.jpg)
tcp_slowtime Function cont. Count idle time
Keepalive FIN_WAIT_2
Increment RTT counter Increment RFC 1323 timestamp value
tcp_now
![Page 11: TCP Timers Chia-tai Tsai tai@cis.nctu.edu.tw. Introduction The 7 Timers for each Connection Connection-Establishment Timer Establish a new connection.](https://reader038.fdocuments.us/reader038/viewer/2022110101/56649e7b5503460f94b7ce2c/html5/thumbnails/11.jpg)
tcp_timers Function
tcp_timer.c Called by TCP’s PRU_SLOWTIMO
request
![Page 12: TCP Timers Chia-tai Tsai tai@cis.nctu.edu.tw. Introduction The 7 Timers for each Connection Connection-Establishment Timer Establish a new connection.](https://reader038.fdocuments.us/reader038/viewer/2022110101/56649e7b5503460f94b7ce2c/html5/thumbnails/12.jpg)
tcp_timers Function cont.
Case TCPT_2MSL(FIN_WAIT_2 and 2MSL Timers) 2MSL Timers
![Page 13: TCP Timers Chia-tai Tsai tai@cis.nctu.edu.tw. Introduction The 7 Timers for each Connection Connection-Establishment Timer Establish a new connection.](https://reader038.fdocuments.us/reader038/viewer/2022110101/56649e7b5503460f94b7ce2c/html5/thumbnails/13.jpg)
tcp_timers Function cont. FIN_WAIT_2 timer
![Page 14: TCP Timers Chia-tai Tsai tai@cis.nctu.edu.tw. Introduction The 7 Timers for each Connection Connection-Establishment Timer Establish a new connection.](https://reader038.fdocuments.us/reader038/viewer/2022110101/56649e7b5503460f94b7ce2c/html5/thumbnails/14.jpg)
tcp_timers Function cont.
Case TCPT_PERSIST (Persist Timer) Force window probe segment Time line of persist time
![Page 15: TCP Timers Chia-tai Tsai tai@cis.nctu.edu.tw. Introduction The 7 Timers for each Connection Connection-Establishment Timer Establish a new connection.](https://reader038.fdocuments.us/reader038/viewer/2022110101/56649e7b5503460f94b7ce2c/html5/thumbnails/15.jpg)
tcp_timers Function cont.
Case TCPT_KEEP (Connection Establishment and Keepalive Timers) Connection establishment timer and retr
ansmission timer after SYN is sent
![Page 16: TCP Timers Chia-tai Tsai tai@cis.nctu.edu.tw. Introduction The 7 Timers for each Connection Connection-Establishment Timer Establish a new connection.](https://reader038.fdocuments.us/reader038/viewer/2022110101/56649e7b5503460f94b7ce2c/html5/thumbnails/16.jpg)
tcp_timers Function cont. Keepalive timer
Expired after 2 hours of idle time Drop connection who no response Send a keepalive probe Reset keepalive timer
![Page 17: TCP Timers Chia-tai Tsai tai@cis.nctu.edu.tw. Introduction The 7 Timers for each Connection Connection-Establishment Timer Establish a new connection.](https://reader038.fdocuments.us/reader038/viewer/2022110101/56649e7b5503460f94b7ce2c/html5/thumbnails/17.jpg)
Retransmission Timer Calculations
var4
varvarvar
rttsrttRTO
rttdeltarttrtt
deltagsrttsrtt
srttntickdelta
![Page 18: TCP Timers Chia-tai Tsai tai@cis.nctu.edu.tw. Introduction The 7 Timers for each Connection Connection-Establishment Timer Establish a new connection.](https://reader038.fdocuments.us/reader038/viewer/2022110101/56649e7b5503460f94b7ce2c/html5/thumbnails/18.jpg)
Retransmission Timer Calculations
member
Units Initial value
#sec
Description
t_srtt ticks x 8
0 Smoothed RTT estimator : srtt x 8
t_rttvar ticks x 4
24 3 Smoothed mean deviation estimator : rttvar x 4
t_rxtcur ticks 12 6 Current retransmission timeout: RTO
t_rttmin ticks 2 1 Min. value for retransmissions timeout
t_rxtshift
null 0 Index into tcp_backoff[] array (exponential backoff)
![Page 19: TCP Timers Chia-tai Tsai tai@cis.nctu.edu.tw. Introduction The 7 Timers for each Connection Connection-Establishment Timer Establish a new connection.](https://reader038.fdocuments.us/reader038/viewer/2022110101/56649e7b5503460f94b7ce2c/html5/thumbnails/19.jpg)
tcp_setpersist Function
tcp_output.c Check retransmission timer not
enabled Calculate RTO
2
var_4_
4
var_2
8
_
var2
rtttsrttt
rtttsrttt
rttsrttRTO
![Page 20: TCP Timers Chia-tai Tsai tai@cis.nctu.edu.tw. Introduction The 7 Timers for each Connection Connection-Establishment Timer Establish a new connection.](https://reader038.fdocuments.us/reader038/viewer/2022110101/56649e7b5503460f94b7ce2c/html5/thumbnails/20.jpg)
tcp_setpersist Function cont. Exponential backoff array
{1, 2, 4, 8, 16, 32, 64, 64, 64, 64, 64, 64, 64}
![Page 21: TCP Timers Chia-tai Tsai tai@cis.nctu.edu.tw. Introduction The 7 Timers for each Connection Connection-Establishment Timer Establish a new connection.](https://reader038.fdocuments.us/reader038/viewer/2022110101/56649e7b5503460f94b7ce2c/html5/thumbnails/21.jpg)
tcp_xmit_timer Function
tcp_input.c rtt is the RTT measurement to be appli
ed Timestamp option (tcp_now) RTT counter (t_rtt)
![Page 22: TCP Timers Chia-tai Tsai tai@cis.nctu.edu.tw. Introduction The 7 Timers for each Connection Connection-Establishment Timer Establish a new connection.](https://reader038.fdocuments.us/reader038/viewer/2022110101/56649e7b5503460f94b7ce2c/html5/thumbnails/22.jpg)
tcp_xmit_timer Function cont. Update smoothed estimators and RT
O
var_8
_
var4
4
var_var_var_
varvarvar
__
88
rtttsrttt
RTO
rttsrttRTO
rtttdeltartttrttt
rttdeltahrttrtt
deltasrtttsrttt
deltasrttsrtt
deltagsrttsrtt
![Page 23: TCP Timers Chia-tai Tsai tai@cis.nctu.edu.tw. Introduction The 7 Timers for each Connection Connection-Establishment Timer Establish a new connection.](https://reader038.fdocuments.us/reader038/viewer/2022110101/56649e7b5503460f94b7ce2c/html5/thumbnails/23.jpg)
Retransmission Timeout(tcp_timers Function cont.)
tcp_timer.c
![Page 24: TCP Timers Chia-tai Tsai tai@cis.nctu.edu.tw. Introduction The 7 Timers for each Connection Connection-Establishment Timer Establish a new connection.](https://reader038.fdocuments.us/reader038/viewer/2022110101/56649e7b5503460f94b7ce2c/html5/thumbnails/24.jpg)
Retransmission Timeout cont.
Source introduction Increment shift count (t_rxtshift) Calculate new RTO Ask IP to find a new route Clear estimators Force retransmission of oldest unacknow
ledged data