summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorcsjp <csjp@FreeBSD.org>2012-01-14 22:51:34 +0000
committercsjp <csjp@FreeBSD.org>2012-01-14 22:51:34 +0000
commit1ea7d0d666a38d5bda1efae01c48a1f3142a416c (patch)
treed72cccbf97b07265bd21a4b64a051d62708990e1
parentb166a3a40945da4deadb3a68f1dce05af6a574b8 (diff)
downloadFreeBSD-src-1ea7d0d666a38d5bda1efae01c48a1f3142a416c.zip
FreeBSD-src-1ea7d0d666a38d5bda1efae01c48a1f3142a416c.tar.gz
Revert to the old behavior of allocating table/table entries using
M_NOWAIT. Currently, the code allows for sleeping in the ioctl path to guarantee allocation. However code also handles ENOMEM gracefully, so propagate this error back to user-space, rather than sleeping while holding the global pf mutex. Reviewed by: glebius Discussed with: bz
-rw-r--r--sys/contrib/pf/net/pf_table.c16
1 files changed, 4 insertions, 12 deletions
diff --git a/sys/contrib/pf/net/pf_table.c b/sys/contrib/pf/net/pf_table.c
index d40c95f..5e1f5f1 100644
--- a/sys/contrib/pf/net/pf_table.c
+++ b/sys/contrib/pf/net/pf_table.c
@@ -927,16 +927,12 @@ pfr_create_kentry(struct pfr_addr *ad, int intr)
{
struct pfr_kentry *ke;
- if (intr)
#ifdef __FreeBSD__
- ke = pool_get(&V_pfr_kentry_pl, PR_NOWAIT | PR_ZERO);
+ ke = pool_get(&V_pfr_kentry_pl, PR_NOWAIT | PR_ZERO);
#else
+ if (intr)
ke = pool_get(&pfr_kentry_pl, PR_NOWAIT | PR_ZERO);
-#endif
else
-#ifdef __FreeBSD__
- ke = pool_get(&V_pfr_kentry_pl, PR_WAITOK|PR_ZERO);
-#else
ke = pool_get(&pfr_kentry_pl, PR_WAITOK|PR_ZERO|PR_LIMITFAIL);
#endif
if (ke == NULL)
@@ -2081,16 +2077,12 @@ pfr_create_ktable(struct pfr_table *tbl, long tzero, int attachruleset,
struct pfr_ktable *kt;
struct pf_ruleset *rs;
- if (intr)
#ifdef __FreeBSD__
- kt = pool_get(&V_pfr_ktable_pl, PR_NOWAIT|PR_ZERO);
+ kt = pool_get(&V_pfr_ktable_pl, PR_NOWAIT|PR_ZERO);
#else
+ if (intr)
kt = pool_get(&pfr_ktable_pl, PR_NOWAIT|PR_ZERO|PR_LIMITFAIL);
-#endif
else
-#ifdef __FreeBSD__
- kt = pool_get(&V_pfr_ktable_pl, PR_WAITOK|PR_ZERO);
-#else
kt = pool_get(&pfr_ktable_pl, PR_WAITOK|PR_ZERO|PR_LIMITFAIL);
#endif
if (kt == NULL)
OpenPOWER on IntegriCloud