summaryrefslogtreecommitdiffstats
path: root/sys/netinet
diff options
context:
space:
mode:
authorandre <andre@FreeBSD.org>2006-06-22 15:07:45 +0000
committerandre <andre@FreeBSD.org>2006-06-22 15:07:45 +0000
commitb23e67a0d594e595d95ae693e6c9c30236893e2e (patch)
tree3b407e2d76d2cc8f13fc408ea99e1df6fb23346a /sys/netinet
parent8d75058136bca66e08edfd0336591819bafa07d1 (diff)
downloadFreeBSD-src-b23e67a0d594e595d95ae693e6c9c30236893e2e.zip
FreeBSD-src-b23e67a0d594e595d95ae693e6c9c30236893e2e.tar.gz
Move the syncookie MD5 context from globals to the stack to make it MP safe.
Diffstat (limited to 'sys/netinet')
-rw-r--r--sys/netinet/tcp_syncache.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/sys/netinet/tcp_syncache.c b/sys/netinet/tcp_syncache.c
index 12610ef..b2d3f46 100644
--- a/sys/netinet/tcp_syncache.c
+++ b/sys/netinet/tcp_syncache.c
@@ -1289,8 +1289,6 @@ static struct {
static int tcp_msstab[] = { 0, 536, 1460, 8960 };
-static MD5_CTX syn_ctx;
-
#define MD5Add(v) MD5Update(&syn_ctx, (u_char *)&v, sizeof(v))
struct md5_add {
@@ -1329,6 +1327,7 @@ syncookie_generate(struct syncache *sc, u_int32_t *flowid)
u_int32_t data;
int idx, i;
struct md5_add add;
+ MD5_CTX syn_ctx;
idx = ((ticks << SYNCOOKIE_TIMESHIFT) / hz) & SYNCOOKIE_WNDMASK;
SYNCOOKIE_RLOCK(tcp_secret[idx]);
@@ -1380,6 +1379,7 @@ syncookie_lookup(struct in_conninfo *inc, struct tcphdr *th, struct socket *so)
u_int32_t data;
int wnd, idx;
struct md5_add add;
+ MD5_CTX syn_ctx;
data = (th->th_ack - 1) ^ (th->th_seq - 1); /* remove ISS */
idx = data & SYNCOOKIE_WNDMASK;
OpenPOWER on IntegriCloud