summaryrefslogtreecommitdiff
path: root/sys
diff options
context:
space:
mode:
authormvs <mvs@cvs.openbsd.org>2021-07-08 16:39:56 +0000
committermvs <mvs@cvs.openbsd.org>2021-07-08 16:39:56 +0000
commit2d0a28dcbb3a4b0f4d9c6f71f779c85587aef96a (patch)
tree2762d9dc6d3c8e7c5269783184ed16b6e54a68dc /sys
parent9ef2faa8d5965726ba78d1f1d2753f633ac93ecb (diff)
Initialize `ipsec_acquire_pool' pool (9) within pfkey_init() instead of
doing that in runtime within ipsp_acquire_sa(). ok bluhm@
Diffstat (limited to 'sys')
-rw-r--r--sys/net/pfkeyv2.c4
-rw-r--r--sys/net/pfkeyv2.h3
-rw-r--r--sys/netinet/ip_spd.c9
3 files changed, 6 insertions, 10 deletions
diff --git a/sys/net/pfkeyv2.c b/sys/net/pfkeyv2.c
index 66ab56eb624..d81d9e0e525 100644
--- a/sys/net/pfkeyv2.c
+++ b/sys/net/pfkeyv2.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: pfkeyv2.c,v 1.216 2021/07/05 12:01:20 tobhe Exp $ */
+/* $OpenBSD: pfkeyv2.c,v 1.217 2021/07/08 16:39:55 mvs Exp $ */
/*
* @(#)COPYRIGHT 1.1 (NRL) 17 January 1995
@@ -249,6 +249,8 @@ pfkey_init(void)
IPL_SOFTNET, PR_WAITOK, "pkpcb", NULL);
pool_init(&ipsec_policy_pool, sizeof(struct ipsec_policy), 0,
IPL_SOFTNET, 0, "ipsec policy", NULL);
+ pool_init(&ipsec_acquire_pool, sizeof(struct ipsec_acquire), 0,
+ IPL_SOFTNET, 0, "ipsec acquire", NULL);
}
diff --git a/sys/net/pfkeyv2.h b/sys/net/pfkeyv2.h
index 3326ae8b385..2c68cb2d863 100644
--- a/sys/net/pfkeyv2.h
+++ b/sys/net/pfkeyv2.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: pfkeyv2.h,v 1.88 2021/07/05 12:01:20 tobhe Exp $ */
+/* $OpenBSD: pfkeyv2.h,v 1.89 2021/07/08 16:39:55 mvs Exp $ */
/*
* @(#)COPYRIGHT 1.1 (NRL) January 1998
*
@@ -449,6 +449,7 @@ extern const uint64_t sadb_exts_allowed_out[SADB_MAX+1];
extern const uint64_t sadb_exts_required_out[SADB_MAX+1];
extern struct pool ipsec_policy_pool;
+extern struct pool ipsec_acquire_pool;
#endif /* _KERNEL */
#endif /* _NET_PFKEY_V2_H_ */
diff --git a/sys/netinet/ip_spd.c b/sys/netinet/ip_spd.c
index 844621dac7e..afd7586cb1e 100644
--- a/sys/netinet/ip_spd.c
+++ b/sys/netinet/ip_spd.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ip_spd.c,v 1.103 2021/05/04 09:28:04 mvs Exp $ */
+/* $OpenBSD: ip_spd.c,v 1.104 2021/07/08 16:39:55 mvs Exp $ */
/*
* The author of this code is Angelos D. Keromytis (angelos@cis.upenn.edu)
*
@@ -52,7 +52,6 @@ struct pool ipsec_policy_pool;
struct pool ipsec_acquire_pool;
/* Protected by the NET_LOCK(). */
-int ipsec_acquire_pool_initialized = 0;
struct radix_node_head **spd_tables;
unsigned int spd_table_max;
TAILQ_HEAD(ipsec_acquire_head, ipsec_acquire) ipsec_acquire_head =
@@ -719,12 +718,6 @@ ipsp_acquire_sa(struct ipsec_policy *ipo, union sockaddr_union *gw,
return 0;
/* Add request in cache and proceed. */
- if (ipsec_acquire_pool_initialized == 0) {
- ipsec_acquire_pool_initialized = 1;
- pool_init(&ipsec_acquire_pool, sizeof(struct ipsec_acquire),
- 0, IPL_SOFTNET, 0, "ipsec acquire", NULL);
- }
-
ipa = pool_get(&ipsec_acquire_pool, PR_NOWAIT|PR_ZERO);
if (ipa == NULL)
return ENOMEM;