more support for userspace compiling of this code:

emulate the uma_zone for dynamic rules.
This commit is contained in:
Luigi Rizzo 2013-11-22 04:59:17 +00:00
parent 77024cbc3e
commit 413c8aaa87
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=258464

View File

@ -181,6 +181,13 @@ static VNET_DEFINE(u_int32_t, dyn_max); /* max # of dynamic rules */
#define DYN_COUNT uma_zone_get_cur(V_ipfw_dyn_rule_zone)
#define V_dyn_max VNET(dyn_max)
/* for userspace, we emulate the uma_zone_counter with ipfw_dyn_count */
static int ipfw_dyn_count; /* number of objects */
#ifdef USERSPACE /* emulation of UMA object counters for userspace */
#define uma_zone_get_cur(x) ipfw_dyn_count
#endif /* USERSPACE */
static int last_log; /* Log ratelimiting */
static void ipfw_dyn_tick(void *vnetx);
@ -579,6 +586,7 @@ add_dyn_rule(struct ipfw_flow_id *id, int i, u_int8_t dyn_type, struct ip_fw *ru
}
return NULL;
}
ipfw_dyn_count++;
/*
* refcount on parent is already incremented, so
@ -1253,11 +1261,13 @@ check_dyn_rules(struct ip_fw_chain *chain, struct ip_fw *rule,
for (q = exp_head; q != NULL; q = q_next) {
q_next = q->next;
uma_zfree(V_ipfw_dyn_rule_zone, q);
ipfw_dyn_count--;
}
for (q = exp_lhead; q != NULL; q = q_next) {
q_next = q->next;
uma_zfree(V_ipfw_dyn_rule_zone, q);
ipfw_dyn_count--;
}
/*