New submission from sean216 <taoyuan-...@163.com>:

when use socket.close to close the telnet connection, in normal usage the tcp 
disconnect will be (socket.close send the TCP FIN)

      TCP A                                                TCP B

  1.  ESTABLISHED                                          ESTABLISHED

  2.  (Close)
      FIN-WAIT-1  --> <SEQ=100><ACK=300><CTL=FIN,ACK>  --> CLOSE-WAIT

  3.  FIN-WAIT-2  <-- <SEQ=300><ACK=101><CTL=ACK>      <-- CLOSE-WAIT

  4.                                                       (Close)
      TIME-WAIT   <-- <SEQ=300><ACK=101><CTL=FIN,ACK>  <-- LAST-ACK

  5.  TIME-WAIT   --> <SEQ=101><ACK=301><CTL=ACK>      --> CLOSED

  6.  (2 MSL)
      CLOSED                                                      
but sometimes socket.close will send TCP RST to disconnect the telnet and with 
wrong sequence number. This kind of RST will be considering as Network RST 
attack, and this packet will be dropped, the telnet connection will still 
established and cannot be closed.
Seems python socket.close has some issues.

    def close(self):
        self._sock = _closedsocket()
        dummy = self._sock._dummy
        for method in _delegate_methods:
            setattr(self, method, dummy)
    close.__doc__ = _realsocket.close.__doc__

----------
components: Library (Lib)
files: telnet_unnormal RST.pcap
messages: 124187
nosy: sean216
priority: normal
severity: normal
status: open
title: socket.close close telnet with RST
type: behavior
versions: Python 2.5
Added file: http://bugs.python.org/file20090/telnet_unnormal RST.pcap

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue10724>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to