diff options
author | Florian Westphal <fw@strlen.de> | 2008-03-24 01:21:28 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2008-03-24 01:21:28 -0400 |
commit | 2051f11fb86b0056fec440fe7e9fa8370d60a5c6 (patch) | |
tree | e93befbb8fb6590994b51aa213bf9596c0070bc1 | |
parent | 310afe86af8ddd96a06b75aa61ef1af233f80e89 (diff) |
[TCP]: Shrink syncookie_secret by 8 byte.
the first u32 copied from syncookie_secret is overwritten by the
minute-counter four lines below. After adjusting the destination
address, the size of syncookie_secret can be reduced accordingly.
AFAICS, the only other user of syncookie_secret[] is the ipv6
syncookie support. Because ipv6 syncookies only grab 44 bytes from
syncookie_secret[], this shouldn't affect them in any way.
With fixes from Glenn Griffin.
Signed-off-by: Florian Westphal <fw@strlen.de>
Acked-by: Glenn Griffin <ggriffin.kernel@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r-- | include/net/tcp.h | 2 | ||||
-rw-r--r-- | net/ipv4/syncookies.c | 4 | ||||
-rw-r--r-- | net/ipv6/syncookies.c | 2 |
3 files changed, 4 insertions, 4 deletions
diff --git a/include/net/tcp.h b/include/net/tcp.h index 67cc3956d29c..723b36851dde 100644 --- a/include/net/tcp.h +++ b/include/net/tcp.h | |||
@@ -436,7 +436,7 @@ extern int tcp_disconnect(struct sock *sk, int flags); | |||
436 | extern void tcp_unhash(struct sock *sk); | 436 | extern void tcp_unhash(struct sock *sk); |
437 | 437 | ||
438 | /* From syncookies.c */ | 438 | /* From syncookies.c */ |
439 | extern __u32 syncookie_secret[2][16-3+SHA_DIGEST_WORDS]; | 439 | extern __u32 syncookie_secret[2][16-4+SHA_DIGEST_WORDS]; |
440 | extern struct sock *cookie_v4_check(struct sock *sk, struct sk_buff *skb, | 440 | extern struct sock *cookie_v4_check(struct sock *sk, struct sk_buff *skb, |
441 | struct ip_options *opt); | 441 | struct ip_options *opt); |
442 | extern __u32 cookie_v4_init_sequence(struct sock *sk, struct sk_buff *skb, | 442 | extern __u32 cookie_v4_init_sequence(struct sock *sk, struct sk_buff *skb, |
diff --git a/net/ipv4/syncookies.c b/net/ipv4/syncookies.c index 4704f27f6c0b..abc752d45cf7 100644 --- a/net/ipv4/syncookies.c +++ b/net/ipv4/syncookies.c | |||
@@ -21,7 +21,7 @@ | |||
21 | 21 | ||
22 | extern int sysctl_tcp_syncookies; | 22 | extern int sysctl_tcp_syncookies; |
23 | 23 | ||
24 | __u32 syncookie_secret[2][16-3+SHA_DIGEST_WORDS]; | 24 | __u32 syncookie_secret[2][16-4+SHA_DIGEST_WORDS]; |
25 | EXPORT_SYMBOL(syncookie_secret); | 25 | EXPORT_SYMBOL(syncookie_secret); |
26 | 26 | ||
27 | static __init int init_syncookies(void) | 27 | static __init int init_syncookies(void) |
@@ -41,7 +41,7 @@ static u32 cookie_hash(__be32 saddr, __be32 daddr, __be16 sport, __be16 dport, | |||
41 | { | 41 | { |
42 | __u32 *tmp = __get_cpu_var(cookie_scratch); | 42 | __u32 *tmp = __get_cpu_var(cookie_scratch); |
43 | 43 | ||
44 | memcpy(tmp + 3, syncookie_secret[c], sizeof(syncookie_secret[c])); | 44 | memcpy(tmp + 4, syncookie_secret[c], sizeof(syncookie_secret[c])); |
45 | tmp[0] = (__force u32)saddr; | 45 | tmp[0] = (__force u32)saddr; |
46 | tmp[1] = (__force u32)daddr; | 46 | tmp[1] = (__force u32)daddr; |
47 | tmp[2] = ((__force u32)sport << 16) + (__force u32)dport; | 47 | tmp[2] = ((__force u32)sport << 16) + (__force u32)dport; |
diff --git a/net/ipv6/syncookies.c b/net/ipv6/syncookies.c index 827c5aa7524c..3a622e7abc02 100644 --- a/net/ipv6/syncookies.c +++ b/net/ipv6/syncookies.c | |||
@@ -22,7 +22,7 @@ | |||
22 | #include <net/tcp.h> | 22 | #include <net/tcp.h> |
23 | 23 | ||
24 | extern int sysctl_tcp_syncookies; | 24 | extern int sysctl_tcp_syncookies; |
25 | extern __u32 syncookie_secret[2][16-3+SHA_DIGEST_WORDS]; | 25 | extern __u32 syncookie_secret[2][16-4+SHA_DIGEST_WORDS]; |
26 | 26 | ||
27 | #define COOKIEBITS 24 /* Upper bits store count */ | 27 | #define COOKIEBITS 24 /* Upper bits store count */ |
28 | #define COOKIEMASK (((__u32)1 << COOKIEBITS) - 1) | 28 | #define COOKIEMASK (((__u32)1 << COOKIEBITS) - 1) |