diff options
author | Gerrit Renker <gerrit@erg.abdn.ac.uk> | 2006-11-09 23:13:56 -0500 |
---|---|---|
committer | David S. Miller <davem@sunset.davemloft.net> | 2006-12-03 00:21:53 -0500 |
commit | 60361be1be7854cbffb6dc268d1bc094da33431c (patch) | |
tree | 58109e5c2020acfafd3c3e140620b7a93f0384ac /net/dccp/dccp.h | |
parent | 931731123a103cfb3f70ac4b7abfc71d94ba1f03 (diff) |
[DCCP]: set safe upper bound for option length
This is a re-send from
http://www.mail-archive.com/dccp@vger.kernel.org/msg00553.html
It is the same patch as before, but I have built in Arnaldo's suggestions
pointed out in that posting.
Signed-off-by: Gerrit Renker <gerrit@erg.abdn.ac.uk>
Signed-off-by: Arnaldo Carvalho de Melo <acme@mandriva.com>
Diffstat (limited to 'net/dccp/dccp.h')
-rw-r--r-- | net/dccp/dccp.h | 18 |
1 files changed, 12 insertions, 6 deletions
diff --git a/net/dccp/dccp.h b/net/dccp/dccp.h index 272e8584564e..9f00dd807e04 100644 --- a/net/dccp/dccp.h +++ b/net/dccp/dccp.h | |||
@@ -40,12 +40,18 @@ extern void dccp_tw_deschedule(struct inet_timewait_sock *tw); | |||
40 | 40 | ||
41 | extern void dccp_time_wait(struct sock *sk, int state, int timeo); | 41 | extern void dccp_time_wait(struct sock *sk, int state, int timeo); |
42 | 42 | ||
43 | /* FIXME: Right size this */ | 43 | /* |
44 | #define DCCP_MAX_OPT_LEN 128 | 44 | * Set safe upper bounds for header and option length. Since Data Offset is 8 |
45 | 45 | * bits (RFC 4340, sec. 5.1), the total header length can never be more than | |
46 | #define DCCP_MAX_PACKET_HDR 32 | 46 | * 4 * 255 = 1020 bytes. The largest possible header length is 28 bytes (X=1): |
47 | 47 | * - DCCP-Response with ACK Subheader and 4 bytes of Service code OR | |
48 | #define MAX_DCCP_HEADER (DCCP_MAX_PACKET_HDR + DCCP_MAX_OPT_LEN + MAX_HEADER) | 48 | * - DCCP-Reset with ACK Subheader and 4 bytes of Reset Code fields |
49 | * Hence a safe upper bound for the maximum option length is 1020-28 = 992 | ||
50 | */ | ||
51 | #define MAX_DCCP_SPECIFIC_HEADER (255 * sizeof(int)) | ||
52 | #define DCCP_MAX_PACKET_HDR 28 | ||
53 | #define DCCP_MAX_OPT_LEN (MAX_DCCP_SPECIFIC_HEADER - DCCP_MAX_PACKET_HDR) | ||
54 | #define MAX_DCCP_HEADER (MAX_DCCP_SPECIFIC_HEADER + MAX_HEADER) | ||
49 | 55 | ||
50 | #define DCCP_TIMEWAIT_LEN (60 * HZ) /* how long to wait to destroy TIME-WAIT | 56 | #define DCCP_TIMEWAIT_LEN (60 * HZ) /* how long to wait to destroy TIME-WAIT |
51 | * state, about 60 seconds */ | 57 | * state, about 60 seconds */ |