summaryrefslogtreecommitdiffstats
path: root/sys/net/if_gif.c
diff options
context:
space:
mode:
authorzec <zec@FreeBSD.org>2008-11-19 09:39:34 +0000
committerzec <zec@FreeBSD.org>2008-11-19 09:39:34 +0000
commit815d52c5df6a76286604478e5223d2f2c87b2c04 (patch)
tree3d398563f1e14b804a0558dd3dda1de9a42b9970 /sys/net/if_gif.c
parent881f5acc93790d49318ffde65d52c6f45ca9c1f8 (diff)
downloadFreeBSD-src-815d52c5df6a76286604478e5223d2f2c87b2c04.zip
FreeBSD-src-815d52c5df6a76286604478e5223d2f2c87b2c04.tar.gz
Change the initialization methodology for global variables scheduled
for virtualization. Instead of initializing the affected global variables at instatiation, assign initial values to them in initializer functions. As a rule, initialization at instatiation for such variables should never be introduced again from now on. Furthermore, enclose all instantiations of such global variables in #ifdef VIMAGE_GLOBALS blocks. Essentialy, this change should have zero functional impact. In the next phase of merging network stack virtualization infrastructure from p4/vimage branch, the new initialization methology will allow us to switch between using global variables and their counterparts residing in virtualization containers with minimum code churn, and in the long run allow us to intialize multiple instances of such container structures. Discussed at: devsummit Strassburg Reviewed by: bz, julian Approved by: julian (mentor) Obtained from: //depot/projects/vimage-commit2/... X-MFC after: never Sponsored by: NLnet Foundation, The FreeBSD Foundation
Diffstat (limited to 'sys/net/if_gif.c')
-rw-r--r--sys/net/if_gif.c32
1 files changed, 22 insertions, 10 deletions
diff --git a/sys/net/if_gif.c b/sys/net/if_gif.c
index db8835e..57bfaab 100644
--- a/sys/net/if_gif.c
+++ b/sys/net/if_gif.c
@@ -94,7 +94,18 @@
*/
static struct mtx gif_mtx;
static MALLOC_DEFINE(M_GIF, "gif", "Generic Tunnel Interface");
+
+#ifdef VIMAGE_GLOBALS
static LIST_HEAD(, gif_softc) gif_softc_list;
+static int max_gif_nesting;
+static int parallel_tunnels;
+#ifdef INET
+int ip_gif_ttl;
+#endif
+#ifdef INET6
+int ip6_gif_hlim;
+#endif
+#endif
void (*ng_gif_input_p)(struct ifnet *ifp, struct mbuf **mp, int af);
void (*ng_gif_input_orphan_p)(struct ifnet *ifp, struct mbuf *m, int af);
@@ -123,9 +134,6 @@ SYSCTL_NODE(_net_link, IFT_GIF, gif, CTLFLAG_RW, 0,
*/
#define MAX_GIF_NEST 1
#endif
-#ifndef VIMAGE
-static int max_gif_nesting = MAX_GIF_NEST;
-#endif
SYSCTL_V_INT(V_NET, vnet_gif, _net_link_gif, OID_AUTO, max_nesting,
CTLFLAG_RW, max_gif_nesting, 0, "Max nested tunnels");
@@ -140,11 +148,6 @@ SYSCTL_V_INT(V_NET, vnet_gif, _net_inet6_ip6, IPV6CTL_GIF_HLIM,
* pair of addresses. Some applications require this functionality so
* we allow control over this check here.
*/
-#ifdef XBONEHACK
-static int parallel_tunnels = 1;
-#else
-static int parallel_tunnels = 0;
-#endif
SYSCTL_V_INT(V_NET, vnet_gif, _net_link_gif, OID_AUTO, parallel_tunnels,
CTLFLAG_RW, parallel_tunnels, 0, "Allow parallel tunnels?");
@@ -251,12 +254,21 @@ gifmodevent(mod, type, data)
switch (type) {
case MOD_LOAD:
mtx_init(&gif_mtx, "gif_mtx", NULL, MTX_DEF);
- LIST_INIT(&V_gif_softc_list);
- if_clone_attach(&gif_cloner);
+ LIST_INIT(&V_gif_softc_list);
+ V_max_gif_nesting = MAX_GIF_NEST;
+#ifdef XBONEHACK
+ V_parallel_tunnels = 1;
+#else
+ V_parallel_tunnels = 0;
+#endif
+#ifdef INET
+ V_ip_gif_ttl = GIF_TTL;
+#endif
#ifdef INET6
V_ip6_gif_hlim = GIF_HLIM;
#endif
+ if_clone_attach(&gif_cloner);
break;
case MOD_UNLOAD:
OpenPOWER on IntegriCloud