Move the tdb pool init into an init function.
OK mvs@
-/* $OpenBSD: ip_ipsp.c,v 1.244 2021/07/27 17:13:03 mvs Exp $ */
+/* $OpenBSD: ip_ipsp.c,v 1.245 2021/09/29 22:08:13 bluhm Exp $ */
/*
* The authors of this code are John Ioannidis (ji@tla.org),
* Angelos D. Keromytis (kermit@csd.uch.gr),
static u_int tdb_hashmask = TDB_HASHSIZE_INIT - 1;
static int tdb_count;
+void
+ipsp_init(void)
+{
+ pool_init(&tdb_pool, sizeof(struct tdb), 0, IPL_SOFTNET, 0,
+ "tdb", NULL);
+}
+
/*
* Our hashing function needs to stir things with a non-zero random multiplier
* so we cannot be DoS-attacked via choosing of the data to hash.
tdb_alloc(u_int rdomain)
{
struct tdb *tdbp;
- static int initialized = 0;
NET_ASSERT_LOCKED();
- if (!initialized) {
- pool_init(&tdb_pool, sizeof(struct tdb), 0, IPL_SOFTNET, 0,
- "tdb", NULL);
- initialized = 1;
- }
tdbp = pool_get(&tdb_pool, PR_WAITOK | PR_ZERO);
TAILQ_INIT(&tdbp->tdb_policy_head);
-/* $OpenBSD: ip_ipsp.h,v 1.206 2021/08/10 21:29:53 mvs Exp $ */
+/* $OpenBSD: ip_ipsp.h,v 1.207 2021/09/29 22:08:13 bluhm Exp $ */
/*
* The authors of this code are John Ioannidis (ji@tla.org),
* Angelos D. Keromytis (kermit@csd.uch.gr),
struct ipsec_ids *ipsp_ids_lookup(u_int32_t);
void ipsp_ids_free(struct ipsec_ids *);
+void ipsp_init(void);
void ipsec_init(void);
int ipsec_sysctl(int *, u_int, void *, size_t *, void *, size_t);
int ipsec_common_input(struct mbuf *, int, int, int, int, int);
-/* $OpenBSD: ipsec_input.c,v 1.179 2021/07/27 17:13:03 mvs Exp $ */
+/* $OpenBSD: ipsec_input.c,v 1.180 2021/09/29 22:08:13 bluhm Exp $ */
/*
* The authors of this code are John Ioannidis (ji@tla.org),
* Angelos D. Keromytis (kermit@csd.uch.gr) and
strlcpy(ipsec_def_auth, IPSEC_DEFAULT_DEF_AUTH, sizeof(ipsec_def_auth));
strlcpy(ipsec_def_comp, IPSEC_DEFAULT_DEF_COMP, sizeof(ipsec_def_comp));
+ ipsp_init();
}
/*