免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
最近访问板块 发新帖
查看: 4435 | 回复: 5
打印 上一主题 下一主题

[网络子系统] 三次握手出现syn->aync,ack->rst诡异的包 [复制链接]

论坛徽章:
0
跳转到指定楼层
1 [收藏(0)] [报告]
发表于 2015-01-24 11:37 |只看该作者 |倒序浏览

Nginx做反向代理(70.210,系统为centos6.0,内核版本为2.6.32)
后端服务(70.47,系统为ubuntu12.04,内核版本为3.11.0)
两台机器上抓包,均能看到该现象。
1、排除掉iptables(已卸载模块)的原因
2、从包上看,第二次握手syn,ack好像没有异常
3、查看内核2.6.32代码,从tcp_rcv_synsent_state_process函数看,
第二次握手有ack标记,进入代码块:if (th->ack)

  1.                 /* rfc793:
  2.                  * "If the state is SYN-SENT then
  3.                  *    first check the ACK bit
  4.                  *      If the ACK bit is set
  5.                  *          If SEG.ACK =< ISS, or SEG.ACK > SND.NXT, send
  6.                  *        a reset (unless the RST bit is set, if so drop
  7.                  *        the segment and return)"
  8.                  *
  9.                  *  We do not send data with SYN, so that RFC-correct
  10.                  *  test reduces to:
  11.                  */
  12. [color=Red]                /*1、已经发过SYN*/[/color]
  13.                 if (TCP_SKB_CB(skb)->ack_seq != tp->snd_nxt)
  14.                         goto reset_and_undo;
  15. [color=Red]                /*从包上看,没有tsecr*/[/color]
  16.                 if (tp->rx_opt.saw_tstamp && tp->rx_opt.rcv_tsecr &&
  17.                     !between(tp->rx_opt.rcv_tsecr, tp->retrans_stamp,
  18.                              tcp_time_stamp)) {
  19.                         NET_INC_STATS_BH(sock_net(sk), LINUX_MIB_PAWSACTIVEREJECTED);
  20.                         goto reset_and_undo;
  21.                 }
  22.                
  23.                 /* Now ACK is acceptable.
  24.                  *
  25.                  * "If the RST bit is set
  26.                  *    If the ACK was acceptable then signal the user "error:
  27.                  *    connection reset", drop the segment, enter CLOSED state,
  28.                  *    delete TCB, and return."
  29.                  */
  30. [color=Red]                /*没有该标记*/[/color]
  31.                 if (th->rst) {
  32.                         tcp_reset(sk);
  33.                         goto discard;
  34.                 }

  35.                 /* rfc793:
  36.                  *   "fifth, if neither of the SYN or RST bits is set then
  37.                  *    drop the segment and return."
  38.                  *
  39.                  *    See note below!
  40.                  *                                        --ANK(990513)
  41.                  */
  42. [color=Red]                /*存在SYN标记*/[/color]
  43.                 if (!th->syn)
  44.                         goto discard_and_undo;
  45.                
  46. [color=Red]                /*上面的检查流程都通过了,下面再做其他处理就返回0了*/[/color]
  47.                 /* Ok.. it's good. Set up sequence numbers and
  48.                  * move to established.
  49.                  */
复制代码
求助各位,这种状况什么原因发出RST?

论坛徽章:
0
2 [报告]
发表于 2015-01-26 14:37 |只看该作者
有可能第二个包超时了吧

论坛徽章:
0
3 [报告]
发表于 2015-01-26 14:38 |只看该作者
建议从47 和 210两方抓包分析

论坛徽章:
3
射手座
日期:2014-08-18 12:15:53戌狗
日期:2014-08-22 09:53:36寅虎
日期:2014-08-22 14:15:29
4 [报告]
发表于 2015-01-26 15:24 |只看该作者
回复 1# thedaydreamer


    看TCP 窗口没有问题,  那就有可能是timestmap的问题了, 截图是什么工具显示的?wireshark?

论坛徽章:
0
5 [报告]
发表于 2015-01-28 13:46 |只看该作者
两边都抓过,一样的表现。回复 3# lims_xlh


   

论坛徽章:
0
6 [报告]
发表于 2015-01-28 13:47 |只看该作者
回复 4# gaojl0728
wireshark不显示TSval?
47上的timestamp也是关闭的

   
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

北京盛拓优讯信息技术有限公司. 版权所有 京ICP备16024965号-6 北京市公安局海淀分局网监中心备案编号:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年举报专区
中国互联网协会会员  联系我们:huangweiwei@itpub.net
感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

清除 Cookies - ChinaUnix - Archiver - WAP - TOP