DCCP protocol discussions
 help / color / mirror / Atom feed
From: Gerrit Renker <gerrit@erg.abdn.ac.uk>
To: dccp@vger.kernel.org
Subject: [PATCH 4/5]: DCCP's passive close needs to match TCP's half-close
Date: Wed, 12 Sep 2007 14:35:20 +0000	[thread overview]
Message-ID: <200709121535.20408@strip-the-willow> (raw)

[DCCP]: DCCP's passive close needs to match TCP's half-close

This fixes a problem of integrating the new auxiliary states PASSIVE_1/2 with the
inet_xxx infrastructure. 

The problem appears on the listening side and is that
 * a Close may have been received on the socket while it is still in the accept queue
   of the master/listening socket;
 * hence when it is taken out of the queue by inet_accept(), the state of the socket
   is PASSIVE_1 (whose value is greater than all registered TCP states);
 * this triggers the following warning in inet_accept():
  
   Sep 10 16:52:27 kernel: KERNEL: \
	assertion ((1 << sk2->sk_state) & (TCPF_ESTABLISHED | TCPF_CLOSE_WAIT | TCPF_CLOSE))\
	failed at /usr/src/main_davem-2.6/net/ipv4/af_inet.c (646)

The fix consists mapping PASSIVE_1 into TCPF_CLOSE_WAIT, which is possible since
there is no other mapping from a DCCP state into it. Incidentally, the `semantics'
of that state are also similar: in TCP's CLOSE_WAIT, a user confirmation to close
up the socket is needed - and the same (calling close/exit) situation arises here.

For a server deciding to hold TIMEWAIT state there is no such problem, since
DCCP_SOCKOPT_SERVER_TIMEWAIT can not be set on a listening socket, it is by default off
and not inherited to child sockets.

Lastly, for PASSIVE_2 the situation is simpler, since this is a client-only state. 

Signed-off-by: Gerrit Renker <gerrit@erg.abdn.ac.uk>
---
 include/linux/dccp.h |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

--- a/include/linux/dccp.h
+++ b/include/linux/dccp.h
@@ -249,14 +249,14 @@ enum dccp_state {
 	 * CLOSING, corresponds to (b) above) are used.
 	 */
 	DCCP_CLOSEREQ	= TCP_FIN_WAIT1,
+	DCCP_PASSIVE_1	= TCP_CLOSE_WAIT,	/* any node receiving a Close */
 	DCCP_CLOSING	= TCP_CLOSING,
 	DCCP_TIME_WAIT	= TCP_TIME_WAIT,
 	DCCP_CLOSED	= TCP_CLOSE,
 	/* Everything below here is specific to DCCP only */
 	DCCP_INTRINSICS = TCP_MAX_STATES,
 	DCCP_PARTOPEN,
-	DCCP_PASSIVE_1,		/* any node receiving a Close  */
-	DCCP_PASSIVE_2,		/* client receiving a CloseReq */
+	DCCP_PASSIVE_2,				/* client receiving CloseReq  */
 	DCCP_MAX_STATES
 };
 

             reply	other threads:[~2007-09-12 14:35 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-09-12 14:35 Gerrit Renker [this message]
2007-09-13  0:25 ` [PATCH 4/5]: DCCP's passive close needs to match TCP's half-close Ian McDonald

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=200709121535.20408@strip-the-willow \
    --to=gerrit@erg.abdn.ac.uk \
    --cc=dccp@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox