Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 29 Jul 2016 13:30:14 +0000
From:      bugzilla-noreply@freebsd.org
To:        freebsd-standards@FreeBSD.org
Subject:   [Bug 211441] incorrect handling of TCPS_SYN_SENT and TCPS_SYN_RECEIVED in API tcp_usrclosed() in file tcp_usrreq.c
Message-ID:  <bug-211441-15@https.bugs.freebsd.org/bugzilla/>

next in thread | raw e-mail | index | archive | help
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=3D211441

            Bug ID: 211441
           Summary: incorrect handling of TCPS_SYN_SENT and
                    TCPS_SYN_RECEIVED in API tcp_usrclosed() in file
                    tcp_usrreq.c
           Product: Base System
           Version: CURRENT
          Hardware: Any
                OS: Any
            Status: New
          Severity: Affects Some People
          Priority: ---
         Component: standards
          Assignee: freebsd-standards@FreeBSD.org
          Reporter: prabhat@mtree.co.in

Created attachment 173093
  --> https://bugs.freebsd.org/bugzilla/attachment.cgi?id=3D173093&action=
=3Dedit
tcp state diagram for quick reference

1) For TCPS_SYN_SENT:

As per TCP state diagram, TCPS_SYN_SENT should switch to TCPS_CLOSED state =
on
appl:close call or timeout. In current code, at SYN_SENT state, a FIN messa=
ge
is initiated instead of call to tcp_close() to release PCB and TCP control
block, which leads to incorrect states.

To fix the issue, "case TCPS_SYN_SENT:" must be shifted with the case "case
TCPS_LISTEN:".


2) For TCPS_SYN_RECEIVED:

As per TCP state diagram, on appl:close call, if we are at TCPS_SYN_RECEIVED
state then we just need to send FIN and switch to FIN_WAIT_1 state. In curr=
ent
code, we are not switching to TCPS_FIN_WAIT_1 state.

To fix this issue, "break;" statement should be removed in the case "case
TCPS_SYN_RECEIVED:" so that it falls through "case TCPS_ESTABLISHED:" where=
 we
are changing state to TCPS_FIN_WAIT_1.

Code fix:
        case TCPS_SYN_RECEIVED:
                tp->t_flags |=3D TF_NEEDFIN;
                //break;

--=20
You are receiving this mail because:
You are the assignee for the bug.=



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?bug-211441-15>