summaryrefslogtreecommitdiffstats
path: root/sys/netinet/tcp_input.c
diff options
context:
space:
mode:
authorbluhm <bluhm@openbsd.org>2015-08-24 23:31:35 +0000
committerbluhm <bluhm@openbsd.org>2015-08-24 23:31:35 +0000
commit247e40d955a0e5057d462b5bd42d7630857cbc45 (patch)
tree7babddaeb47565a83e6d335f70d3b5fc18a693ab /sys/netinet/tcp_input.c
parentnd6_prefix_add() is no longer used and die. (diff)
downloadwireguard-openbsd-247e40d955a0e5057d462b5bd42d7630857cbc45.tar.xz
wireguard-openbsd-247e40d955a0e5057d462b5bd42d7630857cbc45.zip
Set the required IPL at the syn-cache pool instead of doing a
splsoftnet() explicitly. The function syn_cache_lookup() is always called at IPL_SOFTNET so a splsoftassert() is better than a needless splsoftnet(). OK markus@ dlg@
Diffstat (limited to 'sys/netinet/tcp_input.c')
-rw-r--r--sys/netinet/tcp_input.c15
1 files changed, 5 insertions, 10 deletions
diff --git a/sys/netinet/tcp_input.c b/sys/netinet/tcp_input.c
index 1c9bdbee67f..0792b547164 100644
--- a/sys/netinet/tcp_input.c
+++ b/sys/netinet/tcp_input.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: tcp_input.c,v 1.300 2015/08/24 15:37:03 bluhm Exp $ */
+/* $OpenBSD: tcp_input.c,v 1.301 2015/08/24 23:31:35 bluhm Exp $ */
/* $NetBSD: tcp_input.c,v 1.23 1996/02/13 23:43:44 christos Exp $ */
/*
@@ -3370,6 +3370,7 @@ syn_cache_init()
/* Initialize the syn cache pool. */
pool_init(&syn_cache_pool, sizeof(struct syn_cache), 0, 0, 0,
"syncache", NULL);
+ pool_setipl(&syn_cache_pool, IPL_SOFTNET);
}
void
@@ -3521,11 +3522,8 @@ void
syn_cache_reaper(void *arg)
{
struct syn_cache *sc = arg;
- int s;
- s = splsoftnet();
pool_put(&syn_cache_pool, (sc));
- splx(s);
return;
}
@@ -3566,7 +3564,8 @@ syn_cache_lookup(struct sockaddr *src, struct sockaddr *dst,
struct syn_cache *sc;
struct syn_cache_head *scp;
u_int32_t hash;
- int s;
+
+ splsoftassert(IPL_SOFTNET);
if (tcp_syn_cache_count == 0)
return (NULL);
@@ -3574,18 +3573,14 @@ syn_cache_lookup(struct sockaddr *src, struct sockaddr *dst,
SYN_HASHALL(hash, src, dst);
scp = &tcp_syn_cache[hash % tcp_syn_cache_size];
*headp = scp;
- s = splsoftnet();
TAILQ_FOREACH(sc, &scp->sch_bucket, sc_bucketq) {
if (sc->sc_hash != hash)
continue;
if (!bcmp(&sc->sc_src, src, src->sa_len) &&
!bcmp(&sc->sc_dst, dst, dst->sa_len) &&
- rtable_l2(rtableid) == rtable_l2(sc->sc_rtableid)) {
- splx(s);
+ rtable_l2(rtableid) == rtable_l2(sc->sc_rtableid))
return (sc);
- }
}
- splx(s);
return (NULL);
}