summaryrefslogtreecommitdiffstats
path: root/sys/netinet6/nd6.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/netinet6/nd6.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/netinet6/nd6.c')
-rw-r--r--sys/netinet6/nd6.c71
1 files changed, 53 insertions, 18 deletions
diff --git a/sys/netinet6/nd6.c b/sys/netinet6/nd6.c
index 2ea6330..dfe0016 100644
--- a/sys/netinet6/nd6.c
+++ b/sys/netinet6/nd6.c
@@ -79,34 +79,32 @@ __FBSDID("$FreeBSD$");
#define SIN6(s) ((struct sockaddr_in6 *)s)
#define SDL(s) ((struct sockaddr_dl *)s)
-/* timer values */
-int nd6_prune = 1; /* walk list every 1 seconds */
-int nd6_delay = 5; /* delay first probe time 5 second */
-int nd6_umaxtries = 3; /* maximum unicast query */
-int nd6_mmaxtries = 3; /* maximum multicast query */
-int nd6_useloopback = 1; /* use loopback interface for local traffic */
-int nd6_gctimer = (60 * 60 * 24); /* 1 day: garbage collection timer */
+#ifdef VIMAGE_GLOBALS
+int nd6_prune;
+int nd6_delay;
+int nd6_umaxtries;
+int nd6_mmaxtries;
+int nd6_useloopback;
+int nd6_gctimer;
/* preventing too many loops in ND option parsing */
-int nd6_maxndopt = 10; /* max # of ND options allowed */
+int nd6_maxndopt;
-int nd6_maxnudhint = 0; /* max # of subsequent upper layer hints */
-int nd6_maxqueuelen = 1; /* max # of packets cached in unresolved ND entries */
+int nd6_maxnudhint;
+int nd6_maxqueuelen;
-#ifdef ND6_DEBUG
-int nd6_debug = 1;
-#else
-int nd6_debug = 0;
-#endif
+int nd6_debug;
/* for debugging? */
static int nd6_inuse, nd6_allocated;
+struct llinfo_nd6 llinfo_nd6;
-struct llinfo_nd6 llinfo_nd6 = {&llinfo_nd6, &llinfo_nd6};
struct nd_drhead nd_defrouter;
-struct nd_prhead nd_prefix = { 0 };
+struct nd_prhead nd_prefix;
+
+int nd6_recalc_reachtm_interval;
+#endif /* VIMAGE_GLOBALS */
-int nd6_recalc_reachtm_interval = ND6_RECALC_REACHTM_INTERVAL;
static struct sockaddr_in6 all1_sa;
static int nd6_is_new_addr_neighbor __P((struct sockaddr_in6 *,
@@ -118,9 +116,13 @@ static struct llinfo_nd6 *nd6_free(struct rtentry *, int);
static void nd6_llinfo_timer(void *);
static void clear_llinfo_pqueue(struct llinfo_nd6 *);
+#ifdef VIMAGE_GLOBALS
struct callout nd6_slowtimo_ch;
struct callout nd6_timer_ch;
extern struct callout in6_tmpaddrtimer_ch;
+extern int dad_ignore_ns;
+extern int dad_maxtry;
+#endif
void
nd6_init(void)
@@ -134,6 +136,39 @@ nd6_init(void)
return;
}
+ V_nd6_prune = 1; /* walk list every 1 seconds */
+ V_nd6_delay = 5; /* delay first probe time 5 second */
+ V_nd6_umaxtries = 3; /* maximum unicast query */
+ V_nd6_mmaxtries = 3; /* maximum multicast query */
+ V_nd6_useloopback = 1; /* use loopback interface for local traffic */
+ V_nd6_gctimer = (60 * 60 * 24); /* 1 day: garbage collection timer */
+
+ /* preventing too many loops in ND option parsing */
+ V_nd6_maxndopt = 10; /* max # of ND options allowed */
+
+ V_nd6_maxnudhint = 0; /* max # of subsequent upper layer hints */
+ V_nd6_maxqueuelen = 1; /* max pkts cached in unresolved ND entries */
+
+#ifdef ND6_DEBUG
+ V_nd6_debug = 1;
+#else
+ V_nd6_debug = 0;
+#endif
+
+ V_nd6_recalc_reachtm_interval = ND6_RECALC_REACHTM_INTERVAL;
+
+ V_dad_ignore_ns = 0; /* ignore NS in DAD - specwise incorrect*/
+ V_dad_maxtry = 15; /* max # of *tries* to transmit DAD packet */
+
+ V_llinfo_nd6.ln_next = &V_llinfo_nd6;
+ V_llinfo_nd6.ln_prev = &V_llinfo_nd6;
+ LIST_INIT(&V_nd_prefix);
+
+ ip6_use_tempaddr = 0;
+ ip6_temp_preferred_lifetime = DEF_TEMP_PREFERRED_LIFETIME;
+ ip6_temp_valid_lifetime = DEF_TEMP_VALID_LIFETIME;
+ ip6_temp_regen_advance = TEMPADDR_REGEN_ADVANCE;
+
all1_sa.sin6_family = AF_INET6;
all1_sa.sin6_len = sizeof(struct sockaddr_in6);
for (i = 0; i < sizeof(all1_sa.sin6_addr); i++)
OpenPOWER on IntegriCloud