From: Vlad Yasevich <vyasevich@gmail.com>
To: Xufeng Zhang <xufengzhang.main@gmail.com>
Cc: Neil Horman <nhorman@tuxdriver.com>,
xufeng zhang <xufeng.zhang@windriver.com>,
sri@us.ibm.com, davem@davemloft.net, linux-sctp@vger.kernel.org,
netdev@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] sctp: Make "Invalid Stream Identifier" ERROR follows SACK when bundling
Date: Fri, 27 Jul 2012 17:22:39 -0400 [thread overview]
Message-ID: <5013069F.3080306@gmail.com> (raw)
In-Reply-To: <CA+=dFzguqjjnnqHO53Mx859VB6NU=4MaPWAUzGQB2qtZGfdAUg@mail.gmail.com>
here is an untested prototype of what I was talking about. This should
handle multiple data chunks.
-vlad
---
include/net/sctp/command.h | 1 +
net/sctp/sm_sideeffect.c | 22 ++++++++++++++++++++++
net/sctp/sm_statefuns.c | 18 ++++++++++--------
3 files changed, 33 insertions(+), 8 deletions(-)
diff --git a/include/net/sctp/command.h b/include/net/sctp/command.h
index 712b3be..4043445 100644
--- a/include/net/sctp/command.h
+++ b/include/net/sctp/command.h
@@ -110,6 +110,7 @@ typedef enum {
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_GEN_BAD_STREAM, /* Issue an Invalid Stream error */
SCTP_CMD_LAST
} sctp_verb_t;
diff --git a/net/sctp/sm_sideeffect.c b/net/sctp/sm_sideeffect.c
index 1ff51c9..c5a1322 100644
--- a/net/sctp/sm_sideeffect.c
+++ b/net/sctp/sm_sideeffect.c
@@ -1036,6 +1036,22 @@ static void sctp_cmd_send_asconf(struct
sctp_association *asoc)
}
}
+static void sctp_cmd_make_inv_stream_err(sctp_cmd_seq_t *commands,
+ struct sctp_association *asoc,
+ struct sctp_chunk *chunk,
+ struct sctp_datahdr *data_hdr)
+{
+ struct sctp_chunk *err;
+
+ err = sctp_make_op_error(asoc, chunk, SCTP_ERROR_INV_STRM,
+ &data_hdr->stream,
+ sizeof(data_hdr->stream),
+ sizeof(u16));
+ if (err)
+ sctp_add_cmd_sf(commands, SCTP_CMD_REPLY,
+ SCTP_CHUNK(err));
+}
+
/* These three macros allow us to pull the debugging code out of the
* main flow of sctp_do_sm() to keep attention focused on the real
@@ -1700,6 +1716,12 @@ static int sctp_cmd_interpreter(sctp_event_t
event_type,
asoc = cmd->obj.asoc;
break;
+ case SCTP_CMD_GEN_BAD_STREAM:
+ sctp_cmd_make_inv_stream_err(commands,
+ asoc, chunk,
+ (struct sctp_datahdr *)cmd->obj.ptr);
+ 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 891f5db..57532e3 100644
--- a/net/sctp/sm_statefuns.c
+++ b/net/sctp/sm_statefuns.c
@@ -2972,6 +2972,12 @@ discard_noforce:
if (chunk->end_of_packet)
sctp_add_cmd_sf(commands, SCTP_CMD_GEN_SACK, force);
+ /* Queue the INVALID STREAM error after the SACK if one is needed. */
+ if (SCTP_IERROR_BAD_STREAM == error) {
+ sctp_add_cmd_sf(commands, SCTP_CMD_GEN_BAD_STREAM,
+ SCTP_PTR(chunk->subh.data_hdr));
+ }
+
return SCTP_DISPOSITION_DISCARD;
consume:
return SCTP_DISPOSITION_CONSUME;
@@ -3044,6 +3050,10 @@ sctp_disposition_t
sctp_sf_eat_data_fast_4_4(const struct sctp_endpoint *ep,
*/
sctp_add_cmd_sf(commands, SCTP_CMD_GEN_SHUTDOWN, SCTP_NULL());
sctp_add_cmd_sf(commands, SCTP_CMD_GEN_SACK, SCTP_FORCE());
+ if (SCTP_IERROR_BAD_STREAM == error) {
+ sctp_add_cmd_sf(commands, SCTP_CMD_GEN_BAD_STREAM,
+ SCTP_PTR(chunk->subh.data_hdr));
+ }
sctp_add_cmd_sf(commands, SCTP_CMD_TIMER_RESTART,
SCTP_TO(SCTP_EVENT_TIMEOUT_T2_SHUTDOWN));
}
@@ -6140,14 +6150,6 @@ static int sctp_eat_data(const struct
sctp_association *asoc,
if (sid >= asoc->c.sinit_max_instreams) {
/* Mark tsn as received even though we drop it */
sctp_add_cmd_sf(commands, SCTP_CMD_REPORT_TSN, SCTP_U32(tsn));
-
- err = sctp_make_op_error(asoc, chunk, SCTP_ERROR_INV_STRM,
- &data_hdr->stream,
- sizeof(data_hdr->stream),
- sizeof(u16));
- if (err)
- sctp_add_cmd_sf(commands, SCTP_CMD_REPLY,
- SCTP_CHUNK(err));
return SCTP_IERROR_BAD_STREAM;
}
-- 1.7.7.6
next prev parent reply other threads:[~2012-07-27 21:22 UTC|newest]
Thread overview: 32+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-07-19 5:57 [PATCH] sctp: Make "Invalid Stream Identifier" ERROR follows SACK when bundling xufengzhang.main
2012-07-22 19:45 ` David Miller
2012-07-23 0:49 ` Neil Horman
2012-07-23 2:30 ` xufeng zhang
2012-07-23 12:14 ` Neil Horman
2012-07-24 1:53 ` Xufeng Zhang
[not found] ` <500DFF5A.20203@windriver.com>
2012-07-24 11:38 ` Neil Horman
2012-07-25 2:34 ` Xufeng Zhang
2012-07-25 11:15 ` Neil Horman
2012-07-23 5:16 ` xufeng zhang
2012-07-24 2:27 ` Vlad Yasevich
2012-07-24 3:02 ` xufeng zhang
2012-07-24 14:05 ` Vlad Yasevich
2012-07-25 2:28 ` Xufeng Zhang
2012-07-25 7:16 ` Vlad Yasevich
2012-07-25 8:05 ` Xufeng Zhang
2012-07-25 9:22 ` Xufeng Zhang
2012-07-25 11:27 ` Neil Horman
2012-07-26 1:34 ` Xufeng Zhang
2012-07-25 15:00 ` Vlad Yasevich
2012-07-26 1:30 ` Xufeng Zhang
2012-07-26 2:45 ` Vlad Yasevich
2012-07-26 2:50 ` Xufeng Zhang
2012-07-26 2:55 ` Vlad Yasevich
2012-07-26 3:12 ` Xufeng Zhang
2012-07-27 21:22 ` Vlad Yasevich [this message]
2012-07-30 4:58 ` Xufeng Zhang
2012-07-30 5:47 ` Xufeng Zhang
2012-07-31 6:17 ` Xufeng Zhang
2012-07-31 6:51 ` xufeng zhang
2012-08-02 21:17 ` Vlad Yasevich
2012-08-03 2:24 ` xufeng zhang
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=5013069F.3080306@gmail.com \
--to=vyasevich@gmail.com \
--cc=davem@davemloft.net \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-sctp@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=nhorman@tuxdriver.com \
--cc=sri@us.ibm.com \
--cc=xufeng.zhang@windriver.com \
--cc=xufengzhang.main@gmail.com \
/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;
as well as URLs for NNTP newsgroup(s).