All of lore.kernel.org
 help / color / mirror / Atom feed
From: Vlad Yasevich <vyasevich@gmail.com>
To: David Laight <David.Laight@ACULAB.COM>,
	"netdev@vger.kernel.org" <netdev@vger.kernel.org>
Subject: Re: SCTP seems to lose its socket state.
Date: Mon, 09 Jun 2014 18:44:59 -0400	[thread overview]
Message-ID: <539638EB.9010802@gmail.com> (raw)
In-Reply-To: <063D6719AE5E284EB5DD2968C1650D6D17259993@AcuExch.aculab.com>

[-- Attachment #1: Type: text/plain, Size: 103 bytes --]

David

Can you try the attached patch and let me know if it solves this problem
for you.

Thanks
-vlad

[-- Attachment #2: 0001-sctp-Handle-association-restart-in-SHUTDOWN-PENDING-.patch --]
[-- Type: text/x-patch, Size: 1700 bytes --]

>From 3f4f0c587c7dd131ea8d34c7c83931500aae6bbc Mon Sep 17 00:00:00 2001
From: Vlad Yasevich <vyasevic@redhat.com>
Date: Mon, 9 Jun 2014 17:38:23 -0400
Subject: [PATCH] sctp: Handle association restart in SHUTDOWN-PENDING state

Signed-off-by: Vlad Yasevich <vyasevic@redhat.com>
---
 net/sctp/sm_statefuns.c | 19 ++++++++++++++++---
 1 file changed, 16 insertions(+), 3 deletions(-)

diff --git a/net/sctp/sm_statefuns.c b/net/sctp/sm_statefuns.c
index 5170a1f..7194fe85 100644
--- a/net/sctp/sm_statefuns.c
+++ b/net/sctp/sm_statefuns.c
@@ -1775,9 +1775,22 @@ static sctp_disposition_t sctp_sf_do_dupcook_a(struct net *net,
 	/* Update the content of current association. */
 	sctp_add_cmd_sf(commands, SCTP_CMD_UPDATE_ASSOC, SCTP_ASOC(new_asoc));
 	sctp_add_cmd_sf(commands, SCTP_CMD_EVENT_ULP, SCTP_ULPEVENT(ev));
-	sctp_add_cmd_sf(commands, SCTP_CMD_NEW_STATE,
-			SCTP_STATE(SCTP_STATE_ESTABLISHED));
-	sctp_add_cmd_sf(commands, SCTP_CMD_REPLY, SCTP_CHUNK(repl));
+	if (sctp_state(asoc, SHUTDOWN_PENDING) &&
+	    (sctp_sstate(asoc->base.sk, CLOSING) ||
+	     sock_flag(asoc->base.sk, SOCK_DEAD))) {
+		/* if were currently in SHUTDOWN_PENDING, but the socket
+		 * has been closed by user, don't transition to ESTABLISHED.
+		 * Instead trigger SHUTDOWN bundled with COOKIE_ACK.
+		 */
+		sctp_add_cmd_sf(commands, SCTP_CMD_REPLY, SCTP_CHUNK(repl));
+		return sctp_sf_do_9_2_start_shutdown(net, ep, asoc,
+						     SCTP_ST_CHUNK(0), NULL,
+						     commands);
+	} else {
+		sctp_add_cmd_sf(commands, SCTP_CMD_NEW_STATE,
+				SCTP_STATE(SCTP_STATE_ESTABLISHED));
+		sctp_add_cmd_sf(commands, SCTP_CMD_REPLY, SCTP_CHUNK(repl));
+	}
 	return SCTP_DISPOSITION_CONSUME;
 
 nomem_ev:
-- 
1.9.0


  parent reply	other threads:[~2014-06-09 22:45 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-05-27 15:10 SCTP seems to lose its socket state David Laight
2014-05-28 20:18 ` Vlad Yasevich
2014-05-29  9:03   ` David Laight
2014-05-29  9:12     ` Daniel Borkmann
2014-06-06 15:14 ` David Laight
2014-06-06 16:24   ` David Laight
2014-06-06 16:50   ` Vlad Yasevich
2014-06-09 12:49   ` David Laight
2014-06-09 18:37     ` Vlad Yasevich
2014-06-10  8:29       ` David Laight
2014-06-09 22:44     ` Vlad Yasevich [this message]
2014-06-13 10:53       ` David Laight
2014-06-13 18:48         ` Vlad Yasevich
2014-06-16  8:40           ` David Laight
2014-06-16 13:47             ` Vlad Yasevich
2014-06-16 14:46               ` David Laight
2014-06-17 11:28             ` Neil Horman

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=539638EB.9010802@gmail.com \
    --to=vyasevich@gmail.com \
    --cc=David.Laight@ACULAB.COM \
    --cc=netdev@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.