Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 3 Sep 2007 16:08:19 GMT
From:      Ana Kukec <anchie@FreeBSD.org>
To:        Perforce Change Reviews <perforce@FreeBSD.org>
Subject:   PERFORCE change 126004 for review
Message-ID:  <200709031608.l83G8JNL093158@repoman.freebsd.org>

next in thread | raw e-mail | index | archive | help
http://perforce.freebsd.org/chv.cgi?CH=126004

Change 126004 by anchie@anchie_malimis on 2007/09/03 16:07:56

	Virtualization of netinet6 integer variables (#2).	

Affected files ...

.. //depot/projects/vimage/src/sys/netinet6/icmp6.c#14 edit
.. //depot/projects/vimage/src/sys/netinet6/in6.c#12 edit
.. //depot/projects/vimage/src/sys/netinet6/in6_ifattach.c#12 edit
.. //depot/projects/vimage/src/sys/netinet6/in6_proto.c#12 edit
.. //depot/projects/vimage/src/sys/netinet6/in6_src.c#13 edit
.. //depot/projects/vimage/src/sys/netinet6/ip6_input.c#21 edit
.. //depot/projects/vimage/src/sys/netinet6/ip6_mroute.c#9 edit
.. //depot/projects/vimage/src/sys/netinet6/ip6_var.h#8 edit
.. //depot/projects/vimage/src/sys/netinet6/nd6.c#18 edit
.. //depot/projects/vimage/src/sys/netinet6/nd6.h#4 edit
.. //depot/projects/vimage/src/sys/netinet6/nd6_nbr.c#10 edit
.. //depot/projects/vimage/src/sys/netinet6/nd6_rtr.c#8 edit
.. //depot/projects/vimage/src/sys/netinet6/vinet6.h#11 edit

Differences ...

==== //depot/projects/vimage/src/sys/netinet6/icmp6.c#14 (text+ko) ====

@@ -115,10 +115,14 @@
 
 extern struct inpcbinfo ripcbinfo;
 extern struct inpcbhead ripcb;
+#ifndef VIMAGE
 extern int icmp6errppslim;
 static int icmp6errpps_count = 0;
+#endif /* !VIMAGE */
 static struct timeval icmp6errppslim_last;
+#ifdef VIMAGE
 extern int icmp6_nodeinfo;
+#endif /* !VIMAGE */
 
 static void icmp6_errcount __P((struct icmp6errstat *, int, int));
 static int icmp6_rip6_input __P((struct mbuf **, int));
@@ -138,7 +142,9 @@
 void
 icmp6_init(void)
 {
-	icmp6errpps_count = 0;	
+	INIT_VNET_INET6(curvnet);
+	V_icmp6errpps_count = 0;
+	V_icmp6errpps_count = 0;	
 
 	mld6_init();
 }
@@ -640,7 +646,7 @@
 	    {
 		enum { WRU, FQDN } mode;
 
-		if (!icmp6_nodeinfo)
+		if (!V_icmp6_nodeinfo)
 			break;
 
 		if (icmp6len == sizeof(struct icmp6_hdr) + 4)
@@ -669,7 +675,7 @@
 			 * XXX: this combination of flags is pointless,
 			 * but should we keep this for compatibility?
 			 */
-			if ((icmp6_nodeinfo & 5) != 5)
+			if ((V_icmp6_nodeinfo & 5) != 5)
 				break;
 
 			if (code != 0)
@@ -1157,6 +1163,7 @@
 static struct mbuf *
 ni6_input(struct mbuf *m, int off)
 {
+	INIT_VNET_INET6(curvnet);
 	/* XXX this bellow is WRONG - MARKO */
 	INIT_VPROCG(curthread->td_ucred->cr_vimage->v_procg);
 	struct icmp6_nodeinfo *ni6, *nni6;
@@ -1197,7 +1204,7 @@
 	 *    link-local (note that site-local unicast was deprecated and
 	 *    ULA is defined as global scope-wise)
 	 */
-	if ((icmp6_nodeinfo & ICMP6_NODEINFO_GLOBALOK) == 0 &&
+	if ((V_icmp6_nodeinfo & ICMP6_NODEINFO_GLOBALOK) == 0 &&
 	    !IN6_IS_ADDR_LOOPBACK(&ip6->ip6_src) &&
 	    !IN6_IS_ADDR_LINKLOCAL(&ip6->ip6_src))
 		goto bad;
@@ -1219,7 +1226,7 @@
 			goto bad; /* XXX impossible */
 
 		if ((ia6->ia6_flags & IN6_IFF_TEMPORARY) &&
-		    !(icmp6_nodeinfo & ICMP6_NODEINFO_TMPADDROK)) {
+		    !(V_icmp6_nodeinfo & ICMP6_NODEINFO_TMPADDROK)) {
 			nd6log((LOG_DEBUG, "ni6_input: ignore node info to "
 				"a temporary address in %s:%d",
 			       __FILE__, __LINE__));
@@ -1334,12 +1341,12 @@
 	/* refuse based on configuration.  XXX ICMP6_NI_REFUSED? */
 	switch (qtype) {
 	case NI_QTYPE_FQDN:
-		if ((icmp6_nodeinfo & ICMP6_NODEINFO_FQDNOK) == 0)
+		if ((V_icmp6_nodeinfo & ICMP6_NODEINFO_FQDNOK) == 0)
 			goto bad;
 		break;
 	case NI_QTYPE_NODEADDR:
 	case NI_QTYPE_IPV4ADDR:
-		if ((icmp6_nodeinfo & ICMP6_NODEINFO_NODEADDROK) == 0)
+		if ((V_icmp6_nodeinfo & ICMP6_NODEINFO_NODEADDROK) == 0)
 			goto bad;
 		break;
 	}
@@ -1641,6 +1648,7 @@
     struct in6_addr *subj)
 {
 	INIT_VNET_NET(curvnet);
+	INIT_VNET_INET6(curvnet);
 	struct ifnet *ifp;
 	struct in6_ifaddr *ifa6;
 	struct ifaddr *ifa;
@@ -1710,7 +1718,7 @@
 			    (niflags & NI_NODEADDR_FLAG_ANYCAST) == 0)
 				continue; /* we need only unicast addresses */
 			if ((ifa6->ia6_flags & IN6_IFF_TEMPORARY) != 0 &&
-			    (icmp6_nodeinfo & ICMP6_NODEINFO_TMPADDROK) == 0) {
+			    (V_icmp6_nodeinfo & ICMP6_NODEINFO_TMPADDROK) == 0) {
 				continue;
 			}
 			addrsofif++; /* count the address */
@@ -1733,6 +1741,7 @@
     struct ifnet *ifp0, int resid)
 {
 	INIT_VNET_NET(curvnet);
+	INIT_VNET_INET6(curvnet);
 	struct ifnet *ifp = ifp0 ? ifp0 : TAILQ_FIRST(&V_ifnet);
 	struct in6_ifaddr *ifa6;
 	struct ifaddr *ifa;
@@ -1797,7 +1806,7 @@
 			    (niflags & NI_NODEADDR_FLAG_ANYCAST) == 0)
 				continue;
 			if ((ifa6->ia6_flags & IN6_IFF_TEMPORARY) != 0 &&
-			    (icmp6_nodeinfo & ICMP6_NODEINFO_TMPADDROK) == 0) {
+			    (V_icmp6_nodeinfo & ICMP6_NODEINFO_TMPADDROK) == 0) {
 				continue;
 			}
 
@@ -2245,7 +2254,7 @@
 	/* XXX if we are router, we don't update route by icmp6 redirect */
 	if (V_ip6_forwarding)
 		goto freeit;
-	if (!icmp6_rediraccept)
+	if (!V_icmp6_rediraccept)
 		goto freeit;
 
 #ifndef PULLDOWN_TEST
@@ -2791,13 +2800,14 @@
 icmp6_ratelimit(const struct in6_addr *dst, const int type,
     const int code)
 {
+	INIT_VNET_INET6(curvnet);
 	int ret;
 
 	ret = 0;	/* okay to send */
 
 	/* PPS limit */
-	if (!ppsratecheck(&icmp6errppslim_last, &icmp6errpps_count,
-	    icmp6errppslim)) {
+	if (!ppsratecheck(&icmp6errppslim_last, &V_icmp6errpps_count,
+	    V_icmp6errppslim)) {
 		/* The packet is subject to rate limit */
 		ret++;
 	}

==== //depot/projects/vimage/src/sys/netinet6/in6.c#12 (text+ko) ====

@@ -324,6 +324,7 @@
 in6_control(struct socket *so, u_long cmd, caddr_t data,
     struct ifnet *ifp, struct thread *td)
 {
+	INIT_VNET_INET6(curvnet);
 	struct	in6_ifreq *ifr = (struct in6_ifreq *)data;
 	struct	in6_ifaddr *ia = NULL;
 	struct	in6_aliasreq *ifra = (struct in6_aliasreq *)data;
@@ -736,7 +737,7 @@
 			 * (when required).
 			 */
 			if ((ia->ia6_flags & IN6_IFF_AUTOCONF) &&
-			    ip6_use_tempaddr && pr->ndpr_refcnt == 1) {
+			    V_ip6_use_tempaddr && pr->ndpr_refcnt == 1) {
 				int e;
 				if ((e = in6_tmpifadd(ia, 1, 0)) != 0) {
 					log(LOG_NOTICE, "in6_control: failed "

==== //depot/projects/vimage/src/sys/netinet6/in6_ifattach.c#12 (text+ko) ====

@@ -875,8 +875,8 @@
 	struct ifnet *ifp;
 
 	callout_reset(&V_in6_tmpaddrtimer_ch,
-	    (ip6_temp_preferred_lifetime - ip6_desync_factor -
-	    ip6_temp_regen_advance) * hz, in6_tmpaddrtimer, arg);
+	    (V_ip6_temp_preferred_lifetime - V_ip6_desync_factor -
+	    V_ip6_temp_regen_advance) * hz, in6_tmpaddrtimer, arg);
 
 	bzero(nullbuf, sizeof(nullbuf));
 	for (ifp = TAILQ_FIRST(&V_ifnet); ifp;

==== //depot/projects/vimage/src/sys/netinet6/in6_proto.c#12 (text+ko) ====

@@ -423,6 +423,7 @@
  * XXX: what if we don't define INET? Should we define pmtu6_expire
  * or so? (jinmei@kame.net 19990310)
  */
+#ifndef VIMAGE
 int pmtu_expire = 60*10;
 int pmtu_probe = 60*2;
 
@@ -447,6 +448,7 @@
 int	udp6_sendspace = 9216;		/* really max datagram size */
 int	udp6_recvspace = 40 * (1024 + sizeof(struct sockaddr_in6));
 					/* 40 1K datagrams */
+#endif /* !VIMAGE */
 
 /*
  * sysctl related items.
@@ -468,37 +470,47 @@
 
 /* net.inet6.ip6 */
 static int
+#ifdef VIMAGE
+sysctl_ip6_temppltime(SYSCTL_HANDLER_V_ARGS)
+#else
 sysctl_ip6_temppltime(SYSCTL_HANDLER_ARGS)
+#endif
 {
+	INIT_VNET_INET6(curvnet);
 	int error = 0;
 	int old;
 
 	error = SYSCTL_OUT(req, arg1, sizeof(int));
 	if (error || !req->newptr)
 		return (error);
-	old = ip6_temp_preferred_lifetime;
+	old = V_ip6_temp_preferred_lifetime;
 	error = SYSCTL_IN(req, arg1, sizeof(int));
-	if (ip6_temp_preferred_lifetime <
-	    ip6_desync_factor + ip6_temp_regen_advance) {
-		ip6_temp_preferred_lifetime = old;
+	if (V_ip6_temp_preferred_lifetime <
+	    V_ip6_desync_factor + V_ip6_temp_regen_advance) {
+		V_ip6_temp_preferred_lifetime = old;
 		return (EINVAL);
 	}
 	return (error);
 }
 
 static int
+#ifdef VIMAGE
+sysctl_ip6_tempvltime(SYSCTL_HANDLER_V_ARGS)
+#else
 sysctl_ip6_tempvltime(SYSCTL_HANDLER_ARGS)
+#endif
 {
+	INIT_VNET_INET6(curvnet);
 	int error = 0;
 	int old;
 
 	error = SYSCTL_OUT(req, arg1, sizeof(int));
 	if (error || !req->newptr)
 		return (error);
-	old = ip6_temp_valid_lifetime;
+	old = V_ip6_temp_valid_lifetime;
 	error = SYSCTL_IN(req, arg1, sizeof(int));
-	if (ip6_temp_valid_lifetime < ip6_temp_preferred_lifetime) {
-		ip6_temp_preferred_lifetime = old;
+	if (V_ip6_temp_valid_lifetime < V_ip6_temp_preferred_lifetime) {
+		V_ip6_temp_preferred_lifetime = old;
 		return (EINVAL);
 	}
 	return (error);
@@ -536,14 +548,14 @@
 	use_deprecated, CTLFLAG_RW,	ip6_use_deprecated,	0, "");
 SYSCTL_V_INT(V_NET, vnet_inet6, _net_inet6_ip6, IPV6CTL_RR_PRUNE,
 	rr_prune, CTLFLAG_RW,	ip6_rr_prune,			0, "");
-SYSCTL_INT(_net_inet6_ip6, IPV6CTL_USETEMPADDR,
-	use_tempaddr, CTLFLAG_RW, &ip6_use_tempaddr,		0, "");
-SYSCTL_OID(_net_inet6_ip6, IPV6CTL_TEMPPLTIME, temppltime,
-	   CTLTYPE_INT|CTLFLAG_RW, &ip6_temp_preferred_lifetime, 0,
-	   sysctl_ip6_temppltime, "I", "");
-SYSCTL_OID(_net_inet6_ip6, IPV6CTL_TEMPVLTIME, tempvltime,
-	   CTLTYPE_INT|CTLFLAG_RW, &ip6_temp_valid_lifetime, 0,
-	   sysctl_ip6_tempvltime, "I", "");
+SYSCTL_V_INT(V_NET, vnet_inet6, _net_inet6_ip6, IPV6CTL_USETEMPADDR,
+	use_tempaddr, CTLFLAG_RW, ip6_use_tempaddr,		0, "");
+SYSCTL_V_OID(V_NET, vnet_inet6, _net_inet6_ip6, IPV6CTL_TEMPPLTIME, temppltime,
+	CTLTYPE_INT|CTLFLAG_RW, ip6_temp_preferred_lifetime, 0,
+   	sysctl_ip6_temppltime, "I", "");
+SYSCTL_V_OID(V_NET, vnet_inet6, _net_inet6_ip6, IPV6CTL_TEMPVLTIME, tempvltime,
+	CTLTYPE_INT|CTLFLAG_RW, ip6_temp_valid_lifetime, 0,
+   	sysctl_ip6_tempvltime, "I", "");
 SYSCTL_V_INT(V_NET, vnet_inet6, _net_inet6_ip6, IPV6CTL_V6ONLY,
 	v6only,	CTLFLAG_RW,	ip6_v6only,			0, "");
 #ifndef VIMAGE
@@ -553,8 +565,8 @@
 	auto_linklocal, CTLFLAG_RW, ip6_auto_linklocal,	0, "");
 SYSCTL_V_STRUCT(V_NET, vnet_inet6, _net_inet6_ip6, IPV6CTL_RIP6STATS,
 	rip6stats, CTLFLAG_RD, rip6stat, rip6stat, "");
-SYSCTL_INT(_net_inet6_ip6, IPV6CTL_PREFER_TEMPADDR,
-	prefer_tempaddr, CTLFLAG_RW, &ip6_prefer_tempaddr,	0, "");
+SYSCTL_V_INT(V_NET, vnet_inet6, _net_inet6_ip6, IPV6CTL_PREFER_TEMPADDR,
+	prefer_tempaddr, CTLFLAG_RW, ip6_prefer_tempaddr,	0, "");
 SYSCTL_INT(_net_inet6_ip6, IPV6CTL_USE_DEFAULTZONE,
 	use_defaultzone, CTLFLAG_RW, &ip6_use_defzone,		0,"");
 SYSCTL_V_INT(V_NET, vnet_inet6, _net_inet6_ip6, IPV6CTL_MAXFRAGS,
@@ -563,31 +575,31 @@
 	mcast_pmtu, CTLFLAG_RW,		ip6_mcast_pmtu,	0, "");
 #ifdef IPSTEALTH
 SYSCTL_V_INT(V_NET, vnet_inet6, _net_inet6_ip6, IPV6CTL_STEALTH, stealth, CTLFLAG_RW,
-	ip6stealth, 0, "");
+ip6stealth, 0, "");
 #endif
 
 /* net.inet6.icmp6 */
-SYSCTL_INT(_net_inet6_icmp6, ICMPV6CTL_REDIRACCEPT,
-	rediraccept, CTLFLAG_RW,	&icmp6_rediraccept,	0, "");
-SYSCTL_INT(_net_inet6_icmp6, ICMPV6CTL_REDIRTIMEOUT,
-	redirtimeout, CTLFLAG_RW,	&icmp6_redirtimeout,	0, "");
+SYSCTL_V_INT(V_NET, vnet_inet6, _net_inet6_icmp6, ICMPV6CTL_REDIRACCEPT,
+	rediraccept, CTLFLAG_RW,	icmp6_rediraccept,	0, "");
+SYSCTL_V_INT(V_NET, vnet_inet6, _net_inet6_icmp6, ICMPV6CTL_REDIRTIMEOUT,
+	redirtimeout, CTLFLAG_RW,	icmp6_redirtimeout,	0, "");
 SYSCTL_V_STRUCT(V_NET, vnet_inet6, _net_inet6_icmp6, ICMPV6CTL_STATS,
 	stats, CTLFLAG_RD, icmp6stat, icmp6stat, "");
-SYSCTL_INT(_net_inet6_icmp6, ICMPV6CTL_ND6_PRUNE,
-	nd6_prune, CTLFLAG_RW,		&nd6_prune,	0, "");
-SYSCTL_INT(_net_inet6_icmp6, ICMPV6CTL_ND6_DELAY,
-	nd6_delay, CTLFLAG_RW,		&nd6_delay,	0, "");
-SYSCTL_INT(_net_inet6_icmp6, ICMPV6CTL_ND6_UMAXTRIES,
-	nd6_umaxtries, CTLFLAG_RW,	&nd6_umaxtries,	0, "");
-SYSCTL_INT(_net_inet6_icmp6, ICMPV6CTL_ND6_MMAXTRIES,
-	nd6_mmaxtries, CTLFLAG_RW,	&nd6_mmaxtries,	0, "");
-SYSCTL_INT(_net_inet6_icmp6, ICMPV6CTL_ND6_USELOOPBACK,
-	nd6_useloopback, CTLFLAG_RW,	&nd6_useloopback, 0, "");
-SYSCTL_INT(_net_inet6_icmp6, ICMPV6CTL_NODEINFO,
-	nodeinfo, CTLFLAG_RW,	&icmp6_nodeinfo,	0, "");
-SYSCTL_INT(_net_inet6_icmp6, ICMPV6CTL_ERRPPSLIMIT,
-	errppslimit, CTLFLAG_RW,	&icmp6errppslim,	0, "");
-SYSCTL_INT(_net_inet6_icmp6, ICMPV6CTL_ND6_MAXNUDHINT,
-	nd6_maxnudhint, CTLFLAG_RW,	&nd6_maxnudhint, 0, "");
+SYSCTL_V_INT(V_NET, vnet_inet6, _net_inet6_icmp6, ICMPV6CTL_ND6_PRUNE,
+	nd6_prune, CTLFLAG_RW,		nd6_prune,	0, "");
+SYSCTL_V_INT(V_NET, vnet_inet6, _net_inet6_icmp6, ICMPV6CTL_ND6_DELAY,
+	nd6_delay, CTLFLAG_RW,		nd6_delay,	0, "");
+SYSCTL_V_INT(V_NET, vnet_inet6, _net_inet6_icmp6, ICMPV6CTL_ND6_UMAXTRIES,
+	nd6_umaxtries, CTLFLAG_RW,	nd6_umaxtries,	0, "");
+SYSCTL_V_INT(V_NET, vnet_inet6, _net_inet6_icmp6, ICMPV6CTL_ND6_MMAXTRIES,
+	nd6_mmaxtries, CTLFLAG_RW,	nd6_mmaxtries,	0, "");
+SYSCTL_V_INT(V_NET, vnet_inet6, _net_inet6_icmp6, ICMPV6CTL_ND6_USELOOPBACK,
+	nd6_useloopback, CTLFLAG_RW,	nd6_useloopback, 0, "");
+SYSCTL_V_INT(V_NET, vnet_inet6, _net_inet6_icmp6, ICMPV6CTL_NODEINFO,
+	nodeinfo, CTLFLAG_RW,	icmp6_nodeinfo,	0, "");
+SYSCTL_V_INT(V_NET, vnet_inet6, _net_inet6_icmp6, ICMPV6CTL_ERRPPSLIMIT,
+	errppslimit, CTLFLAG_RW,	icmp6errppslim,	0, "");
+SYSCTL_V_INT(V_NET, vnet_inet6, _net_inet6_icmp6, ICMPV6CTL_ND6_MAXNUDHINT,
+	nd6_maxnudhint, CTLFLAG_RW,	nd6_maxnudhint, 0, "");
 SYSCTL_INT(_net_inet6_icmp6, ICMPV6CTL_ND6_DEBUG,
 	nd6_debug, CTLFLAG_RW,	&nd6_debug,		0, "");

==== //depot/projects/vimage/src/sys/netinet6/in6_src.c#13 (text+ko) ====

@@ -117,9 +117,9 @@
 #define ADDR_LABEL_NOTAPP (-1)
 #ifndef VIMAGE
 struct in6_addrpolicy defaultaddrpolicy;
-#endif
 
 int ip6_prefer_tempaddr = 0;
+#endif
 
 static int selectroute __P((struct sockaddr_in6 *, struct ip6_pktopts *,
 	struct ip6_moptions *, struct route_in6 *, struct ifnet **,
@@ -352,7 +352,7 @@
 		 */
 		if (opts == NULL ||
 		    opts->ip6po_prefer_tempaddr == IP6PO_TEMPADDR_SYSTEM) {
-			prefer_tempaddr = ip6_prefer_tempaddr;
+			prefer_tempaddr = V_ip6_prefer_tempaddr;
 		} else if (opts->ip6po_prefer_tempaddr ==
 		    IP6PO_TEMPADDR_NOTPREFER) {
 			prefer_tempaddr = 0;

==== //depot/projects/vimage/src/sys/netinet6/ip6_input.c#21 (text+ko) ====

@@ -120,18 +120,18 @@
 
 u_char ip6_protox[IPPROTO_MAX];
 static struct ifqueue ip6intrq;
+#ifndef VIMAGE
 static int ip6qmaxlen = IFQ_MAXLEN;
-#ifndef VIMAGE
 struct in6_ifaddr *in6_ifaddr;
 
 extern struct callout in6_tmpaddrtimer_ch;
-#endif
 
 int ip6_forward_srcrt;			/* XXX */
 int ip6_sourcecheck;			/* XXX */
 int ip6_sourcecheck_interval;		/* XXX */
 
 int ip6_ours_check_algorithm;
+#endif /* !VIMAGE */
 
 struct pfil_head inet6_pfil_hook;
 
@@ -171,6 +171,8 @@
 #ifndef IPV6_SENDREDIRECTS
 #define IPV6_SENDREDIRECTS  1
 #endif
+#define RIPV6SNDQ   8192
+#define RIPV6RCVQ   8192
 #endif /* !VIMAGE */
 
 /*
@@ -206,10 +208,37 @@
 
 	V_ip6_keepfaith = 0;
 	V_ip6_log_time = (time_t)0L;
-	#ifdef IPSTEALTH
+#ifdef IPSTEALTH
 	V_ip6stealth = 0;
-	#endif
-		
+#endif
+
+	V_pmtu_expire = 60*10;
+	V_pmtu_probe = 60*2;
+
+	V_rip6_sendspace = RIPV6SNDQ;
+	V_rip6_recvspace = RIPV6RCVQ;
+
+	/* ICMPV6 parameters */
+	V_icmp6_rediraccept = 1;      /* accept and process redirects */
+	V_icmp6_redirtimeout = 10 * 60;   /* 10 minutes */
+	V_icmp6errppslim = 100;       /* 100pps */
+	/* control how to respond to NI queries */
+	V_icmp6_nodeinfo = (ICMP6_NODEINFO_FQDNOK|ICMP6_NODEINFO_NODEADDROK);
+
+	/* UDP on IP6 parameters */
+	V_udp6_sendspace = 9216;      /* really max datagram size */
+	V_udp6_recvspace = 40 * (1024 + sizeof(struct sockaddr_in6));
+                    /* 40 1K datagrams */
+
+	V_ip6_prefer_tempaddr = 0;
+
+	V_ip6qmaxlen = IFQ_MAXLEN;
+	V_ip6_forward_srcrt = 0;          /* XXX */
+	V_ip6_sourcecheck = 0;            /* XXX */
+	V_ip6_sourcecheck_interval = 0;       /* XXX */
+
+	V_ip6_ours_check_algorithm = 0;
+
 #ifdef IP6_AUTO_LINKLOCAL
 	V_ip6_auto_linklocal = IP6_AUTO_LINKLOCAL;
 #else
@@ -258,10 +287,10 @@
 		printf("%s: WARNING: unable to register pfil hook, "
 			"error %d\n", __func__, i);
 
-	ip6intrq.ifq_maxlen = ip6qmaxlen;
+	ip6intrq.ifq_maxlen = V_ip6qmaxlen;
 	mtx_init(&ip6intrq.ifq_mtx, "ip6_inq", NULL, MTX_DEF);
 	netisr_register(NETISR_IPV6, ip6_input, &ip6intrq, 0);
-	ip6_desync_factor = arc4random() % MAX_TEMP_DESYNC_FACTOR;
+	V_ip6_desync_factor = arc4random() % MAX_TEMP_DESYNC_FACTOR;
 }
 
 #ifdef VIMAGE
@@ -287,8 +316,8 @@
 	/* timer for regeneranation of temporary addresses randomize ID */
 	callout_init(&V_in6_tmpaddrtimer_ch, 0);
 	callout_reset(&V_in6_tmpaddrtimer_ch,
-		      (ip6_temp_preferred_lifetime - ip6_desync_factor -
-		       ip6_temp_regen_advance) * hz,
+		      (V_ip6_temp_preferred_lifetime - V_ip6_desync_factor -
+		       V_ip6_temp_regen_advance) * hz,
 		      in6_tmpaddrtimer, curvnet);
 }
 

==== //depot/projects/vimage/src/sys/netinet6/ip6_mroute.c#9 (text+ko) ====

@@ -151,7 +151,9 @@
 	.pr_usrreqs =		&rip6_usrreqs
 };
 
+#ifndef VIMAGE
 static int ip6_mrouter_ver = 0;
+#endif /* !VIMAGE */
 
 SYSCTL_DECL(_net_inet6);
 SYSCTL_DECL(_net_inet6_ip6);
@@ -179,7 +181,9 @@
     "Multicast Interfaces (struct mif[MAXMIFS], netinet6/ip6_mroute.h)");
 
 #ifdef MRT6DEBUG
+#ifndef VIMAGE
 static u_int mrt6debug = 0;		/* debug level */
+#endif /* !VIMAGE */
 #define DEBUG_MFC	0x02
 #define DEBUG_FORWARD	0x04
 #define DEBUG_EXPIRE	0x08
@@ -224,7 +228,9 @@
     &pim6stat, pim6stat,
     "PIM Statistics (struct pim6stat, netinet6/pim_var.h)");
 
+#ifndef VIMAGE
 static int pim6;
+#endif
 
 /*
  * Hash function for a source, group entry
@@ -378,6 +384,7 @@
 int
 X_ip6_mrouter_get(struct socket *so, struct sockopt *sopt)
 {
+	INIT_VNET_INET6(curvnet);
 	int error = 0;
 
 	if (so != ip6_mrouter)
@@ -385,7 +392,7 @@
 
 	switch (sopt->sopt_name) {
 		case MRT6_PIM:
-			error = sooptcopyout(sopt, &pim6, sizeof(pim6));
+			error = sooptcopyout(sopt, &V_pim6, sizeof(V_pim6));
 			break;
 	}
 	return (error);
@@ -454,10 +461,11 @@
 static int
 set_pim6(int *i)
 {
+	INIT_VNET_INET6(curvnet);
 	if ((*i != 1) && (*i != 0))
 		return (EINVAL);
 
-	pim6 = *i;
+	V_pim6 = *i;
 
 	return (0);
 }
@@ -468,6 +476,11 @@
 static int
 ip6_mrouter_init(struct socket *so, int v, int cmd)
 {
+	INIT_VNET_INET6(curvnet);
+
+	V_ip6_mrouter_ver = 0;
+	V_mrt6debug = 0;
+
 #ifdef MRT6DEBUG
 	if (mrt6debug)
 		log(LOG_DEBUG,
@@ -486,19 +499,19 @@
 		return (EADDRINUSE);
 
 	ip6_mrouter = so;
-	ip6_mrouter_ver = cmd;
+	V_ip6_mrouter_ver = cmd;
 
 	bzero((caddr_t)mf6ctable, sizeof(mf6ctable));
 	bzero((caddr_t)n6expire, sizeof(n6expire));
 
-	pim6 = 0;/* used for stubbing out/in pim stuff */
+	V_pim6 = 0;/* used for stubbing out/in pim stuff */
 
 	callout_init(&expire_upcalls_ch, 0);
 	callout_reset(&expire_upcalls_ch, EXPIRE_TIMEOUT,
 	    expire_upcalls, NULL);
 
 #ifdef MRT6DEBUG
-	if (mrt6debug)
+	if (V_mrt6debug)
 		log(LOG_DEBUG, "ip6_mrouter_init\n");
 #endif
 
@@ -511,6 +524,7 @@
 int
 X_ip6_mrouter_done(void)
 {
+	INIT_VNET_INET6(curvnet);
 	mifi_t mifi;
 	int i;
 	struct mf6c *rt;
@@ -545,7 +559,7 @@
 	bzero((caddr_t)mif6table, sizeof(mif6table));
 	nummifs = 0;
 
-	pim6 = 0; /* used to stub out/in pim specific code */
+	V_pim6 = 0; /* used to stub out/in pim specific code */
 
 	callout_stop(&expire_upcalls_ch);
 
@@ -583,12 +597,12 @@
 	}
 
 	ip6_mrouter = NULL;
-	ip6_mrouter_ver = 0;
+	V_ip6_mrouter_ver = 0;
 
 	splx(s);
 
 #ifdef MRT6DEBUG
-	if (mrt6debug)
+	if (V_mrt6debug)
 		log(LOG_DEBUG, "ip6_mrouter_done\n");
 #endif
 
@@ -665,7 +679,7 @@
 		nummifs = mifcp->mif6c_mifi + 1;
 
 #ifdef MRT6DEBUG
-	if (mrt6debug)
+	if (V_mrt6debug)
 		log(LOG_DEBUG,
 		    "add_mif #%d, phyint %s\n",
 		    mifcp->mif6c_mifi,
@@ -722,7 +736,7 @@
 	splx(s);
 
 #ifdef MRT6DEBUG
-	if (mrt6debug)
+	if (V_mrt6debug)
 		log(LOG_DEBUG, "del_m6if %d, nummifs %d\n", *mifip, nummifs);
 #endif
 
@@ -735,6 +749,7 @@
 static int
 add_m6fc(struct mf6cctl *mfccp)
 {
+	INIT_VNET_INET6(curvnet);
 	struct mf6c *rt;
 	u_long hash;
 	struct rtdetq *rte;
@@ -748,7 +763,7 @@
 	/* If an entry already exists, just update the fields */
 	if (rt) {
 #ifdef MRT6DEBUG
-		if (mrt6debug & DEBUG_MFC) {
+		if (V_mrt6debug & DEBUG_MFC) {
 		    log(LOG_DEBUG,
 			"add_m6fc no upcall h %d o %s g %s p %x\n",
 			ip6_sprintf(ip6bufo, &mfccp->mf6cc_origin.sin6_addr),
@@ -788,7 +803,7 @@
 				    mfccp->mf6cc_parent, rt->mf6c_stall);
 
 #ifdef MRT6DEBUG
-			if (mrt6debug & DEBUG_MFC)
+			if (V_mrt6debug & DEBUG_MFC)
 				log(LOG_DEBUG,
 				    "add_m6fc o %s g %s p %x dbg %x\n",
 				    ip6_sprintf(ip6bufo,
@@ -830,7 +845,7 @@
 	 */
 	if (nstl == 0) {
 #ifdef MRT6DEBUG
-		if (mrt6debug & DEBUG_MFC)
+		if (V_mrt6debug & DEBUG_MFC)
 		    log(LOG_DEBUG,
 			"add_mfc no upcall h %d o %s g %s p %x\n",
 			hash,
@@ -922,6 +937,7 @@
 static int
 del_m6fc(struct mf6cctl *mfccp)
 {
+	INIT_VNET_INET6(curvnet);
 	struct sockaddr_in6	origin;
 	struct sockaddr_in6	mcastgrp;
 	struct mf6c		*rt;
@@ -934,7 +950,7 @@
 	hash = MF6CHASH(origin.sin6_addr, mcastgrp.sin6_addr);
 
 #ifdef MRT6DEBUG
-	if (mrt6debug & DEBUG_MFC) {
+	if (V_mrt6debug & DEBUG_MFC) {
 		char ip6bufo[INET6_ADDRSTRLEN], ip6bufg[INET6_ADDRSTRLEN];
 		log(LOG_DEBUG,"del_m6fc orig %s mcastgrp %s\n",
 		    ip6_sprintf(ip6bufo, &origin.sin6_addr),
@@ -1014,7 +1030,7 @@
 	char ip6bufs[INET6_ADDRSTRLEN], ip6bufd[INET6_ADDRSTRLEN];
 
 #ifdef MRT6DEBUG
-	if (mrt6debug & DEBUG_FORWARD)
+	if (V_mrt6debug & DEBUG_FORWARD)
 		log(LOG_DEBUG, "ip6_mforward: src %s, dst %s, ifindex %d\n",
 		    ip6_sprintf(ip6bufs, &ip6->ip6_src),
 		    ip6_sprintf(ip6bufd, &ip6->ip6_dst),
@@ -1081,7 +1097,7 @@
 
 		mrt6stat.mrt6s_no_route++;
 #ifdef MRT6DEBUG
-		if (mrt6debug & (DEBUG_FORWARD | DEBUG_MFC))
+		if (V_mrt6debug & (DEBUG_FORWARD | DEBUG_MFC))
 			log(LOG_DEBUG, "ip6_mforward: no rte s %s g %s\n",
 			    ip6_sprintf(ip6bufs, &ip6->ip6_src),
 			    ip6_sprintf(ip6bufd, &ip6->ip6_dst));
@@ -1160,7 +1176,7 @@
 #ifdef MRT6_OINIT
 			oim = NULL;
 #endif
-			switch (ip6_mrouter_ver) {
+			switch (V_ip6_mrouter_ver) {
 #ifdef MRT6_OINIT
 			case MRT6_OINIT:
 				oim = mtod(mm, struct omrt6msg *);
@@ -1182,7 +1198,7 @@
 			}
 
 #ifdef MRT6DEBUG
-			if (mrt6debug & DEBUG_FORWARD)
+			if (V_mrt6debug & DEBUG_FORWARD)
 				log(LOG_DEBUG,
 				    "getting the iif info in the kernel\n");
 #endif
@@ -1192,7 +1208,7 @@
 			     mifp++, mifi++)
 				;
 
-			switch (ip6_mrouter_ver) {
+			switch (V_ip6_mrouter_ver) {
 #ifdef MRT6_OINIT
 			case MRT6_OINIT:
 				oim->im6_mif = mifi;
@@ -1271,6 +1287,7 @@
 static void
 expire_upcalls(void *unused)
 {
+	INIT_VNET_INET6(curvnet);
 	struct rtdetq *rte;
 	struct mf6c *mfc, **nptr;
 	int i;
@@ -1292,7 +1309,7 @@
 			    mfc->mf6c_expire != 0 &&
 			    --mfc->mf6c_expire == 0) {
 #ifdef MRT6DEBUG
-				if (mrt6debug & DEBUG_EXPIRE) {
+				if (V_mrt6debug & DEBUG_EXPIRE) {
 					char ip6bufo[INET6_ADDRSTRLEN];
 					char ip6bufg[INET6_ADDRSTRLEN];
 					log(LOG_DEBUG, "expire_upcalls: expiring (%s %s)\n",
@@ -1361,7 +1378,7 @@
 	if ((mifi >= nummifs) || (mif6table[mifi].m6_ifp != ifp)) {
 		/* came in the wrong interface */
 #ifdef MRT6DEBUG
-		if (mrt6debug & DEBUG_FORWARD)
+		if (V_mrt6debug & DEBUG_FORWARD)
 			log(LOG_DEBUG,
 			    "wrong if: ifid %d mifi %d mififid %x\n",
 			    ifp->if_index, mifi,
@@ -1376,7 +1393,7 @@
 		 */
 		/* have to make sure this is a valid mif */
 		if (mifi < nummifs && mif6table[mifi].m6_ifp)
-			if (pim6 && (m->m_flags & M_LOOP) == 0) {
+			if (V_pim6 && (m->m_flags & M_LOOP) == 0) {
 				/*
 				 * Check the M_LOOP flag to avoid an
 				 * unnecessary PIM assert.
@@ -1403,7 +1420,7 @@
 				oim = NULL;
 #endif
 				im = NULL;
-				switch (ip6_mrouter_ver) {
+				switch (V_ip6_mrouter_ver) {
 #ifdef MRT6_OINIT
 				case MRT6_OINIT:
 					oim = mtod(mm, struct omrt6msg *);
@@ -1427,7 +1444,7 @@
 				     mifp++, iif++)
 					;
 
-				switch (ip6_mrouter_ver) {
+				switch (V_ip6_mrouter_ver) {
 #ifdef MRT6_OINIT
 				case MRT6_OINIT:
 					oim->im6_mif = iif;
@@ -1444,7 +1461,7 @@
 
 				if (socket_send(ip6_mrouter, mm, &sin6) < 0) {
 #ifdef MRT6DEBUG
-					if (mrt6debug)
+					if (V_mrt6debug)
 						log(LOG_WARNING, "mdq, ip6_mrouter socket queue full\n");
 #endif
 					++mrt6stat.mrt6s_upq_sockfull;
@@ -1554,7 +1571,7 @@
 				   IPV6_FORWARDING, &im6o, NULL, NULL);
 
 #ifdef MRT6DEBUG
-		if (mrt6debug & DEBUG_XMIT)
+		if (V_mrt6debug & DEBUG_XMIT)
 			log(LOG_DEBUG, "phyint_send on mif %d err %d\n",
 			    mifp - mif6table, error);
 #endif
@@ -1590,7 +1607,7 @@
 		error = (*ifp->if_output)(ifp, mb_copy,
 		    (struct sockaddr *)&ro.ro_dst, NULL);
 #ifdef MRT6DEBUG
-		if (mrt6debug & DEBUG_XMIT)
+		if (V_mrt6debug & DEBUG_XMIT)
 			log(LOG_DEBUG, "phyint_send on mif %d err %d\n",
 			    mifp - mif6table, error);
 #endif
@@ -1604,7 +1621,7 @@
 			icmp6_error(mb_copy, ICMP6_PACKET_TOO_BIG, 0, linkmtu);
 		else {
 #ifdef MRT6DEBUG
-			if (mrt6debug & DEBUG_XMIT) {
+			if (V_mrt6debug & DEBUG_XMIT) {
 				char ip6bufs[INET6_ADDRSTRLEN];
 				char ip6bufd[INET6_ADDRSTRLEN];
 				log(LOG_DEBUG,
@@ -1626,13 +1643,14 @@
 static int
 register_send(struct ip6_hdr *ip6, struct mif6 *mif, struct mbuf *m)
 {
+	INIT_VNET_INET6(curvnet);
 	struct mbuf *mm;
 	int i, len = m->m_pkthdr.len;
 	static struct sockaddr_in6 sin6 = { sizeof(sin6), AF_INET6 };
 	struct mrt6msg *im6;
 
 #ifdef MRT6DEBUG
-	if (mrt6debug) {
+	if (V_mrt6debug) {
 		char ip6bufs[INET6_ADDRSTRLEN], ip6bufd[INET6_ADDRSTRLEN];
 		log(LOG_DEBUG, "** IPv6 register_send **\n src %s dst %s\n",
 		    ip6_sprintf(ip6bufs, &ip6->ip6_src),
@@ -1678,7 +1696,7 @@
 
 	if (socket_send(ip6_mrouter, mm, &sin6) < 0) {
 #ifdef MRT6DEBUG
-		if (mrt6debug)
+		if (V_mrt6debug)
 			log(LOG_WARNING,
 			    "register_send: ip6_mrouter socket queue full\n");
 #endif
@@ -1717,7 +1735,7 @@
 	if (pimlen < PIM_MINLEN) {
 		++pim6stat.pim6s_rcv_tooshort;
 #ifdef MRT6DEBUG
-		if (mrt6debug & DEBUG_PIM)
+		if (V_mrt6debug & DEBUG_PIM)
 			log(LOG_DEBUG,"pim6_input: PIM packet too short\n");
 #endif
 		m_freem(m);
@@ -1770,7 +1788,7 @@
 		if (in6_cksum(m, IPPROTO_PIM, off, cksumlen)) {
 			++pim6stat.pim6s_rcv_badsum;
 #ifdef MRT6DEBUG
-			if (mrt6debug & DEBUG_PIM)
+			if (V_mrt6debug & DEBUG_PIM)
 				log(LOG_DEBUG,
 				    "pim6_input: invalid checksum\n");
 #endif
@@ -1812,7 +1830,7 @@
 
 		if ((reg_mif_num >= nummifs) || (reg_mif_num == (mifi_t) -1)) {
 #ifdef MRT6DEBUG
-			if (mrt6debug & DEBUG_PIM)
+			if (V_mrt6debug & DEBUG_PIM)
 				log(LOG_DEBUG,
 				    "pim6_input: register mif not set: %d\n",
 				    reg_mif_num);
@@ -1844,7 +1862,7 @@
 
 		eip6 = (struct ip6_hdr *) (reghdr + 1);
 #ifdef MRT6DEBUG
-		if (mrt6debug & DEBUG_PIM)
+		if (V_mrt6debug & DEBUG_PIM)
 			log(LOG_DEBUG,
 			    "pim6_input[register], eip6: %s -> %s, "
 			    "eip6 plen %d\n",
@@ -1869,7 +1887,7 @@
 		if (!IN6_IS_ADDR_MULTICAST(&eip6->ip6_dst)) {
 			++pim6stat.pim6s_rcv_badregisters;
 #ifdef MRT6DEBUG
-			if (mrt6debug & DEBUG_PIM)
+			if (V_mrt6debug & DEBUG_PIM)
 				log(LOG_DEBUG,
 				    "pim6_input: inner packet of register "
 				    "is not multicast %s\n",
@@ -1898,7 +1916,7 @@
 		 */
 		m_adj(m, off + PIM_MINLEN);
 #ifdef MRT6DEBUG
-		if (mrt6debug & DEBUG_PIM) {
+		if (V_mrt6debug & DEBUG_PIM) {
 			log(LOG_DEBUG,
 			    "pim6_input: forwarding decapsulated register: "
 			    "src %s, dst %s, mif %d\n",

==== //depot/projects/vimage/src/sys/netinet6/ip6_var.h#8 (text+ko) ====

@@ -283,9 +283,7 @@
 extern int	ip6_defhlim;		/* default hop limit */
 extern int	ip6_defmcasthlim;	/* default multicast hop limit */
 extern int	ip6_forwarding;		/* act as router? */
-#endif
 extern int	ip6_forward_srcrt;	/* forward src-routed? */
-#ifndef VIMAGE
 extern int	ip6_gif_hlim;		/* Hop limit for gif encap packet */
 extern int	ip6_use_deprecated;	/* allow deprecated addr as source */
 extern int	ip6_rr_prune;		/* router renumbering prefix
@@ -299,10 +297,8 @@
 extern int	ip6_sendredirects;	/* send IP redirects when forwarding? */
 extern int	ip6_maxfragpackets; /* Maximum packets in reassembly queue */
 extern int	ip6_maxfrags;	/* Maximum fragments in reassembly queue */
-#endif
 extern int	ip6_sourcecheck;	/* Verify source interface */
 extern int	ip6_sourcecheck_interval; /* Interval between log messages */
-#ifndef VIMAGE
 extern int	ip6_accept_rtadv;	/* Acts as a host not a router */
 extern int	ip6_keepfaith;		/* Firewall Aided Internet Translator */
 extern int	ip6_log_interval;
@@ -320,8 +316,10 @@
 extern int   ip6_lowportmax;		/* maximum reserved port */
 
 extern int	ip6_use_tempaddr; /* whether to use temporary addresses. */
+#ifndef VIMAGE
 extern int	ip6_prefer_tempaddr; /* whether to prefer temporary addresses
 					in the source address selection */
+#endif
 
 extern int	ip6_use_defzone; /* whether to use the default scope zone
 				    when unspecified */

==== //depot/projects/vimage/src/sys/netinet6/nd6.c#18 (text+ko) ====

@@ -81,6 +81,7 @@
 #define SDL(s) ((struct sockaddr_dl *)s)
 
 /* timer values */
+#ifndef VIMAGE
 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 */
@@ -93,6 +94,7 @@
 
 int nd6_maxnudhint = 0;	/* max # of subsequent upper layer hints */
 int nd6_maxqueuelen = 1; /* max # of packets cached in unresolved ND entries */
+#endif /* !VIMAGE */
 
 #ifdef ND6_DEBUG
 int nd6_debug = 1;
@@ -107,9 +109,9 @@
 struct llinfo_nd6 llinfo_nd6;
 struct nd_drhead nd_defrouter;
 struct nd_prhead nd_prefix;
-#endif
 
 int nd6_recalc_reachtm_interval = ND6_RECALC_REACHTM_INTERVAL;
+#endif /* !VIMAGE */ 
 static struct sockaddr_in6 all1_sa;
 
 static int nd6_is_new_addr_neighbor __P((struct sockaddr_in6 *,
@@ -133,6 +135,36 @@
 	INIT_VNET_INET6(curvnet);
 	int i;
 
+	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 # of packets cached in unresolved ND entries */
+	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_ip6_use_tempaddr = 0;
+
+	V_ip6_desync_factor = 0;
+	V_ip6_temp_preferred_lifetime = DEF_TEMP_PREFERRED_LIFETIME;
+	V_ip6_temp_valid_lifetime = DEF_TEMP_VALID_LIFETIME;
+	/*
+ 	 * shorter lifetimes for debugging purposes.
+	V_ip6_temp_preferred_lifetime = 800;
+	V_ip6_temp_valid_lifetime = 1800;
+	*/
+
+	V_ip6_temp_regen_advance = TEMPADDR_REGEN_ADVANCE;
+
 	V_llinfo_nd6.ln_next = V_llinfo_nd6.ln_prev = &V_llinfo_nd6;
 	LIST_INIT(&V_nd_prefix);
 

>>> TRUNCATED FOR MAIL (1000 lines) <<<



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200709031608.l83G8JNL093158>