首页 > 其他分享 >sysctl_tcp_rfc1337 分析

sysctl_tcp_rfc1337 分析

时间:2022-12-10 13:02:40浏览次数:77  
标签:sysctl rfc1337 connection tcp state TCP TIME new WAIT

tcp_timewait_state_process(struct inet_timewait_sock *tw, struct sk_buff *skb,
const struct tcphdr *th)
{
----------------------------------------------------

/*
* Now real TIME-WAIT state.
*
* RFC 1122:
* "When a connection is [...] on TIME-WAIT state [...]
* [a TCP] MAY accept a new SYN from the remote TCP to
* reopen the connection directly, if it:
*
* (1) assigns its initial sequence number for the new
* connection to be larger than the largest sequence
* number it used on the previous connection incarnation,
* and
*
* (2) returns to TIME-WAIT state if the SYN turns out
* to be an old duplicate".
*/

if (!paws_reject &&
(TCP_SKB_CB(skb)->seq == tcptw->tw_rcv_nxt &&
(TCP_SKB_CB(skb)->seq == TCP_SKB_CB(skb)->end_seq || th->rst))) {
/* In window segment, it may be only reset or bare ack. */

if (th->rst) {
/* This is TIME_WAIT assassination, in two flavors.
* Oh well... nobody has a sufficient solution to this
* protocol bug yet.
*/
if (sysctl_tcp_rfc1337 == 0) {
kill:
inet_twsk_deschedule_put(tw);
return TCP_TW_SUCCESS;
}
}
------------------
}
----------------------------
}

核心问题是: 接收到了一个RESET也要保持TIME_WAIT状态,还是直接释放TIME_WAIT连接。

      是否开启允许用RESET来终止一个TW状态的连接!!

查看一下 1337RFC:具体文档就不贴了!参考

 

tcp_rfc1337 - BOOLEAN
If set, the TCP stack behaves conforming to RFC1337. If unset,
we are not conforming to RFC, but prevent TCP TIME_WAIT
assassination.
Default: 0

 

The first problem is that old duplicate data may be accepted erroneously in new connections, leading to the sent data becoming corrupt.
The second problem is that connections may become desynchronized and get into an ACK loop because of old duplicate packets entering new connections, which will become desynchronized.
The third and last problem is that old duplicate packets may enter newly established connections erroneously and kill the new connection.

 

From what I read, to solve the problems, what the setting does is ignore the RST (reset) packets while the socket is in its TIME-WAIT state.

So, why isn't this setting enabled by default? What are the disadvantages of using this?

. ​RFC 1337​ is an Informational RFC only and not part of the TCP standard. To ensure that there isn't any unexpected changes in production networks, it makes sense to keep this feature disabled by default and leave it up to the network admins to decide if they would like to enable it for testing.

Dropping RST packets for sockets in TIME-WAIT wouldn't appear to have any negative consequences however that doesn't mean there aren't any - perhaps an odd edge case which hasn't been fully explored.

 

http代理服务器(3-4-7层代理)-网络事件库公共组件、内核kernel驱动 摄像头驱动 tcpip网络协议栈、netfilter、bridge 好像看过!!!! 但行好事 莫问前程 --身高体重180的胖子



标签:sysctl,rfc1337,connection,tcp,state,TCP,TIME,new,WAIT
From: https://blog.51cto.com/u_15404950/5927490

相关文章

  • TCP的FIN_WAIT1状态
    今天打流测试出现大量的FIN_WAIT1状态,可知主动关闭没有收到ack,有个问题是?这个状态会维持多长时间??参考这几篇博客:​​修改重传次数&& 超时重传最大时间​​​​TCP的......
  • Chapter9_通过七个简单的实验理解TCP_IP网络
    热身问答LAN是什么的缩略语?LAN是LocalAreaNetwork(局域网)的缩略语。通常把在一栋建筑物内或是一间办公室里的那种小规模网络称作LAN。与此相对,把互联网那样......
  • 使用nc进行tcp测速
    #servernc-lIPPORT>/dev/nulleg:nc-l192.168.144.18080>/dev/null#clientbs单位块大小count块数量,bs不要太大不然内存不够ddif=/dev/zerobs=104857......
  • TCP/UDP
    1TCP与UDP的区别是否面向连接:UDP传数据前不需要先建立连接,TCP传数据前必须先建立连接,传送完必须先释放连接是否可靠传输::远地主机在收到UDP报文后,不需要给出任何确......
  • 最全的TCP+UDP图解系列
    今天准备了一份关于TCP和UDP的图解,不仅有配图,更有文字解析,比起晦涩的专业分析,这篇文章更像是化繁为简的学习笔记。适合网工朋友们明晰概念,深刻掌握理论知识。01图解TCPTCP首......
  • 使用 NGINX 在 Kubernetes 中对 TCP 和 UDP 流量进行负载均衡
    原文作者:AmirRawdatofF5原文链接:​​​​使用NGINX在Kubernetes中对TCP和UDP流量进行负载均衡​​转载来源:NGINX官方网站除了HTTP流量之外,NGINXIngressCont......
  • TCP协议详解
    简介:大家好,我是枫哥,......
  • Freertos LWIP协议tcp client无法连接服务端
    参考​​https://jingyan.baidu.com/article/e52e36154ae4f740c60c5106.html​​   现在大多的单片机使用LwIP协议来实现互联网功能,但是在刚刚学习时发现有个问题就是,L......
  • IC64525: SQLCODE -30020 OR DRDA DATA STREAM SYNTAX ERROR REPORTED BY DB2 CONNECT
      Skiptomaincontent    Openacase    KnownIssues IC64525:SQLCODE-30020ORDRDADATASTREAMSYNT......
  • TCP 连接断开
    一、TCP四次挥手过程是怎样的?天下没有不散的宴席,对于TCP连接也是这样,TCP断开连接是通过四次挥手方式。双方都可以主动断开连接,断开连接后主机中的「资源」将被释放,......