通过对等方重置FTP连接(ECONNRESET)

时间:2012-11-02 15:18:31

标签: ftp network-programming opera wireshark

在我们的硬件上,我们运行了自制的ftp-server。该服务器适用于IE,FireFox,Safari,Opera 9和FileZilla等浏览器。但是,如果我使用Opera 12,则在两个ftp数据包之后关闭连接。 服务器告诉我errno = 54又名ECONNRESET。看一下WireShark转储,可以看到Opera发送了一个RST命令。我已经改变了包大小,但是在两个ftp-data包之后它再次失败了。 有谁知道为什么会发生这种情况?

Opera 12的 FAILING WireShark转储是(其中包47是RST):

No.     Time        Source                Destination           Protocol Info
  7 0.010108    172.22.4.229          172.22.6.88           FTP      Response: 331 Password required for user.
  8 0.010198    172.22.6.88           172.22.4.229          FTP      Request: PASS opera@
  9 0.011262    172.22.4.229          172.22.6.88           TCP      ftp > 54729 [ACK] Seq=57 Ack=30 Win=9987 Len=0
 10 0.013992    172.22.4.229          172.22.6.88           FTP      Response: 230 User logged in successfully.
 11 0.014073    172.22.6.88           172.22.4.229          FTP      Request: PWD
 12 0.015197    172.22.4.229          172.22.6.88           TCP      ftp > 54729 [ACK] Seq=91 Ack=35 Win=9995 Len=0
 13 0.016438    172.22.4.229          172.22.6.88           FTP      Response: 257 "/" is current directory.
 14 0.016524    172.22.6.88           172.22.4.229          FTP      Request: EPSV ALL
 15 0.017589    172.22.4.229          172.22.6.88           TCP      ftp > 54729 [ACK] Seq=122 Ack=45 Win=9990 Len=0
 16 0.018933    172.22.4.229          172.22.6.88           FTP      Response: 502 Command not implemented.
 17 0.019015    172.22.6.88           172.22.4.229          FTP      Request: REST 0
 18 0.020078    172.22.4.229          172.22.6.88           TCP      ftp > 54729 [ACK] Seq=152 Ack=53 Win=9992 Len=0
 19 0.021372    172.22.4.229          172.22.6.88           FTP      Response: 502 Command not implemented.
 20 0.021451    172.22.6.88           172.22.4.229          FTP      Request: TYPE I
 21 0.022550    172.22.4.229          172.22.6.88           TCP      ftp > 54729 [ACK] Seq=182 Ack=61 Win=9992 Len=0
 22 0.024777    172.22.4.229          172.22.6.88           FTP      Response: 200 Command TYPE successful.
 23 0.024856    172.22.6.88           172.22.4.229          FTP      Request: SIZE LOG-20120821120000-diagnostic-diag.txt
 24 0.025879    172.22.4.229          172.22.6.88           TCP      ftp > 54729 [ACK] Seq=212 Ack=106 Win=9955 Len=0
 25 0.028300    172.22.4.229          172.22.6.88           FTP      Response: 250 File size: 4626418 bytes (4517 kB)
 26 0.028381    172.22.6.88           172.22.4.229          FTP      Request: MDTM LOG-20120821120000-diagnostic-diag.txt
 27 0.029401    172.22.4.229          172.22.6.88           TCP      ftp > 54729 [ACK] Seq=252 Ack=151 Win=9955 Len=0
 28 0.030845    172.22.4.229          172.22.6.88           FTP      Response: 502 Command not implemented.
 29 0.030923    172.22.6.88           172.22.4.229          FTP      Request: MODE B
 30 0.032096    172.22.4.229          172.22.6.88           TCP      ftp > 54729 [ACK] Seq=282 Ack=159 Win=9992 Len=0
 31 0.033928    172.22.4.229          172.22.6.88           FTP      Response: 502 Command not implemented.
 32 0.034006    172.22.6.88           172.22.4.229          FTP      Request: PASV
 33 0.035098    172.22.4.229          172.22.6.88           TCP      ftp > 54729 [ACK] Seq=312 Ack=165 Win=9994 Len=0
 34 0.040963    172.22.4.229          172.22.6.88           FTP      Response: 227 Entering Passive Mode (172,22,4,229,225,144).
 35 0.041417    172.22.6.88           172.22.4.229          TCP      54730 > 57744 [SYN] Seq=0 Win=8192 Len=0 MSS=1460 WS=2 SACK_PERM=1
 36 0.041446    172.22.6.88           172.22.4.229          FTP      Request: RETR LOG-20120821120000-diagnostic-diag.txt
 37 0.042691    172.22.4.229          172.22.6.88           TCP      57744 > 54730 [SYN, ACK] Seq=0 Ack=1 Win=10000 Len=0 MSS=1426 SACK_PERM=1 WS=0
 38 0.042716    172.22.6.88           172.22.4.229          TCP      54730 > 57744 [ACK] Seq=1 Ack=1 Win=65596 Len=0
 39 0.043050    172.22.4.229          172.22.6.88           TCP      ftp > 54729 [ACK] Seq=363 Ack=210 Win=9955 Len=0
 40 0.046097    172.22.4.229          172.22.6.88           FTP      Response: 150 Opening data connection.
 41 0.057860    172.22.4.229          172.22.6.88           FTP-DATA FTP Data: 1426 bytes
 42 0.058711    172.22.4.229          172.22.6.88           FTP-DATA FTP Data: 622 bytes
 43 0.058723    172.22.6.88           172.22.4.229          TCP      54730 > 57744 [ACK] Seq=1 Ack=2049 Win=65596 Len=0
 44 0.063893    172.22.4.229          172.22.6.88           FTP-DATA FTP Data: 1426 bytes
 45 0.064826    172.22.4.229          172.22.6.88           FTP-DATA FTP Data: 622 bytes
 46 0.064843    172.22.6.88           172.22.4.229          TCP      54730 > 57744 [ACK] Seq=1 Ack=4097 Win=65596 Len=0
 47 0.070829    172.22.6.88           172.22.4.229          TCP      54730 > 57744 [RST, ACK] Seq=1 Ack=4097 Win=0 Len=0
 48 0.070921    172.22.6.88           172.22.4.229          TCP      54729 > ftp [FIN, ACK] Seq=210 Ack=393 Win=65204 Len=0
 49 0.072044    172.22.4.229          172.22.6.88           TCP      ftp > 54729 [ACK] Seq=393 Ack=211 Win=10000 Len=0
 50 0.095833    172.22.4.229          172.22.6.88           FTP      Response: 451 Requested action aborted. Internal errors.
 51 0.095898    172.22.6.88           172.22.4.229          TCP      54729 > ftp [RST, ACK] Seq=211 Ack=441 Win=0 Len=0

