TCP: keepalive probes bug

1621阅读 0评论2010-08-24 sandflee
分类:

TCP: avoid to send keepalive probes if receiving data

RFC 1122 says the following:
...
Keep-alive packets MUST only be sent when no data or
acknowledgement packets have been received for the
connection within an interval.
...

The acknowledgement packet is reseting the keepalive
timer but the data packet isn't. This patch fixes it by
checking the timestamp of the last received data packet
too when the keepalive timer expires.

the test is easy,just using a server recieving the msg and send nothing but acks,
but in fact no keep-alive packets is send.By default this feather should be set using
setsockopt():
setsockopt($Client, SOL_SOCKET, SO_KEEPALIVE, pack("l", 1))|| warn "setsockopt: $!";
setsockopt($Client, $proto, TCP_KEEPIDLE, pack("l", 40)) || warn "setsockopt: $!";
setsockopt($Client, $proto, TCP_KEEPCNT, pack("l", 6)) || warn "setsockopt: $!";
setsockopt($Client, $proto, TCP_KEEPINTVL, pack("l", 5)) || warn "setsockopt: $!";
the first set it on,and the following set when,num and intervals on TCP-level.
上一篇:RTO-WAR test
下一篇:e1000 issue