From owner-p4-projects@FreeBSD.ORG Fri Dec 5 10:26:10 2008 Return-Path: Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id 1EE341065675; Fri, 5 Dec 2008 10:26:10 +0000 (UTC) Delivered-To: perforce@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id D6C2E1065670 for ; Fri, 5 Dec 2008 10:26:09 +0000 (UTC) (envelope-from zec@tel.fer.hr) Received: from repoman.freebsd.org (repoman.freebsd.org [IPv6:2001:4f8:fff6::29]) by mx1.freebsd.org (Postfix) with ESMTP id BB1498FC18 for ; Fri, 5 Dec 2008 10:26:09 +0000 (UTC) (envelope-from zec@tel.fer.hr) Received: from repoman.freebsd.org (localhost [127.0.0.1]) by repoman.freebsd.org (8.14.3/8.14.3) with ESMTP id mB5AQ94l044458 for ; Fri, 5 Dec 2008 10:26:09 GMT (envelope-from zec@tel.fer.hr) Received: (from perforce@localhost) by repoman.freebsd.org (8.14.3/8.14.3/Submit) id mB5AQ99q044456 for perforce@freebsd.org; Fri, 5 Dec 2008 10:26:09 GMT (envelope-from zec@tel.fer.hr) Date: Fri, 5 Dec 2008 10:26:09 GMT Message-Id: <200812051026.mB5AQ99q044456@repoman.freebsd.org> X-Authentication-Warning: repoman.freebsd.org: perforce set sender to zec@tel.fer.hr using -f From: Marko Zec To: Perforce Change Reviews Cc: Subject: PERFORCE change 154101 for review X-BeenThere: p4-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: p4 projects tree changes List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 05 Dec 2008 10:26:10 -0000 http://perforce.freebsd.org/chv.cgi?CH=154101 Change 154101 by zec@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);