PERFORCE change 126081 for review

Ana Kukec anchie at FreeBSD.org
Tue Sep 4 16:40:53 PDT 2007


http://perforce.freebsd.org/chv.cgi?CH=126081

Change 126081 by anchie at anchie_malimis on 2007/09/04 23:39:51

	Added domain init function for inet6domain.	

Affected files ...

.. //depot/projects/vimage/src/sys/netinet/tcp_subr.c#28 edit
.. //depot/projects/vimage/src/sys/netinet6/icmp6.c#15 edit
.. //depot/projects/vimage/src/sys/netinet6/in6_ifattach.c#13 edit
.. //depot/projects/vimage/src/sys/netinet6/in6_pcb.c#13 edit
.. //depot/projects/vimage/src/sys/netinet6/in6_proto.c#14 edit
.. //depot/projects/vimage/src/sys/netinet6/ip6_input.c#22 edit
.. //depot/projects/vimage/src/sys/netinet6/ip6_output.c#11 edit
.. //depot/projects/vimage/src/sys/netinet6/nd6.c#19 edit
.. //depot/projects/vimage/src/sys/netinet6/nd6.h#5 edit
.. //depot/projects/vimage/src/sys/netinet6/nd6_rtr.c#9 edit
.. //depot/projects/vimage/src/sys/netinet6/raw_ip6.c#14 edit
.. //depot/projects/vimage/src/sys/netinet6/scope6.c#11 edit
.. //depot/projects/vimage/src/sys/netinet6/udp6_usrreq.c#17 edit
.. //depot/projects/vimage/src/sys/netinet6/vinet6.h#12 edit

Differences ...

==== //depot/projects/vimage/src/sys/netinet/tcp_subr.c#28 (text+ko) ====

@@ -95,6 +95,7 @@
 #include <netinet/tcp_debug.h>
 #endif
 #include <netinet6/ip6protosw.h>
+#include <netinet6/vinet6.h>
 
 #ifdef IPSEC
 #include <netipsec/ipsec.h>