Opera 9的 WORKING WireShark转储是:

No.     Time        Source                Destination           Protocol Info
  1 0.000000    172.22.6.88           172.22.4.229          TCP      54653 > ftp [SYN] Seq=0 Win=8192 Len=0 MSS=1460 WS=8 SACK_PERM=1
  2 0.001598    172.22.4.229          172.22.6.88           TCP      ftp > 54653 [SYN, ACK] Seq=0 Ack=1 Win=10000 Len=0 MSS=1426 SACK_PERM=1 WS=0
  3 0.001653    172.22.6.88           172.22.4.229          TCP      54653 > ftp [ACK] Seq=1 Ack=1 Win=65536 Len=0
  4 0.007399    172.22.4.229          172.22.6.88           FTP      Response: 220 FTP server ready.
  5 0.022517    172.22.6.88           172.22.4.229          FTP      Request: USER anonymous
  6 0.023565    172.22.4.229          172.22.6.88           TCP      ftp > 54653 [ACK] Seq=24 Ack=17 Win=9984 Len=0
  7 0.024861    172.22.4.229          172.22.6.88           FTP      Response: 331 Password required for user.
  8 0.024950    172.22.6.88           172.22.4.229          FTP      Request: PASS opera@
  9 0.026015    172.22.4.229          172.22.6.88           TCP      ftp > 54653 [ACK] Seq=57 Ack=30 Win=9987 Len=0
 10 0.028033    172.22.4.229          172.22.6.88           FTP      Response: 230 User logged in successfully.
 11 0.028104    172.22.6.88           172.22.4.229          FTP      Request: PWD
 12 0.029223    172.22.4.229          172.22.6.88           TCP      ftp > 54653 [ACK] Seq=91 Ack=35 Win=9995 Len=0
 13 0.031091    172.22.4.229          172.22.6.88           FTP      Response: 257 "/" is current directory.
 14 0.031182    172.22.6.88           172.22.4.229          FTP      Request: TYPE I
 15 0.032228    172.22.4.229          172.22.6.88           TCP      ftp > 54653 [ACK] Seq=122 Ack=43 Win=9992 Len=0
 16 0.033562    172.22.4.229          172.22.6.88           FTP      Response: 200 Command TYPE successful.
 17 0.033635    172.22.6.88           172.22.4.229          FTP      Request: SIZE LOG-20120821120000-diagnostic-diag.txt
 18 0.034655    172.22.4.229          172.22.6.88           TCP      ftp > 54653 [ACK] Seq=152 Ack=88 Win=9955 Len=0
 19 0.037077    172.22.4.229          172.22.6.88           FTP      Response: 250 File size: 4626418 bytes (4517 kB)
 20 0.037154    172.22.6.88           172.22.4.229          FTP      Request: MDTM LOG-20120821120000-diagnostic-diag.txt
 21 0.038224    172.22.4.229          172.22.6.88           TCP      ftp > 54653 [ACK] Seq=192 Ack=133 Win=9955 Len=0
 22 0.040705    172.22.4.229          172.22.6.88           FTP      Response: 502 Command not implemented.
 23 0.040880    172.22.6.88           172.22.4.229          FTP      Request: MODE B
 24 0.041977    172.22.4.229          172.22.6.88           TCP      ftp > 54653 [ACK] Seq=222 Ack=141 Win=9992 Len=0
 25 0.043267    172.22.4.229          172.22.6.88           FTP      Response: 502 Command not implemented.
 26 0.043318    172.22.6.88           172.22.4.229          FTP      Request: PASV
 27 0.044369    172.22.4.229          172.22.6.88           TCP      ftp > 54653 [ACK] Seq=252 Ack=147 Win=9994 Len=0
 28 0.050959    172.22.4.229          172.22.6.88           FTP      Response: 227 Entering Passive Mode (172,22,4,229,225,143).
 29 0.063995    172.22.6.88           172.22.4.229          TCP      54654 > 57743 [SYN] Seq=0 Win=8192 Len=0 MSS=1460 WS=8 SACK_PERM=1
 30 0.064032    172.22.6.88           172.22.4.229          FTP      Request: RETR LOG-20120821120000-diagnostic-diag.txt
 31 0.065473    172.22.4.229          172.22.6.88           TCP      57743 > 54654 [SYN, ACK] Seq=0 Ack=1 Win=10000 Len=0 MSS=1426 SACK_PERM=1 WS=0
 32 0.065507    172.22.6.88           172.22.4.229          TCP      54654 > 57743 [ACK] Seq=1 Ack=1 Win=65536 Len=0
 33 0.065831    172.22.4.229          172.22.6.88           TCP      ftp > 54653 [ACK] Seq=303 Ack=192 Win=9955 Len=0
 34 0.068242    172.22.4.229          172.22.6.88           FTP      Response: 150 Opening data connection.
 35 0.082611    172.22.4.229          172.22.6.88           FTP-DATA FTP Data: 1426 bytes
 36 0.083479    172.22.4.229          172.22.6.88           FTP-DATA FTP Data: 622 bytes
 37 0.083494    172.22.6.88           172.22.4.229          TCP      54654 > 57743 [ACK] Seq=1 Ack=2049 Win=65536 Len=0
 38 0.090274    172.22.4.229          172.22.6.88           FTP-DATA FTP Data: 1426 bytes
 39 0.091103    172.22.4.229          172.22.6.88           FTP-DATA FTP Data: 622 bytes
 40 0.091119    172.22.6.88           172.22.4.229          TCP      54654 > 57743 [ACK] Seq=1 Ack=4097 Win=65536 Len=0
 41 0.114112    172.22.4.229          172.22.6.88           FTP-DATA FTP Data: 1426 bytes
 42 0.114900    172.22.4.229          172.22.6.88           FTP-DATA FTP Data: 622 bytes
 43 0.114921    172.22.6.88           172.22.4.229          TCP      54654 > 57743 [ACK] Seq=1 Ack=6145 Win=65536 Len=0
 44 0.128935    172.22.4.229          172.22.6.88           FTP-DATA FTP Data: 1426 bytes
 45 0.128937    172.22.4.229          172.22.6.88           FTP-DATA FTP Data: 622 bytes
 46 0.128961    172.22.6.88           172.22.4.229          TCP      54654 > 57743 [ACK] Seq=1 Ack=8193 Win=65536 Len=0
 47 0.140241    172.22.4.229          172.22.6.88           FTP-DATA FTP Data: 1426 bytes
 48 0.141073    172.22.4.229          172.22.6.88           FTP-DATA FTP Data: 622 bytes
 49 0.141088    172.22.6.88           172.22.4.229          TCP      54654 > 57743 [ACK] Seq=1 Ack=10241 Win=65536 Len=0
 ......
