[issue10724] socket.close close telnet with RST

sean216 report at bugs.python.org
Fri Dec 17 08:40:38 CET 2010


New submission from sean216 <taoyuan-216 at 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 <report at bugs.python.org>
<http://bugs.python.org/issue10724>
_______________________________________


More information about the Python-bugs-list mailing list