PERFORCE change 154101 for review
Marko Zec
zec at FreeBSD.org
Fri Dec 5 02:26:10 PST 2008
http://perforce.freebsd.org/chv.cgi?CH=154101
Change 154101 by zec at zec_tca51 on 2008/12/05 10:25:56
Do not initialize V_ variables at instantiation.
Affected files ...
.. //depot/projects/vimage-commit2/src/sys/netgraph/ng_base.c#18 edit
.. //depot/projects/vimage-commit2/src/sys/netinet/ip_fw2.c#28 edit
Differences ...
==== //depot/projects/vimage-commit2/src/sys/netgraph/ng_base.c#18 (text+ko) ====
@@ -357,7 +357,7 @@
#endif
#ifdef VIMAGE_GLOBALS
-static ng_ID_t nextID = 1;
+static ng_ID_t nextID;
#endif
#ifdef INVARIANTS
@@ -3073,6 +3073,7 @@
switch (event) {
case MOD_LOAD:
/* Initialize everything. */
+ V_nextID = 1;
NG_WORKLIST_LOCK_INIT();
mtx_init(&ng_typelist_mtx, "netgraph types mutex", NULL,
MTX_DEF);
==== //depot/projects/vimage-commit2/src/sys/netinet/ip_fw2.c#28 (text+ko) ====
@@ -165,9 +165,8 @@
};
#ifdef VIMAGE_GLOBALS
-/* XXX revisit init on instantiation !!! */
-static int fw_debug = 1;
-static int autoinc_step = 100; /* bounded to 1..1000 in add_rule() */
+static int fw_debug;
+static int autoinc_step;
#endif
extern int ipfw_chg_hook(SYSCTL_HANDLER_ARGS);
@@ -231,10 +230,9 @@
* passes through the firewall. XXX check the latter!!!
*/
#ifdef VIMAGE_GLOBALS
-/* XXX revisit init on instantiation !!! */
-static ipfw_dyn_rule **ipfw_dyn_v = NULL;
-static u_int32_t dyn_buckets = 256; /* must be power of 2 */
-static u_int32_t curr_dyn_buckets = 256; /* must be power of 2 */
+static ipfw_dyn_rule **ipfw_dyn_v;
+static u_int32_t dyn_buckets;
+static u_int32_t curr_dyn_buckets;
#endif
static struct mtx ipfw_dyn_mtx; /* mutex guarding dynamic rules */
@@ -249,13 +247,12 @@
* Timeouts for various events in handing dynamic rules.
*/
#ifdef VIMAGE_GLOBALS
-/* XXX revisit init on instantiation !!! */
-static u_int32_t dyn_ack_lifetime = 300;
-static u_int32_t dyn_syn_lifetime = 20;
-static u_int32_t dyn_fin_lifetime = 1;
-static u_int32_t dyn_rst_lifetime = 1;
-static u_int32_t dyn_udp_lifetime = 10;
-static u_int32_t dyn_short_lifetime = 5;
+static u_int32_t dyn_ack_lifetime;
+static u_int32_t dyn_syn_lifetime;
+static u_int32_t dyn_fin_lifetime;
+static u_int32_t dyn_rst_lifetime;
+static u_int32_t dyn_udp_lifetime;
+static u_int32_t dyn_short_lifetime;
/*
* Keepalives are sent if dyn_keepalive is set. They are sent every
@@ -265,14 +262,14 @@
* than dyn_keepalive_period.
*/
-static u_int32_t dyn_keepalive_interval = 20;
-static u_int32_t dyn_keepalive_period = 5;
-static u_int32_t dyn_keepalive = 1; /* do send keepalives */
+static u_int32_t dyn_keepalive_interval;
+static u_int32_t dyn_keepalive_period;
+static u_int32_t dyn_keepalive;
static u_int32_t static_count; /* # of static rules */
static u_int32_t static_len; /* size in bytes of static rules */
-static u_int32_t dyn_count; /* # of dynamic rules */
-static u_int32_t dyn_max = 4096; /* max # of dynamic rules */
+static u_int32_t dyn_count; /* # of dynamic rules */
+static u_int32_t dyn_max; /* max # of dynamic rules */
#endif /* VIMAGE_GLOBALS */
SYSCTL_V_INT(V_NET, vnet_ipfw, _net_inet_ip_fw, OID_AUTO, dyn_buckets,
@@ -314,8 +311,7 @@
#endif /* SYSCTL_NODE */
#ifdef VIMAGE_GLOBALS
-/* XXX revisit init on instantiation !!! */
-static int fw_deny_unknown_exthdrs = 1;
+static int fw_deny_unknown_exthdrs;
#endif
/*
@@ -4528,6 +4524,28 @@
struct ip_fw default_rule;
int error;
+ V_fw_debug = 1;
+ V_autoinc_step = 100; /* bounded to 1..1000 in add_rule() */
+
+ V_ipfw_dyn_v = NULL;
+ V_dyn_buckets = 256; /* must be power of 2 */
+ V_curr_dyn_buckets = 256; /* must be power of 2 */
+
+ V_dyn_ack_lifetime = 300;
+ V_dyn_syn_lifetime = 20;
+ V_dyn_fin_lifetime = 1;
+ V_dyn_rst_lifetime = 1;
+ V_dyn_udp_lifetime = 10;
+ V_dyn_short_lifetime = 5;
+
+ V_dyn_keepalive_interval = 20;
+ V_dyn_keepalive_period = 5;
+ V_dyn_keepalive = 1; /* do send keepalives */
+
+ V_dyn_max = 4096; /* max # of dynamic rules */
+
+ V_fw_deny_unknown_exthdrs = 1;
+
#ifdef INET6
/* Setup IPv6 fw sysctl tree. */
sysctl_ctx_init(&ip6_fw_sysctl_ctx);
More information about the p4-projects
mailing list