From: Gerrit Renker <gerrit@erg.abdn.ac.uk>
To: "Arnaldo Carvalho de Melo" <arnaldo.melo@gmail.com>
Cc: davem@davemloft.net, netdev@vger.kernel.org
Subject: [PATCH 2.6.19] net/dccp: set safe upper bound for option length
Date: Fri, 22 Sep 2006 15:45:03 +0100 [thread overview]
Message-ID: <200609221545.03112@strip-the-willow> (raw)
[DCCP]: current upper limit for option length is 128 bytes;
much less than actually possible. This patch sets a safe upper
bound on option length of 992, under worst-case assumptions.
This patches against the 2.6.19 tree by David.
Signed-off-by: Gerrit Renker <gerrit@erg.abdn.ac.uk>
---
dccp.h | 17 +++++++++++------
1 file changed, 11 insertions(+), 6 deletions(-)
diff --git a/net/dccp/dccp.h b/net/dccp/dccp.h
index 272e858..adabf3e 100644
--- a/net/dccp/dccp.h
+++ b/net/dccp/dccp.h
@@ -40,12 +40,17 @@ extern void dccp_tw_deschedule(struct in
extern void dccp_time_wait(struct sock *sk, int state, int timeo);
-/* FIXME: Right size this */
-#define DCCP_MAX_OPT_LEN 128
-
-#define DCCP_MAX_PACKET_HDR 32
-
-#define MAX_DCCP_HEADER (DCCP_MAX_PACKET_HDR + DCCP_MAX_OPT_LEN + MAX_HEADER)
+/*
+ * Set safe upper bounds for header and option length. Since Data Offset is 8
+ * bits (RFC 4340, sec. 5.1), the total header length can never be more than
+ * 8 * 255 = 1020 bytes. The largest possible header length is 28 bytes (X=1):
+ * - DCCP-Response with ACK Subheader and 4 bytes of Service code OR
+ * - DCCP-Reset with ACK Subheader and 4 bytes of Reset Code fields
+ * Hence a safe upper bound for the maximum option length is 1020-28 = 992
+ */
+#define DCCP_MAX_OPT_LEN 992
+#define DCCP_MAX_PACKET_HDR 28
+#define MAX_DCCP_HEADER (1020 + MAX_HEADER)
#define DCCP_TIMEWAIT_LEN (60 * HZ) /* how long to wait to destroy TIME-WAIT
* state, about 60 seconds */
next reply other threads:[~2006-09-22 14:45 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-09-22 14:45 Gerrit Renker [this message]
2006-09-22 14:48 ` [PATCH 2.6.19] net/dccp: set safe upper bound for option length Gerrit Renker
2006-09-22 14:50 ` Arnaldo Carvalho de Melo
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=200609221545.03112@strip-the-willow \
--to=gerrit@erg.abdn.ac.uk \
--cc=arnaldo.melo@gmail.com \
--cc=davem@davemloft.net \
--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 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).