@@ -1148,6 +1149,7 @@
 tcp6_getcred(SYSCTL_HANDLER_ARGS)
 {
 	INIT_VNET_INET(curvnet);
+	INIT_VNET_INET6(curvnet);
 	struct xucred xuc;
 	struct sockaddr_in6 addrs[2];
 	struct inpcb *inp;
@@ -1159,8 +1161,8 @@
 	error = SYSCTL_IN(req, addrs, sizeof(addrs));
 	if (error)
 		return (error);
-	if ((error = sa6_embedscope(&addrs[0], ip6_use_defzone)) != 0 ||
-	    (error = sa6_embedscope(&addrs[1], ip6_use_defzone)) != 0) {
+	if ((error = sa6_embedscope(&addrs[0], V_ip6_use_defzone)) != 0 ||
+	    (error = sa6_embedscope(&addrs[1], V_ip6_use_defzone)) != 0) {
 		return (error);
 	}
 	if (IN6_IS_ADDR_V4MAPPED(&addrs[0].sin6_addr)) {
@@ -2062,6 +2064,7 @@
 sysctl_drop(SYSCTL_HANDLER_ARGS)
 {
 	INIT_VNET_INET(curvnet);
+	INIT_VNET_INET6(curvnet);
 	/* addrs[0] is a foreign socket, addrs[1] is a local one. */
 	struct sockaddr_storage addrs[2];
 	struct inpcb *inp;
@@ -2108,10 +2111,10 @@
 			lin = (struct sockaddr_in *)&addrs[1];
 			break;
 		}
-		error = sa6_embedscope(fin6, ip6_use_defzone);
+		error = sa6_embedscope(fin6, V_ip6_use_defzone);
 		if (error)
 			return (error);
-		error = sa6_embedscope(lin6, ip6_use_defzone);
+		error = sa6_embedscope(lin6, V_ip6_use_defzone);
 		if (error)
 			return (error);
 		break;

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

@@ -120,7 +120,7 @@
 static int icmp6errpps_count = 0;
 #endif /* !VIMAGE */
 static struct timeval icmp6errppslim_last;
-#ifdef VIMAGE
+#ifndef VIMAGE
 extern int icmp6_nodeinfo;
 #endif /* !VIMAGE */
 

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

@@ -136,6 +136,7 @@
 static int
 generate_tmp_ifid(u_int8_t *seed0, const u_int8_t *seed1, u_int8_t *ret)
 {
+	INIT_VNET_INET6(curvnet);
 	MD5_CTX ctxt;
 	u_int8_t seed[16], digest[16], nullbuf[8];
 	u_int32_t val32;
@@ -356,6 +357,7 @@
     struct in6_addr *in6)
 {
 	INIT_VNET_NET(ifp0->if_vnet);
+	INIT_VNET_INET6(ifp0->if_vnet);
 	struct ifnet *ifp;
 
 	/* first, try to get it from the interface itself */
@@ -419,6 +421,7 @@
 static int
 in6_ifattach_linklocal(struct ifnet *ifp, struct ifnet *altifp)
 {
+	INIT_VNET_INET6(curvnet);
 	struct in6_ifaddr *ia;
 	struct in6_aliasreq ifra;
 	struct nd_prefixctl pr0;
@@ -535,6 +538,7 @@
 static int
 in6_ifattach_loopback(struct ifnet *ifp)
 {
+	INIT_VNET_INET6(curvnet);
 	struct in6_aliasreq ifra;
 	int error;
 

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

@@ -146,7 +146,7 @@
 		if (nam->sa_family != AF_INET6)
 			return (EAFNOSUPPORT);
 
-		if ((error = sa6_embedscope(sin6, ip6_use_defzone)) != 0)
+		if ((error = sa6_embedscope(sin6, V_ip6_use_defzone)) != 0)
 			return(error);
 
 		lport = sin6->sin6_port;
@@ -302,9 +302,9 @@
 	if (sin6->sin6_port == 0)
 		return (EADDRNOTAVAIL);
 
-	if (sin6->sin6_scope_id == 0 && !ip6_use_defzone)
+	if (sin6->sin6_scope_id == 0 && !V_ip6_use_defzone)
 		scope_ambiguous = 1;
-	if ((error = sa6_embedscope(sin6, ip6_use_defzone)) != 0)
+	if ((error = sa6_embedscope(sin6, V_ip6_use_defzone)) != 0)
 		return(error);
 
 	if (V_in6_ifaddr) {

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

@@ -349,37 +349,9 @@
 extern int in6_detachhead(void **, int);
 #endif
 
-static void
-ip6_test_init(void)
-{
-    printf("---> ip6_test_init() \n");
-}
-
-struct domain inet6domain = {
-	.dom_family =		AF_INET6,
-	.dom_name =		"internet6",
-	.dom_protosw =		(struct protosw *)inet6sw,
-	.dom_protoswNPROTOSW =	(struct protosw *)
-				&inet6sw[sizeof(inet6sw)/sizeof(inet6sw[0])],
-	.dom_rtattach =		in6_inithead,
-#ifdef VIMAGE
-	.dom_rtdetach =		in6_detachhead,
-#endif
-	.dom_rtoffset =		offsetof(struct sockaddr_in6, sin6_addr) << 3,
-	.dom_maxrtkey =		sizeof(struct sockaddr_in6),
-	.dom_ifattach =		in6_domifattach,
-	.dom_ifdetach =		in6_domifdetach,
-#ifdef VIMAGE
-	.dom_init	=		ip6_test_init		
-#endif
-};
-
-DOMAIN_SET(inet6);
-
 /*
  * Internet configuration info
  */
-#ifndef VIMAGE
 #ifndef	IPV6FORWARDING
 #ifdef GATEWAY6
 #define	IPV6FORWARDING	1	/* forward IP6 packets not for us */
@@ -392,6 +364,7 @@
 #define	IPV6_SENDREDIRECTS	1
 #endif
 
+#ifndef VIMAGE
 int	ip6_forwarding = IPV6FORWARDING;	/* act as router? */
 int	ip6_sendredirects = IPV6_SENDREDIRECTS;
 int	ip6_defhlim = IPV6_DEFHLIM;
@@ -426,6 +399,7 @@
 #ifndef VIMAGE
 int pmtu_expire = 60*10;
 int pmtu_probe = 60*2;
+#endif
 
 /* raw IP6 parameters */
 /*
@@ -434,6 +408,7 @@
 #define	RIPV6SNDQ	8192
 #define	RIPV6RCVQ	8192
 
+#ifndef VIMAGE
 u_long	rip6_sendspace = RIPV6SNDQ;
 u_long	rip6_recvspace = RIPV6RCVQ;
 
@@ -447,7 +422,6 @@
 /* UDP on IP6 parameters */
 int	udp6_sendspace = 9216;		/* really max datagram size */
 int	udp6_recvspace = 40 * (1024 + sizeof(struct sockaddr_in6));
-					/* 40 1K datagrams */
 #endif /* !VIMAGE */
 
 /*
@@ -477,7 +451,9 @@
 #endif
 {
 	INIT_VNET_INET6(curvnet);
+#ifdef VIMAGE
 	SYSCTL_RESOLVE_V_ARG1();
+#endif
 	int error = 0;
 	int old;
 
@@ -502,7 +478,9 @@
 #endif
 {
 	INIT_VNET_INET6(curvnet);
+#ifdef VIMAGE
 	SYSCTL_RESOLVE_V_ARG1();
+#endif
 	int error = 0;
 	int old;
 
@@ -552,12 +530,21 @@
 	rr_prune, CTLFLAG_RW,	ip6_rr_prune,			0, "");
 SYSCTL_V_INT(V_NET, vnet_inet6, _net_inet6_ip6, IPV6CTL_USETEMPADDR,
 	use_tempaddr, CTLFLAG_RW, ip6_use_tempaddr,		0, "");
+#ifdef VIMAGE
 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", "");
+#else
+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", "");
+#endif
 SYSCTL_V_INT(V_NET, vnet_inet6, _net_inet6_ip6, IPV6CTL_V6ONLY,
 	v6only,	CTLFLAG_RW,	ip6_v6only,			0, "");
 #ifndef VIMAGE
@@ -569,8 +556,8 @@
 	rip6stats, CTLFLAG_RD, rip6stat, rip6stat, "");
 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_USE_DEFAULTZONE,
+	use_defaultzone, CTLFLAG_RW, ip6_use_defzone,		0,"");
 SYSCTL_V_INT(V_NET, vnet_inet6, _net_inet6_ip6, IPV6CTL_MAXFRAGS,
 	maxfrags, CTLFLAG_RW,		ip6_maxfrags,	0, "");
 SYSCTL_V_INT(V_NET, vnet_inet6, _net_inet6_ip6, IPV6CTL_MCAST_PMTU,
@@ -603,5 +590,79 @@
 	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, "");
+SYSCTL_V_INT(V_NET, vnet_inet6, _net_inet6_icmp6, ICMPV6CTL_ND6_DEBUG,
+	nd6_debug, CTLFLAG_RW,	nd6_debug,		0, "");
+
+#ifdef VIMAGE
+static void
+ip6_test_init(void)
+{
+	INIT_VNET_INET6(curvnet);
+	INIT_VNET_GIF(curvnet);
+
+	printf("---> ip6_test_init() \n");
+	V_ip6_forwarding = IPV6FORWARDING;    /* act as router? */
+	V_ip6_sendredirects = IPV6_SENDREDIRECTS;
+	V_ip6_defhlim = IPV6_DEFHLIM;
+	V_ip6_defmcasthlim = IPV6_DEFAULT_MULTICAST_HOPS;
+	V_ip6_accept_rtadv = 0;   /* "IPV6FORWARDING ? 0 : 1" is dangerous */
+	V_ip6_maxfragpackets = 0; /* initialized in frag6.c:frag6_init() */
+	V_ip6_maxfrags = 0;   /* initialized in frag6.c:frag6_init() */
+	V_ip6_log_interval = 5;
+	V_ip6_hdrnestlimit = 15;  /* How many header options will we process? */
+	V_ip6_dad_count = 1;  /* DupAddrDetectionTransmits */
+	V_ip6_auto_flowlabel = 1;
+	V_ip6_gif_hlim = 0;
+	V_ip6_use_deprecated = 1; /* allow deprecated addr (RFC2462 5.5.4) */
+	V_ip6_rr_prune = 5;   /* router renumbering prefix
+                * walk list every 5 sec. */
+	V_ip6_mcast_pmtu = 0; /* enable pMTU discovery for multicast? */
+	V_ip6_v6only = 1;
+
+	V_ip6_keepfaith = 0;
+	V_ip6_log_time = (time_t)0L;
+#ifdef IPSTEALTH
+	V_ip6stealth = 0;
+#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 */
+
+}
+#endif
+
+struct domain inet6domain = {
+        .dom_family =           AF_INET6,
+        .dom_name =             "internet6",
+        .dom_protosw =          (struct protosw *)inet6sw,
+        .dom_protoswNPROTOSW =  (struct protosw *)
+                                &inet6sw[sizeof(inet6sw)/sizeof(inet6sw[0])],
+        .dom_rtattach =         in6_inithead,
+#ifdef VIMAGE
+        .dom_rtdetach =         in6_detachhead,
+#endif
+        .dom_rtoffset =         offsetof(struct sockaddr_in6, sin6_addr) << 3,
+        .dom_maxrtkey =         sizeof(struct sockaddr_in6),
+        .dom_ifattach =         in6_domifattach,
+        .dom_ifdetach =         in6_domifdetach,
+#ifdef VIMAGE
+        .dom_init =             ip6_test_init
+#endif
+};
+
+DOMAIN_SET(inet6);

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

@@ -159,22 +159,6 @@
 SYSINIT(inet6, SI_SUB_PROTO_BEGIN, SI_ORDER_FIRST, vnet_inet6_register, 0);
 #endif /* VIMAGE */
 
-#ifdef VIMAGE
-#ifndef IPV6FORWARDING
-#ifdef GATEWAY6
-#define IPV6FORWARDING  1   /* forward IP6 packets not for us */
-#else
-#define IPV6FORWARDING  0   /* don't forward IP6 packets not for us */
-#endif /* !GATEWAY6 */
-#endif /* !IPV6FORWARDING */
-
-#ifndef IPV6_SENDREDIRECTS
-#define IPV6_SENDREDIRECTS  1
-#endif
-#define RIPV6SNDQ   8192
-#define RIPV6RCVQ   8192
-#endif /* !VIMAGE */
-
 /*
  * IP6 initialization: fill in IP6 protocol switch table.
  * All protocols not implemented in kernel go to raw IP6 protocol handler.
@@ -184,52 +168,9 @@
 {
 	printf("---> ip6_init() \n");
 	INIT_VNET_INET6(curvnet);
-	INIT_VNET_GIF(curvnet);
 	struct ip6protosw *pr;
 	int i;
 
-	V_ip6_forwarding = IPV6FORWARDING;    /* act as router? */
-	V_ip6_sendredirects = IPV6_SENDREDIRECTS;
-	V_ip6_defhlim = IPV6_DEFHLIM;
-	V_ip6_defmcasthlim = IPV6_DEFAULT_MULTICAST_HOPS;
-	V_ip6_accept_rtadv = 0;   /* "IPV6FORWARDING ? 0 : 1" is dangerous */
-	V_ip6_maxfragpackets = 0; /* initialized in frag6.c:frag6_init() */
-	V_ip6_maxfrags = 0;   /* initialized in frag6.c:frag6_init() */
-	V_ip6_log_interval = 5;
-	V_ip6_hdrnestlimit = 15;  /* How many header options will we process? */
-	V_ip6_dad_count = 1;  /* DupAddrDetectionTransmits */
-	V_ip6_auto_flowlabel = 1;
-	V_ip6_gif_hlim = 0;
-	V_ip6_use_deprecated = 1; /* allow deprecated addr (RFC2462 5.5.4) */
-	V_ip6_rr_prune = 5;   /* router renumbering prefix
-                 * walk list every 5 sec. */
-	V_ip6_mcast_pmtu = 0; /* enable pMTU discovery for multicast? */
-	V_ip6_v6only = 1;
-
-	V_ip6_keepfaith = 0;
-	V_ip6_log_time = (time_t)0L;
-#ifdef IPSTEALTH
-	V_ip6stealth = 0;
-#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;

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

@@ -455,7 +455,7 @@
 			 sa.sin6_len = sizeof(sa);
 			 sa.sin6_addr = addr[0];
 			 if ((error = sa6_embedscope(&sa,
-			     ip6_use_defzone)) != 0) {
+			     V_ip6_use_defzone)) != 0) {
 				 goto bad;
 			 }
 			 ip6->ip6_dst = sa.sin6_addr;
@@ -2662,7 +2662,7 @@
 			sa6_mc.sin6_family = AF_INET6;
 			sa6_mc.sin6_len = sizeof(sa6_mc);
 			sa6_mc.sin6_addr = mreq->ipv6mr_multiaddr;
-			error = sa6_embedscope(&sa6_mc, ip6_use_defzone);
+			error = sa6_embedscope(&sa6_mc, V_ip6_use_defzone);
 			if (error != 0)
 				break;
 			mreq->ipv6mr_multiaddr = sa6_mc.sin6_addr;
@@ -2848,6 +2848,7 @@
     int priv, int sticky, int cmsg, int uproto)
 {
 	INIT_VNET_NET(curvnet);
+	INIT_VNET_INET6(curvnet);
 	int minmtupolicy, preftemp;
 
 	if (!sticky && !cmsg) {
@@ -3015,7 +3016,7 @@
 			    IN6_IS_ADDR_MULTICAST(&sa6->sin6_addr)) {
 				return (EINVAL);
 			}
-			if ((error = sa6_embedscope(sa6, ip6_use_defzone))
+			if ((error = sa6_embedscope(sa6, V_ip6_use_defzone))
 			    != 0) {
 				return (error);
 			}

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

@@ -94,7 +94,6 @@
 
 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;
@@ -102,7 +101,6 @@
 int nd6_debug = 0;
 #endif
 
-#ifndef VIMAGE
 /* for debugging? */
 static int nd6_inuse, nd6_allocated;
 
@@ -147,6 +145,13 @@
 
 	V_nd6_maxnudhint = 0; /* max # of subsequent upper layer hints */
 	V_nd6_maxqueuelen = 1; /* max # of packets 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*/
@@ -864,6 +869,7 @@
 struct rtentry *
 nd6_lookup(struct in6_addr *addr6, int create, struct ifnet *ifp)
 {
+	INIT_VNET_INET6(curvnet);
 	struct rtentry *rt;
 	struct sockaddr_in6 sin6;
 	char ip6buf[INET6_ADDRSTRLEN];

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

@@ -328,6 +328,7 @@
 LIST_HEAD(nd_prhead, nd_prefix);
 
 /* nd6.c */
+#ifndef VIMAGE
 extern int nd6_prune;
 extern int nd6_delay;
 extern int nd6_umaxtries;
@@ -335,14 +336,13 @@
 extern int nd6_useloopback;
 extern int nd6_maxnudhint;
 extern int nd6_gctimer;
-#ifndef VIMAGE
 extern struct llinfo_nd6 llinfo_nd6;
 extern struct nd_drhead nd_defrouter;
 extern struct nd_prhead nd_prefix;
+extern int nd6_debug;
 #endif
-extern int nd6_debug;
 
-#define nd6log(x)	do { if (nd6_debug) log x; } while (/*CONSTCOND*/ 0)
+#define nd6log(x)	do { if (V_nd6_debug) log x; } while (/*CONSTCOND*/ 0)
 
 #ifndef VIMAGE
 extern struct callout nd6_timer_ch;
@@ -351,13 +351,11 @@
 /* nd6_rtr.c */
 #ifndef VIMAGE
 extern int nd6_defifindex;
-#endif
 extern int ip6_desync_factor;	/* seconds */
-#ifndef VIMAGE
 extern u_int32_t ip6_temp_preferred_lifetime; /* seconds */
 extern u_int32_t ip6_temp_valid_lifetime; /* seconds */
+extern int ip6_temp_regen_advance; /* seconds */
 #endif
-extern int ip6_temp_regen_advance; /* seconds */
 
 union nd_opts {
 	struct nd_opt_hdr *nd_opt_array[8];	/* max = target address list */

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

@@ -933,6 +933,7 @@
 void
 prelist_remove(struct nd_prefix *pr)
 {
+	INIT_VNET_INET6(curvnet);
 	struct nd_pfxrouter *pfr, *next;
 	int e, s;
 	char ip6buf[INET6_ADDRSTRLEN];
@@ -1742,6 +1743,7 @@
 static struct in6_ifaddr *
 in6_ifadd(struct nd_prefixctl *pr, int mcast)
 {
+	INIT_VNET_INET6(curvnet);
 	struct ifnet *ifp = pr->ndpr_ifp;
 	struct ifaddr *ifa;
 	struct in6_aliasreq ifra;

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

@@ -371,9 +371,9 @@
 	 * XXX: we may still need to determine the zone later.
 	 */
 	if (!(so->so_state & SS_ISCONNECTED)) {
-		if (dstsock->sin6_scope_id == 0 && !ip6_use_defzone)
+		if (dstsock->sin6_scope_id == 0 && !V_ip6_use_defzone)
 			scope_ambiguous = 1;
-		if ((error = sa6_embedscope(dstsock, ip6_use_defzone)) != 0)
+		if ((error = sa6_embedscope(dstsock, V_ip6_use_defzone)) != 0)
 			goto bad;
 	}
 
@@ -654,6 +654,7 @@
 {
 	INIT_VNET_NET(so->so_vnet);
 	INIT_VNET_INET(so->so_vnet);
+	INIT_VNET_INET6(so->so_vnet);
 	struct inpcb *inp = sotoinpcb(so);
 	struct sockaddr_in6 *addr = (struct sockaddr_in6 *)nam;
 	struct ifaddr *ia = NULL;
@@ -664,7 +665,7 @@
 		return EINVAL;
 	if (TAILQ_EMPTY(&V_ifnet) || addr->sin6_family != AF_INET6)
 		return EADDRNOTAVAIL;
-	if ((error = sa6_embedscope(addr, ip6_use_defzone)) != 0)
+	if ((error = sa6_embedscope(addr, V_ip6_use_defzone)) != 0)
 		return(error);
 
 	if (!IN6_IS_ADDR_UNSPECIFIED(&addr->sin6_addr) &&
@@ -689,6 +690,7 @@
 {
 	INIT_VNET_NET(so->so_vnet);
 	INIT_VNET_INET(so->so_vnet);
+	INIT_VNET_INET6(so->so_vnet);
 	struct inpcb *inp = sotoinpcb(so);
 	struct sockaddr_in6 *addr = (struct sockaddr_in6 *)nam;
 	struct in6_addr *in6a = NULL;
@@ -711,9 +713,9 @@
 	 * we'll see if we can determine the outgoing interface.  If we
 	 * can, determine the zone ID based on the interface below.
 	 */
-	if (addr->sin6_scope_id == 0 && !ip6_use_defzone)
+	if (addr->sin6_scope_id == 0 && !V_ip6_use_defzone)
 		scope_ambiguous = 1;
-	if ((error = sa6_embedscope(addr, ip6_use_defzone)) != 0)
+	if ((error = sa6_embedscope(addr, V_ip6_use_defzone)) != 0)
 		return(error);
 
 	INP_INFO_WLOCK(&V_ripcbinfo);

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

@@ -51,11 +51,13 @@
 #include <netinet6/in6_var.h>
 #include <netinet6/scope6_var.h>
 
+#ifndef VIMAGE
 #ifdef ENABLE_DEFAULT_SCOPE
 int ip6_use_defzone = 1;
 #else
 int ip6_use_defzone = 0;
 #endif
+#endif /* !VIMAGE */
 
 /*
  * The scope6_lock protects the global sid default stored in
@@ -79,6 +81,12 @@
 {
 	INIT_VNET_INET6(curvnet);
 
+#ifdef ENABLE_DEFAULT_SCOPE
+	V_ip6_use_defzone = 1;
+#else
+	V_ip6_use_defzone = 0;
+#endif
+
 	bzero(&V_sid_default, sizeof(V_sid_default));
 
 #ifdef VIMAGE

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

@@ -437,6 +437,7 @@
 udp6_getcred(SYSCTL_HANDLER_ARGS)
 {
 	INIT_VNET_INET(curvnet);
+	INIT_VNET_INET6(curvnet);
 	struct xucred xuc;
 	struct sockaddr_in6 addrs[2];
 	struct inpcb *inp;
@@ -453,8 +454,8 @@
 	error = SYSCTL_IN(req, addrs, sizeof(addrs));
 	if (error)
 		return (error);
-	if ((error = sa6_embedscope(&addrs[0], ip6_use_defzone)) != 0 ||
-	    (error = sa6_embedscope(&addrs[1], ip6_use_defzone)) != 0) {
+	if ((error = sa6_embedscope(&addrs[0], V_ip6_use_defzone)) != 0 ||
+	    (error = sa6_embedscope(&addrs[1], V_ip6_use_defzone)) != 0) {
 		return (error);
 	}
 	INP_INFO_RLOCK(&V_udbinfo);
@@ -494,6 +495,7 @@
     struct mbuf *control, struct thread *td)
 {
 	INIT_VNET_INET(curvnet);
+	INIT_VNET_INET6(curvnet);
 	u_int32_t ulen = m->m_pkthdr.len;
 	u_int32_t plen = sizeof(struct udphdr) + ulen;
 	struct ip6_hdr *ip6;
@@ -532,9 +534,9 @@
 		 * we'll see if we can determine the outgoing interface.  If we
 		 * can, determine the zone ID based on the interface below.
 		 */
-		if (sin6->sin6_scope_id == 0 && !ip6_use_defzone)
+		if (sin6->sin6_scope_id == 0 && !V_ip6_use_defzone)
 			scope_ambiguous = 1;
-		if ((error = sa6_embedscope(sin6, ip6_use_defzone)) != 0)
+		if ((error = sa6_embedscope(sin6, V_ip6_use_defzone)) != 0)
 			return (error);
 	}
 

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

@@ -66,16 +66,16 @@
 	u_int				_in6_maxmtu;
 	int				_ip6_auto_linklocal;
 
-	struct ip6stat 		_ip6stat;
+	struct ip6stat 			_ip6stat;
 	struct rip6stat 		_rip6stat;
 	struct icmp6stat 		_icmp6stat;
 
 	int				_rtq_timeout6;  
-	struct callout 		_rtq_timer6;
-	struct callout 		_rtq_mtutimer;
-	struct callout 		_nd6_slowtimo_ch;
-	struct callout 		_nd6_timer_ch;
-	struct callout 		_in6_tmpaddrtimer_ch;
+	struct callout 			_rtq_timer6;
+	struct callout 			_rtq_mtutimer;
+	struct callout 			_nd6_slowtimo_ch;
+	struct callout 			_nd6_timer_ch;
+	struct callout 			_in6_tmpaddrtimer_ch;
 
 	int				_nd6_inuse;
 	int				_nd6_allocated;
@@ -139,6 +139,7 @@
 	int				_nd6_maxndopt;
 	int				_nd6_maxnudhint;
 	int				_nd6_maxqueuelen;
+	int				_nd6_debug;
 	int				_nd6_recalc_reachtm_interval;
 	int				_dad_ignore_ns;
 	int				_dad_maxtry;
@@ -152,6 +153,7 @@
 	u_int				_mrt6debug;
 
 	int				_ip6_temp_regen_advance;
+	int				_ip6_use_defzone;
 };
 #endif
 
@@ -245,6 +247,7 @@
 #define V_nd6_maxndopt			VNET_INET6(nd6_maxndopt)
 #define V_nd6_maxnudhint		VNET_INET6(nd6_maxnudhint)
 #define V_nd6_maxqueuelen		VNET_INET6(nd6_maxqueuelen)
+#define V_nd6_debug			VNET_INET6(nd6_debug)
 #define V_nd6_recalc_reachtm_interval	VNET_INET6(nd6_recalc_reachtm_interval)
 #define V_dad_ignore_ns			VNET_INET6(dad_ignore_ns)
 #define V_dad_maxtry			VNET_INET6(dad_maxtry)
@@ -258,4 +261,6 @@
 #define V_mrt6debug			VNET_INET6(mrt6debug)
 #define V_ip6_temp_regen_advance	VNET_INET6(ip6_temp_regen_advance)
 
+#define V_ip6_use_defzone		VNET_INET6(ip6_use_defzone)
+
 #endif /* !_NETINET6_VINET6_H_ */


More information about the p4-projects mailing list