netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] sctp: deal with multiple COOKIE_ECHO chunks
@ 2011-08-30  7:02 Max Matveev
  2011-09-16 21:17 ` David Miller
  0 siblings, 1 reply; 4+ messages in thread
From: Max Matveev @ 2011-08-30  7:02 UTC (permalink / raw)
  To: linux-sctp; +Cc: netdev, vladislav.yasevich

Attempt to reduce the number of IP packets emitted in response to single
SCTP packet (2e3216cd) introduced a complication - if a packet contains
two COOKIE_ECHO chunks and nothing else then SCTP state machine corks the
socket while processing first COOKIE_ECHO and then loses the association
and forgets to uncork the socket. To deal with the issue add new SCTP
command which can be used to set association explictly. Use this new
command when processing second COOKIE_ECHO chunk to restore the context
for SCTP state machine.

Signed-off-by: Max Matveev <makc@redhat.com>
---
 include/net/sctp/command.h |    1 +
 net/sctp/sm_sideeffect.c   |    5 +++++
 net/sctp/sm_statefuns.c    |    6 ++++++
 3 files changed, 12 insertions(+), 0 deletions(-)

diff --git a/include/net/sctp/command.h b/include/net/sctp/command.h
index 6506458..712b3be 100644
--- a/include/net/sctp/command.h
+++ b/include/net/sctp/command.h
@@ -109,6 +109,7 @@ typedef enum {
 	SCTP_CMD_SEND_MSG,	 /* Send the whole use message */
 	SCTP_CMD_SEND_NEXT_ASCONF, /* Send the next ASCONF after ACK */
 	SCTP_CMD_PURGE_ASCONF_QUEUE, /* Purge all asconf queues.*/
+	SCTP_CMD_SET_ASOC,	 /* Restore association context */
 	SCTP_CMD_LAST
 } sctp_verb_t;
 
diff --git a/net/sctp/sm_sideeffect.c b/net/sctp/sm_sideeffect.c
index 167c880..76388b0 100644
--- a/net/sctp/sm_sideeffect.c
+++ b/net/sctp/sm_sideeffect.c
@@ -1689,6 +1689,11 @@ static int sctp_cmd_interpreter(sctp_event_t event_type,
 		case SCTP_CMD_PURGE_ASCONF_QUEUE:
 			sctp_asconf_queue_teardown(asoc);
 			break;
+
+		case SCTP_CMD_SET_ASOC:
+			asoc = cmd->obj.asoc;
+			break;
+
 		default:
 			pr_warn("Impossible command: %u, %p\n",
 				cmd->verb, cmd->obj.ptr);
diff --git a/net/sctp/sm_statefuns.c b/net/sctp/sm_statefuns.c
index 49b847b..1949703 100644
--- a/net/sctp/sm_statefuns.c
+++ b/net/sctp/sm_statefuns.c
@@ -2047,6 +2047,12 @@ sctp_disposition_t sctp_sf_do_5_2_4_dupcook(const struct sctp_endpoint *ep,
 	sctp_add_cmd_sf(commands, SCTP_CMD_NEW_ASOC, SCTP_ASOC(new_asoc));
 	sctp_add_cmd_sf(commands, SCTP_CMD_DELETE_TCB, SCTP_NULL());
 
+	/* Restore association pointer to provide SCTP command interpeter 
+ 	 * with a valid context in case it needs to manipulate 
+ 	 * the queues */
+	sctp_add_cmd_sf(commands, SCTP_CMD_SET_ASOC,
+			 SCTP_ASOC((struct sctp_association *)asoc));
+
 	return retval;
 
 nomem:
-- 
1.7.4.4

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] sctp: deal with multiple COOKIE_ECHO chunks
  2011-08-30  7:02 [PATCH] sctp: deal with multiple COOKIE_ECHO chunks Max Matveev
@ 2011-09-16 21:17 ` David Miller
  2011-09-17  4:38   ` Max Matveev
  0 siblings, 1 reply; 4+ messages in thread
From: David Miller @ 2011-09-16 21:17 UTC (permalink / raw)
  To: makc; +Cc: linux-sctp, netdev, vladislav.yasevich

From: Max Matveev <makc@redhat.com>
Date: Tue, 30 Aug 2011 17:02:24 +1000

> Attempt to reduce the number of IP packets emitted in response to single
> SCTP packet (2e3216cd) introduced a complication - if a packet contains
> two COOKIE_ECHO chunks and nothing else then SCTP state machine corks the
> socket while processing first COOKIE_ECHO and then loses the association
> and forgets to uncork the socket. To deal with the issue add new SCTP
> command which can be used to set association explictly. Use this new
> command when processing second COOKIE_ECHO chunk to restore the context
> for SCTP state machine.
> 
> Signed-off-by: Max Matveev <makc@redhat.com>

Applied, but there were a ton of whitespace errors that GIT complained
about and I had to fix up.

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] sctp: deal with multiple COOKIE_ECHO chunks
  2011-09-16 21:17 ` David Miller
@ 2011-09-17  4:38   ` Max Matveev
  2011-09-17  5:02     ` David Miller
  0 siblings, 1 reply; 4+ messages in thread
From: Max Matveev @ 2011-09-17  4:38 UTC (permalink / raw)
  To: David Miller; +Cc: linux-sctp, netdev, vladislav.yasevich

On Fri, 16 Sep 2011 17:17:47 -0400 (EDT), David Miller wrote:

 davem> From: Max Matveev <makc@redhat.com>
 davem> Date: Tue, 30 Aug 2011 17:02:24 +1000

 >> Attempt to reduce the number of IP packets emitted in response to single
 >> SCTP packet (2e3216cd) introduced a complication - if a packet contains
 >> two COOKIE_ECHO chunks and nothing else then SCTP state machine corks the
 >> socket while processing first COOKIE_ECHO and then loses the association
 >> and forgets to uncork the socket. To deal with the issue add new SCTP
 >> command which can be used to set association explictly. Use this new
 >> command when processing second COOKIE_ECHO chunk to restore the context
 >> for SCTP state machine.
 >> 
 >> Signed-off-by: Max Matveev <makc@redhat.com>

 davem> Applied, but there were a ton of whitespace errors that GIT complained
 davem> about and I had to fix up.

Sorry about it - I did check it with checkpatch.pl and it was happy:
must've been the mailer.

max

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] sctp: deal with multiple COOKIE_ECHO chunks
  2011-09-17  4:38   ` Max Matveev
@ 2011-09-17  5:02     ` David Miller
  0 siblings, 0 replies; 4+ messages in thread
From: David Miller @ 2011-09-17  5:02 UTC (permalink / raw)
  To: makc; +Cc: linux-sctp, netdev, vladislav.yasevich

From: Max Matveev <makc@redhat.com>
Date: Sat, 17 Sep 2011 14:38:27 +1000

> Sorry about it - I did check it with checkpatch.pl and it was happy:

checkpatch doesn't look thoroughly for these things, use
something like "git apply --check --whitespace=error-all"
for validation instead.

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2011-09-17  5:02 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-08-30  7:02 [PATCH] sctp: deal with multiple COOKIE_ECHO chunks Max Matveev
2011-09-16 21:17 ` David Miller
2011-09-17  4:38   ` Max Matveev
2011-09-17  5:02     ` David Miller

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).