1046 4.558687    172.22.6.88           172.22.4.229          TCP      54654 > 57743 [ACK] Seq=1 Ack=690177 Win=65536 Len=0
1047 4.570837    172.22.4.229          172.22.6.88           FTP-DATA FTP Data: 1426 bytes
1048 4.570878    172.22.6.88           172.22.4.229          TCP      54654 > 57743 [FIN, ACK] Seq=1 Ack=691603 Win=65536 Len=0
1049 4.570928    172.22.6.88           172.22.4.229          TCP      54653 > ftp [FIN, ACK] Seq=192 Ack=333 Win=65024 Len=0
1050 4.571776    172.22.4.229          172.22.6.88           FTP-DATA FTP Data: 622 bytes
1051 4.572142    172.22.4.229          172.22.6.88           TCP      57743 > 54654 [ACK] Seq=692225 Ack=2 Win=10000 Len=0
1052 4.572143    172.22.4.229          172.22.6.88           TCP      ftp > 54653 [ACK] Seq=333 Ack=193 Win=10000 Len=0
1053 4.581171    172.22.4.229          172.22.6.88           FTP-DATA FTP Data: 1426 bytes
1054 4.581216    172.22.6.88           172.22.4.229          TCP      54654 > 57743 [RST, ACK] Seq=2 Ack=693651 Win=0 Len=0
1055 4.591403    172.22.4.229          172.22.6.88           FTP      Response: 451 Requested action aborted. Internal errors.
1056 4.591460    172.22.6.88           172.22.4.229          TCP      54653 > ftp [RST, ACK] Seq=193 Ack=381 Win=0 Len=0

1 个答案:

答案 0 :(得分:0)

根据2007年3月的RFC 3659,尺寸响应具有以下结构:

size-response = "213" SP 1*DIGIT CRLF /
                error-response

请注意,当发出213响应时,即没有响应时 错误,格式必须完全符合指定。多线响应 是不允许的。

我们的ftp服务器不是这种情况。但旧格式显然被其他ftp客户接受。