Author: luigi
Date: Fri Nov 22 04:59:17 2013
New Revision: 258464
URL: http://svnweb.freebsd.org/changeset/base/258464

Log:
  more support for userspace compiling of this code:
  emulate the uma_zone for dynamic rules.

Modified:
  head/sys/netpfil/ipfw/ip_fw_dynamic.c

Modified: head/sys/netpfil/ipfw/ip_fw_dynamic.c
==============================================================================
--- head/sys/netpfil/ipfw/ip_fw_dynamic.c       Fri Nov 22 04:57:50 2013        
(r258463)
+++ head/sys/netpfil/ipfw/ip_fw_dynamic.c       Fri Nov 22 04:59:17 2013        
(r258464)
@@ -181,6 +181,13 @@ static VNET_DEFINE(u_int32_t, dyn_max);    
 #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, in
                }
                return NULL;
        }
+       ipfw_dyn_count++;
 
        /*
         * refcount on parent is already incremented, so
@@ -1253,11 +1261,13 @@ check_dyn_rules(struct ip_fw_chain *chai
        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--;
        }
 
        /*
_______________________________________________
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"

Reply via email to