summaryrefslogtreecommitdiff
path: root/sys/net/pf_table.c
diff options
context:
space:
mode:
authorDaniel Hartmeier <dhartmei@cvs.openbsd.org>2005-05-23 23:28:54 +0000
committerDaniel Hartmeier <dhartmei@cvs.openbsd.org>2005-05-23 23:28:54 +0000
commit67d5d5df908f4046555fd26bb76d0de14e2dc020 (patch)
tree4560aca88773f1218e119c4fc6b35a5c2afbe2ef /sys/net/pf_table.c
parent11c3b81d9bd45104041e17bc1486f0043664016a (diff)
change pool allocation of table entries, no longer use the oldnointr
allocator and two pools, but PR_WAITOK when called from non-interrupt context (ioctl). add configurable hard limits for tables and table entries (set limit tables/table-entries), defaulting to 1000/100000. ok aaron@, henning@, mcbride@, art@
Diffstat (limited to 'sys/net/pf_table.c')
-rw-r--r--sys/net/pf_table.c22
1 files changed, 7 insertions, 15 deletions
diff --git a/sys/net/pf_table.c b/sys/net/pf_table.c
index f456dc9e1c4..0bb46dfc021 100644
--- a/sys/net/pf_table.c
+++ b/sys/net/pf_table.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: pf_table.c,v 1.63 2005/05/23 20:47:02 henning Exp $ */
+/* $OpenBSD: pf_table.c,v 1.64 2005/05/23 23:28:53 dhartmei Exp $ */
/*
* Copyright (c) 2002 Cedric Berger
@@ -125,7 +125,6 @@ struct pfr_walktree {
struct pool pfr_ktable_pl;
struct pool pfr_kentry_pl;
-struct pool pfr_kentry_pl2;
struct sockaddr_in pfr_sin;
struct sockaddr_in6 pfr_sin6;
union sockaddr_union pfr_mask;
@@ -189,11 +188,9 @@ void
pfr_initialize(void)
{
pool_init(&pfr_ktable_pl, sizeof(struct pfr_ktable), 0, 0, 0,
- "pfrktable", &pool_allocator_oldnointr);
+ "pfrktable", NULL);
pool_init(&pfr_kentry_pl, sizeof(struct pfr_kentry), 0, 0, 0,
- "pfrkentry", &pool_allocator_oldnointr);
- pool_init(&pfr_kentry_pl2, sizeof(struct pfr_kentry), 0, 0, 0,
- "pfrkentry2", NULL);
+ "pfrkentry", NULL);
pfr_sin.sin_len = sizeof(pfr_sin);
pfr_sin.sin_family = AF_INET;
@@ -796,10 +793,8 @@ pfr_create_kentry(struct pfr_addr *ad, int intr)
{
struct pfr_kentry *ke;
- if (intr)
- ke = pool_get(&pfr_kentry_pl2, PR_NOWAIT);
- else
- ke = pool_get(&pfr_kentry_pl, PR_NOWAIT);
+ ke = pool_get(&pfr_kentry_pl, intr ? PR_NOWAIT :
+ (PR_WAITOK | PR_LIMITFAIL));
if (ke == NULL)
return (NULL);
bzero(ke, sizeof(*ke));
@@ -829,10 +824,7 @@ pfr_destroy_kentries(struct pfr_kentryworkq *workq)
void
pfr_destroy_kentry(struct pfr_kentry *ke)
{
- if (ke->pfrke_intrpool)
- pool_put(&pfr_kentry_pl2, ke);
- else
- pool_put(&pfr_kentry_pl, ke);
+ pool_put(&pfr_kentry_pl, ke);
}
void
@@ -1875,7 +1867,7 @@ pfr_create_ktable(struct pfr_table *tbl, long tzero, int attachruleset)
struct pfr_ktable *kt;
struct pf_ruleset *rs;
- kt = pool_get(&pfr_ktable_pl, PR_NOWAIT);
+ kt = pool_get(&pfr_ktable_pl, PR_WAITOK | PR_LIMITFAIL);
if (kt == NULL)
return (NULL);
bzero(kt, sizeof(*kt));