PERFORCE change 144254 for review

Julian Elischer julian at FreeBSD.org
Sun Jun 29 01:21:48 UTC 2008


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

Change 144254 by julian at julian_trafmon1 on 2008/06/29 01:20:49

	merge in a pile of Macros to reduce the diff size
	and assist testing.

Affected files ...

.. //depot/projects/vimage-commit3/src/sys/compat/linprocfs/linprocfs.c#2 edit
.. //depot/projects/vimage-commit3/src/sys/compat/linux/linux_ioctl.c#2 edit
.. //depot/projects/vimage-commit3/src/sys/compat/linux/linux_misc.c#2 edit
.. //depot/projects/vimage-commit3/src/sys/ddb/db_textdump.c#2 edit
.. //depot/projects/vimage-commit3/src/sys/dev/firewire/firewire.c#2 edit
.. //depot/projects/vimage-commit3/src/sys/fs/cd9660/cd9660_rrip.c#2 edit
.. //depot/projects/vimage-commit3/src/sys/kern/kern_jail.c#2 edit
.. //depot/projects/vimage-commit3/src/sys/kern/kern_mib.c#2 edit
.. //depot/projects/vimage-commit3/src/sys/kern/kern_uuid.c#2 edit
.. //depot/projects/vimage-commit3/src/sys/kern/kern_xxx.c#2 edit
.. //depot/projects/vimage-commit3/src/sys/net/if.c#2 edit
.. //depot/projects/vimage-commit3/src/sys/net/if_ethersubr.c#2 edit
.. //depot/projects/vimage-commit3/src/sys/net/if_faith.c#2 edit
.. //depot/projects/vimage-commit3/src/sys/net/if_gif.c#2 edit
.. //depot/projects/vimage-commit3/src/sys/net/if_gre.c#2 edit
.. //depot/projects/vimage-commit3/src/sys/net/if_loop.c#2 edit
.. //depot/projects/vimage-commit3/src/sys/net/if_mib.c#2 edit
.. //depot/projects/vimage-commit3/src/sys/net/if_stf.c#2 edit
.. //depot/projects/vimage-commit3/src/sys/net/if_vlan.c#2 edit
.. //depot/projects/vimage-commit3/src/sys/net/raw_cb.c#3 edit
.. //depot/projects/vimage-commit3/src/sys/net/raw_usrreq.c#3 edit
.. //depot/projects/vimage-commit3/src/sys/net/route.c#2 edit
.. //depot/projects/vimage-commit3/src/sys/net/rtsock.c#2 edit
.. //depot/projects/vimage-commit3/src/sys/net80211/ieee80211.c#2 edit
.. //depot/projects/vimage-commit3/src/sys/netgraph/ng_base.c#2 edit
.. //depot/projects/vimage-commit3/src/sys/netgraph/ng_eiface.c#2 edit
.. //depot/projects/vimage-commit3/src/sys/netgraph/ng_iface.c#2 edit
.. //depot/projects/vimage-commit3/src/sys/netinet/if_ether.c#2 edit
.. //depot/projects/vimage-commit3/src/sys/netinet/igmp.c#2 edit
.. //depot/projects/vimage-commit3/src/sys/netinet/in.c#2 edit
.. //depot/projects/vimage-commit3/src/sys/netinet/in_gif.c#2 edit
.. //depot/projects/vimage-commit3/src/sys/netinet/in_mcast.c#2 edit
.. //depot/projects/vimage-commit3/src/sys/netinet/in_pcb.c#2 edit
.. //depot/projects/vimage-commit3/src/sys/netinet/in_rmx.c#2 edit
.. //depot/projects/vimage-commit3/src/sys/netinet/ip_carp.c#2 edit
.. //depot/projects/vimage-commit3/src/sys/netinet/ip_fastfwd.c#2 edit
.. //depot/projects/vimage-commit3/src/sys/netinet/ip_fw2.c#2 edit
.. //depot/projects/vimage-commit3/src/sys/netinet/ip_fw_nat.c#2 edit
.. //depot/projects/vimage-commit3/src/sys/netinet/ip_icmp.c#2 edit
.. //depot/projects/vimage-commit3/src/sys/netinet/ip_input.c#2 edit
.. //depot/projects/vimage-commit3/src/sys/netinet/ip_ipsec.c#2 edit
.. //depot/projects/vimage-commit3/src/sys/netinet/ip_mroute.c#2 edit
.. //depot/projects/vimage-commit3/src/sys/netinet/ip_options.c#2 edit
.. //depot/projects/vimage-commit3/src/sys/netinet/ip_output.c#2 edit
.. //depot/projects/vimage-commit3/src/sys/netinet/raw_ip.c#2 edit
.. //depot/projects/vimage-commit3/src/sys/netinet/tcp_hostcache.c#2 edit
.. //depot/projects/vimage-commit3/src/sys/netinet/tcp_input.c#2 edit
.. //depot/projects/vimage-commit3/src/sys/netinet/tcp_output.c#2 edit
.. //depot/projects/vimage-commit3/src/sys/netinet/tcp_reass.c#2 edit
.. //depot/projects/vimage-commit3/src/sys/netinet/tcp_sack.c#2 edit
.. //depot/projects/vimage-commit3/src/sys/netinet/tcp_subr.c#2 edit
.. //depot/projects/vimage-commit3/src/sys/netinet/tcp_syncache.c#2 edit
.. //depot/projects/vimage-commit3/src/sys/netinet/tcp_timer.c#2 edit
.. //depot/projects/vimage-commit3/src/sys/netinet/tcp_timewait.c#2 edit
.. //depot/projects/vimage-commit3/src/sys/netinet/tcp_usrreq.c#2 edit
.. //depot/projects/vimage-commit3/src/sys/netinet/udp_usrreq.c#2 edit
.. //depot/projects/vimage-commit3/src/sys/netinet6/dest6.c#2 edit
.. //depot/projects/vimage-commit3/src/sys/netinet6/frag6.c#2 edit
.. //depot/projects/vimage-commit3/src/sys/netinet6/icmp6.c#2 edit
.. //depot/projects/vimage-commit3/src/sys/netinet6/in6.c#2 edit
.. //depot/projects/vimage-commit3/src/sys/netinet6/in6_gif.c#2 edit
.. //depot/projects/vimage-commit3/src/sys/netinet6/in6_ifattach.c#2 edit
.. //depot/projects/vimage-commit3/src/sys/netinet6/in6_pcb.c#2 edit
.. //depot/projects/vimage-commit3/src/sys/netinet6/in6_proto.c#2 edit
.. //depot/projects/vimage-commit3/src/sys/netinet6/in6_rmx.c#2 edit
.. //depot/projects/vimage-commit3/src/sys/netinet6/in6_src.c#2 edit
.. //depot/projects/vimage-commit3/src/sys/netinet6/ip6_forward.c#2 edit
.. //depot/projects/vimage-commit3/src/sys/netinet6/ip6_input.c#2 edit
.. //depot/projects/vimage-commit3/src/sys/netinet6/ip6_ipsec.c#2 edit
.. //depot/projects/vimage-commit3/src/sys/netinet6/ip6_mroute.c#2 edit
.. //depot/projects/vimage-commit3/src/sys/netinet6/ip6_output.c#2 edit
.. //depot/projects/vimage-commit3/src/sys/netinet6/mld6.c#2 edit
.. //depot/projects/vimage-commit3/src/sys/netinet6/nd6.c#2 edit
.. //depot/projects/vimage-commit3/src/sys/netinet6/nd6_nbr.c#2 edit
.. //depot/projects/vimage-commit3/src/sys/netinet6/nd6_rtr.c#2 edit
.. //depot/projects/vimage-commit3/src/sys/netinet6/raw_ip6.c#2 edit
.. //depot/projects/vimage-commit3/src/sys/netinet6/route6.c#2 edit
.. //depot/projects/vimage-commit3/src/sys/netinet6/scope6.c#3 edit
.. //depot/projects/vimage-commit3/src/sys/netinet6/udp6_usrreq.c#2 edit
.. //depot/projects/vimage-commit3/src/sys/netipsec/ipsec.c#2 edit
.. //depot/projects/vimage-commit3/src/sys/netipsec/ipsec_input.c#2 edit
.. //depot/projects/vimage-commit3/src/sys/netipsec/ipsec_mbuf.c#2 edit
.. //depot/projects/vimage-commit3/src/sys/netipsec/ipsec_output.c#2 edit
.. //depot/projects/vimage-commit3/src/sys/netipsec/key.c#2 edit
.. //depot/projects/vimage-commit3/src/sys/netipsec/keysock.c#3 edit
.. //depot/projects/vimage-commit3/src/sys/netipsec/xform_ah.c#2 edit
.. //depot/projects/vimage-commit3/src/sys/netipsec/xform_esp.c#2 edit
.. //depot/projects/vimage-commit3/src/sys/netipsec/xform_ipcomp.c#2 edit
.. //depot/projects/vimage-commit3/src/sys/netipsec/xform_ipip.c#2 edit
.. //depot/projects/vimage-commit3/src/sys/nfsclient/nfs_diskless.c#2 edit
.. //depot/projects/vimage-commit3/src/sys/nfsclient/nfs_vfsops.c#2 edit
.. //depot/projects/vimage-commit3/src/sys/nfsclient/nfs_vnops.c#2 edit
.. //depot/projects/vimage-commit3/src/sys/rpc/authunix_prot.c#2 edit

Differences ...

==== //depot/projects/vimage-commit3/src/sys/compat/linprocfs/linprocfs.c#2 (text+ko) ====

@@ -1002,6 +1002,7 @@
 static int
 linprocfs_donetdev(PFS_FILL_ARGS)
 {
+	INIT_VNET_NET(TD_TO_VNET(curthread));
 	char ifname[16]; /* XXX LINUX_IFNAMSIZ */
 	struct ifnet *ifp;
 

==== //depot/projects/vimage-commit3/src/sys/compat/linux/linux_ioctl.c#2 (text+ko) ====

@@ -2040,6 +2040,7 @@
 int
 linux_ifname(struct ifnet *ifp, char *buffer, size_t buflen)
 {
+	INIT_VNET_NET(ifp->if_vnet);
 	struct ifnet *ifscan;
 	int ethno;
 
@@ -2073,6 +2074,7 @@
 static struct ifnet *
 ifname_linux_to_bsd(const char *lxname, char *bsdname)
 {
+	INIT_VNET_NET(TD_TO_VNET(curthread));
 	struct ifnet *ifp;
 	int len, unit;
 	char *ep;
@@ -2113,6 +2115,7 @@
 static int
 linux_ifconf(struct thread *td, struct ifconf *uifc)
 {
+	INIT_VNET_NET(TD_TO_VNET(td));
 #ifdef COMPAT_LINUX32
 	struct l_ifconf ifc;
 #else

==== //depot/projects/vimage-commit3/src/sys/compat/linux/linux_misc.c#2 (text+ko) ====

@@ -712,6 +712,7 @@
 int
 linux_newuname(struct thread *td, struct linux_newuname_args *args)
 {
+	INIT_VPROCG(TD_TO_VPROCG(td));
 	struct l_new_utsname utsname;
 	char osname[LINUX_MAX_UTSNAME];
 	char osrelease[LINUX_MAX_UTSNAME];

==== //depot/projects/vimage-commit3/src/sys/ddb/db_textdump.c#2 (text+ko) ====

@@ -185,6 +185,7 @@
 mkdumpheader(struct kerneldumpheader *kdh, uint32_t archver,
     uint64_t dumplen, uint32_t blksz)
 {
+	INIT_VPROCG(TD_TO_VPROCG(&thread0));
 
 	bzero(kdh, sizeof(*kdh));
 	strncpy(kdh->magic, TEXTDUMPMAGIC, sizeof(kdh->magic));

==== //depot/projects/vimage-commit3/src/sys/dev/firewire/firewire.c#2 (text+ko) ====

@@ -680,6 +680,7 @@
 static void
 fw_reset_crom(struct firewire_comm *fc)
 {
+	INIT_VPROCG(TD_TO_VPROCG(curthread)); /* XXX */
 	struct crom_src_buf *buf;
 	struct crom_src *src;
 	struct crom_chunk *root;

==== //depot/projects/vimage-commit3/src/sys/fs/cd9660/cd9660_rrip.c#2 (text+ko) ====

@@ -116,6 +116,7 @@
 	ISO_RRIP_SLINK	*p;
 	ISO_RRIP_ANALYZE *ana;
 {
+	INIT_VPROCG(TD_TO_VPROCG(curthread));
 	ISO_RRIP_SLINK_COMPONENT *pcomp;
 	ISO_RRIP_SLINK_COMPONENT *pcompe;
 	int len, wlen, cont;
@@ -225,6 +226,7 @@
 	ISO_RRIP_ALTNAME *p;
 	ISO_RRIP_ANALYZE *ana;
 {
+	INIT_VPROCG(TD_TO_VPROCG(curthread));
 	char *inbuf;
 	int wlen;
 	int cont;

==== //depot/projects/vimage-commit3/src/sys/kern/kern_jail.c#2 (text+ko) ====

@@ -467,6 +467,7 @@
 void
 getcredhostname(struct ucred *cred, char *buf, size_t size)
 {
+	INIT_VPROCG(cred->cr_vimage->v_procg);
 
 	if (jailed(cred)) {
 		mtx_lock(&cred->cr_prison->pr_mtx);

==== //depot/projects/vimage-commit3/src/sys/kern/kern_mib.c#2 (text+ko) ====

@@ -213,6 +213,7 @@
 static int
 sysctl_hostname(SYSCTL_HANDLER_ARGS)
 {
+	INIT_VPROCG(TD_TO_VPROCG(req->td));
 	struct prison *pr;
 	char tmphostname[MAXHOSTNAMELEN];
 	int error;

==== //depot/projects/vimage-commit3/src/sys/kern/kern_uuid.c#2 (text+ko) ====

@@ -90,6 +90,7 @@
 static void
 uuid_node(uint16_t *node)
 {
+	INIT_VNET_NET(curvnet);
 	struct ifnet *ifp;
 	struct ifaddr *ifa;
 	struct sockaddr_dl *sdl;

==== //depot/projects/vimage-commit3/src/sys/kern/kern_xxx.c#2 (text+ko) ====

@@ -247,6 +247,7 @@
         struct thread *td;
         struct getdomainname_args *uap;
 {
+	INIT_VPROCG(TD_TO_VPROCG(td));
 	int domainnamelen;
 	int error;
 
@@ -271,6 +272,7 @@
         struct thread *td;
         struct setdomainname_args *uap;
 {
+	INIT_VPROCG(TD_TO_VPROCG(td));
         int error, domainnamelen;
 
 	error = priv_check(td, PRIV_SETDOMAINNAME);

==== //depot/projects/vimage-commit3/src/sys/net/if.c#2 (text+ko) ====

@@ -58,6 +58,7 @@
 #include <sys/domain.h>
 #include <sys/jail.h>
 #include <sys/vimage.h>
+
 #include <machine/stdarg.h>
 
 #include <net/if.h>
@@ -225,6 +226,7 @@
 static int
 netkqfilter(struct cdev *dev, struct knote *kn)
 {
+	INIT_VNET_NET(curvnet);
 	struct knlist *klist;
 	struct ifnet *ifp;
 	int idx;
@@ -329,6 +331,7 @@
 struct ifnet*
 if_alloc(u_char type)
 {
+	INIT_VNET_NET(curvnet);
 	struct ifnet *ifp;
 
 	ifp = malloc(sizeof(struct ifnet), M_IFNET, M_WAITOK|M_ZERO);
@@ -389,6 +392,7 @@
 void
 if_free_type(struct ifnet *ifp, u_char type)
 {
+	INIT_VNET_NET(curvnet); /* ifp->if_vnet can be NULL here ! */
 
 	if (ifp != ifnet_byindex(ifp->if_index)) {
 		if_printf(ifp, "%s: value was not if_alloced, skipping\n",
@@ -425,6 +429,7 @@
 void
 if_attach(struct ifnet *ifp)
 {
+	INIT_VNET_NET(curvnet);
 	unsigned socksize, ifasize;
 	int namelen, masklen;
 	struct sockaddr_dl *sdl;
@@ -539,6 +544,7 @@
 static void
 if_attachdomain(void *dummy)
 {
+	INIT_VNET_NET(curvnet);
 	struct ifnet *ifp;
 	int s;
 
@@ -649,6 +655,7 @@
 void
 if_detach(struct ifnet *ifp)
 {
+	INIT_VNET_NET(ifp->if_vnet);
 	struct ifaddr *ifa;
 	struct radix_node_head	*rnh;
 	int s;
@@ -764,6 +771,7 @@
 int
 if_addgroup(struct ifnet *ifp, const char *groupname)
 {
+	INIT_VNET_NET(ifp->if_vnet);
 	struct ifg_list		*ifgl;
 	struct ifg_group	*ifg = NULL;
 	struct ifg_member	*ifgm;
@@ -833,6 +841,7 @@
 int
 if_delgroup(struct ifnet *ifp, const char *groupname)
 {
+	INIT_VNET_NET(ifp->if_vnet);
 	struct ifg_list		*ifgl;
 	struct ifg_member	*ifgm;
 
@@ -922,6 +931,7 @@
 static int
 if_getgroupmembers(struct ifgroupreq *data)
 {
+	INIT_VNET_NET(curvnet);
 	struct ifgroupreq	*ifgr = data;
 	struct ifg_group	*ifg;
 	struct ifg_member	*ifgm;
@@ -1031,6 +1041,7 @@
 struct ifaddr *
 ifa_ifwithaddr(struct sockaddr *addr)
 {
+	INIT_VNET_NET(curvnet);
 	struct ifnet *ifp;
 	struct ifaddr *ifa;
 
@@ -1061,6 +1072,7 @@
 struct ifaddr *
 ifa_ifwithbroadaddr(struct sockaddr *addr)
 {
+	INIT_VNET_NET(curvnet);
 	struct ifnet *ifp;
 	struct ifaddr *ifa;
 
@@ -1088,6 +1100,7 @@
 struct ifaddr *
 ifa_ifwithdstaddr(struct sockaddr *addr)
 {
+	INIT_VNET_NET(curvnet);
 	struct ifnet *ifp;
 	struct ifaddr *ifa;
 
@@ -1116,6 +1129,7 @@
 struct ifaddr *
 ifa_ifwithnet(struct sockaddr *addr)
 {
+	INIT_VNET_NET(curvnet);
 	struct ifnet *ifp;
 	struct ifaddr *ifa;
 	struct ifaddr *ifa_maybe = (struct ifaddr *) 0;
@@ -1359,6 +1373,7 @@
 	struct ifnet *ifp = (struct ifnet *)arg;
 	int link_state = ifp->if_link_state;
 	int link;
+	CURVNET_SET(ifp->if_vnet);
 
 	/* Notify that the link state has changed. */
 	rt_ifmsg(ifp);
@@ -1395,6 +1410,7 @@
 	if (log_link_state_change)
 		log(LOG_NOTICE, "%s: link state changed to %s\n", ifp->if_xname,
 		    (link_state == LINK_STATE_UP) ? "UP" : "DOWN" );
+	CURVNET_RESTORE();
 }
 
 /*
@@ -1461,12 +1477,15 @@
 	int s = splimp();
 
 	IFNET_RLOCK();
+	VNET_ITERLOOP_BEGIN();
+	INIT_VNET_NET(curvnet);
 	TAILQ_FOREACH(ifp, &V_ifnet, if_link) {
 		if (ifp->if_timer == 0 || --ifp->if_timer)
 			continue;
 		if (ifp->if_watchdog)
 			(*ifp->if_watchdog)(ifp);
 	}
+	VNET_ITERLOOP_END();
 	IFNET_RUNLOCK();
 	splx(s);
 	timeout(if_slowtimo, (void *)0, hz / IFNET_SLOWHZ);
@@ -1479,6 +1498,7 @@
 struct ifnet *
 ifunit(const char *name)
 {
+	INIT_VNET_NET(curvnet);
 	struct ifnet *ifp;
 
 	IFNET_RLOCK();
@@ -2051,6 +2071,7 @@
 static int
 ifconf(u_long cmd, caddr_t data)
 {
+	INIT_VNET_NET(curvnet);
 	struct ifconf *ifc = (struct ifconf *)data;
 #ifdef __amd64__
 	struct ifconf32 *ifc32 = (struct ifconf32 *)data;
@@ -2410,6 +2431,7 @@
 	int lastref;
 #ifdef INVARIANTS
 	struct ifnet *oifp;
+	INIT_VNET_NET(ifp->if_vnet);
 
 	IFNET_RLOCK();
 	TAILQ_FOREACH(oifp, &V_ifnet, if_link)

==== //depot/projects/vimage-commit3/src/sys/net/if_ethersubr.c#2 (text+ko) ====

@@ -389,6 +389,7 @@
 {
 	int error;
 #if defined(INET) || defined(INET6)
+	INIT_VNET_NET(ifp->if_vnet);
 	struct ip_fw *rule = ip_dn_claim_rule(m);
 
 	if (IPFW_LOADED && V_ether_ipfw != 0) {
@@ -420,6 +421,7 @@
 ether_ipfw_chk(struct mbuf **m0, struct ifnet *dst,
 	struct ip_fw **rule, int shared)
 {
+	INIT_VNET_IPFW(dst->if_vnet);
 	struct ether_header *eh;
 	struct ether_header save_eh;
 	struct mbuf *m;
@@ -712,6 +714,7 @@
 	KASSERT(ifp != NULL, ("%s: NULL interface pointer", __func__));
 
 #if defined(INET) || defined(INET6)
+	INIT_VNET_NET(ifp->if_vnet);
 	/*
 	 * Allow dummynet and/or ipfw to claim the frame.
 	 * Do not do this for PROMISC frames in case we are re-entered.

==== //depot/projects/vimage-commit3/src/sys/net/if_faith.c#2 (text+ko) ====

@@ -325,6 +325,7 @@
 faithprefix(in6)
 	struct in6_addr *in6;
 {
+	INIT_VNET_INET6(curvnet);
 	struct rtentry *rt;
 	struct sockaddr_in6 sin6;
 	int ret;

==== //depot/projects/vimage-commit3/src/sys/net/if_gif.c#2 (text+ko) ====

@@ -155,6 +155,7 @@
 	int unit;
 	caddr_t params;
 {
+	INIT_VNET_GIF(curvnet);
 	struct gif_softc *sc;
 
 	sc = malloc(sizeof(struct gif_softc), M_GIF, M_WAITOK | M_ZERO);
@@ -365,6 +366,7 @@
 	struct sockaddr *dst;
 	struct rtentry *rt;	/* added in net2 */
 {
+	INIT_VNET_GIF(ifp->if_vnet);
 	struct gif_softc *sc = ifp->if_softc;
 	struct m_tag *mtag;
 	int error = 0;
@@ -855,6 +857,7 @@
 	struct sockaddr *src;
 	struct sockaddr *dst;
 {
+	INIT_VNET_GIF(ifp->if_vnet);
 	struct gif_softc *sc = ifp->if_softc;
 	struct gif_softc *sc2;
 	struct sockaddr *osrc, *odst, *sa;

==== //depot/projects/vimage-commit3/src/sys/net/if_gre.c#2 (text+ko) ====

@@ -242,12 +242,15 @@
 gre_output(struct ifnet *ifp, struct mbuf *m, struct sockaddr *dst,
 	   struct rtentry *rt)
 {
+#ifdef INET6
+	INIT_VNET_INET(ifp->if_vnet);
+#endif
 	int error = 0;
 	struct gre_softc *sc = ifp->if_softc;
 	struct greip *gh;
 	struct ip *ip;
-	u_short ip_id = 0;
-	uint8_t ip_tos = 0;
+	u_short gre_ip_id = 0;
+	uint8_t gre_ip_tos = 0;
 	u_int16_t etype = 0;
 	struct mobile_h mob_h;
 	u_int32_t af;
@@ -364,13 +367,13 @@
 		switch (dst->sa_family) {
 		case AF_INET:
 			ip = mtod(m, struct ip *);
-			ip_tos = ip->ip_tos;
-			ip_id = ip->ip_id;
+			gre_ip_tos = ip->ip_tos;
+			gre_ip_id = ip->ip_id;
 			etype = ETHERTYPE_IP;
 			break;
 #ifdef INET6
 		case AF_INET6:
-			ip_id = ip_newid();
+			gre_ip_id = ip_newid();
 			etype = ETHERTYPE_IPV6;
 			break;
 #endif
@@ -415,8 +418,8 @@
 		((struct ip*)gh)->ip_v = IPPROTO_IPV4;
 		((struct ip*)gh)->ip_hl = (sizeof(struct ip)) >> 2;
 		((struct ip*)gh)->ip_ttl = GRE_TTL;
-		((struct ip*)gh)->ip_tos = ip_tos;
-		((struct ip*)gh)->ip_id = ip_id;
+		((struct ip*)gh)->ip_tos = gre_ip_tos;
+		((struct ip*)gh)->ip_id = gre_ip_id;
 		gh->gi_len = m->m_pkthdr.len;
 	}
 

==== //depot/projects/vimage-commit3/src/sys/net/if_loop.c#2 (text+ko) ====

@@ -129,6 +129,7 @@
 static int
 lo_clone_create(struct if_clone *ifc, int unit, caddr_t params)
 {
+	INIT_VNET_NET(curvnet);
 	struct ifnet *ifp;
 	struct lo_softc *sc;
 
@@ -233,6 +234,7 @@
 int
 if_simloop(struct ifnet *ifp, struct mbuf *m, int af, int hlen)
 {
+	INIT_VNET_NET(ifp->if_vnet);
 	int isr;
 
 	M_ASSERTPKTHDR(m);

==== //depot/projects/vimage-commit3/src/sys/net/if_mib.c#2 (text+ko) ====

@@ -73,6 +73,7 @@
 static int
 sysctl_ifdata(SYSCTL_HANDLER_ARGS) /* XXX bad syntax! */
 {
+	INIT_VNET_NET(curvnet);
 	int *name = (int *)arg1;
 	int error;
 	u_int namelen = arg2;

==== //depot/projects/vimage-commit3/src/sys/net/if_stf.c#2 (text+ko) ====

@@ -366,6 +366,7 @@
 stf_getsrcifa6(ifp)
 	struct ifnet *ifp;
 {
+	INIT_VNET_INET(ifp->if_vnet);
 	struct ifaddr *ia;
 	struct in_ifaddr *ia4;
 	struct sockaddr_in6 *sin6;
@@ -561,6 +562,7 @@
 	struct in_addr *in;
 	struct ifnet *inifp;	/* incoming interface */
 {
+	INIT_VNET_INET(curvnet);
 	struct in_ifaddr *ia4;
 
 	/*

==== //depot/projects/vimage-commit3/src/sys/net/if_vlan.c#2 (text+ko) ====

@@ -574,6 +574,7 @@
 static struct ifnet *
 vlan_clone_match_ethertag(struct if_clone *ifc, const char *name, int *tag)
 {
+	INIT_VNET_NET(curvnet);
 	const char *cp;
 	struct ifnet *ifp;
 	int t = 0;

==== //depot/projects/vimage-commit3/src/sys/net/raw_cb.c#3 (text+ko) ====

@@ -70,6 +70,7 @@
 	register struct socket *so;
 	int proto;
 {
+	INIT_VNET_NET(so->so_vnet);
 	register struct rawcb *rp = sotorawcb(so);
 	int error;
 

==== //depot/projects/vimage-commit3/src/sys/net/raw_usrreq.c#3 (text+ko) ====

@@ -58,6 +58,7 @@
 void
 raw_init()
 {
+	INIT_VNET_NET(curvnet);
 
 	LIST_INIT(&V_rawcb_list);
 }
@@ -77,6 +78,7 @@
 	register struct sockproto *proto;
 	struct sockaddr *src, *dst;
 {
+	INIT_VNET_NET(curvnet);
 	register struct rawcb *rp;
 	register struct mbuf *m = m0;
 	struct socket *last;

==== //depot/projects/vimage-commit3/src/sys/net/route.c#2 (text+ko) ====

@@ -263,6 +263,7 @@
 		    u_int fibnum)
 {
 	struct radix_node_head *rnh;
+	INIT_VNET_NET(curvnet);
 	struct rtentry *rt;
 	struct radix_node *rn;
 	struct rtentry *newrt;
@@ -367,6 +368,7 @@
 void
 rtfree(struct rtentry *rt)
 {
+	INIT_VNET_NET(curvnet);
 	struct radix_node_head *rnh;
 
 	KASSERT(rt != NULL,("%s: NULL rt", __func__));
@@ -467,6 +469,7 @@
 	struct sockaddr *src,
 	u_int fibnum)
 {
+	INIT_VNET_NET(curvnet);
 	struct rtentry *rt, *rt0 = NULL;
 	int error = 0;
 	short *stat = NULL;
@@ -773,6 +776,7 @@
 int
 rtexpunge(struct rtentry *rt)
 {
+	INIT_VNET_NET(curvnet);
 	struct radix_node *rn;
 	struct radix_node_head *rnh;
 	struct ifaddr *ifa;
@@ -864,6 +868,7 @@
 rtrequest1_fib(int req, struct rt_addrinfo *info, struct rtentry **ret_nrt,
 				u_int fibnum)
 {
+	INIT_VNET_NET(curvnet);
 	int error = 0;
 	register struct rtentry *rt;
 	register struct radix_node *rn;
@@ -1294,6 +1299,7 @@
 int
 rt_setgate(struct rtentry *rt, struct sockaddr *dst, struct sockaddr *gate)
 {
+	INIT_VNET_NET(curvnet);
 	/* XXX dst may be overwritten, can we move this to below */
 	struct radix_node_head *rnh = V_rt_tables[rt->rt_fibnum][dst->sa_family];
 	int dlen = SA_SIZE(dst), glen = SA_SIZE(gate);
@@ -1435,6 +1441,7 @@
 static inline  int
 rtinit1(struct ifaddr *ifa, int cmd, int flags, int fibnum)
 {
+	INIT_VNET_NET(curvnet);
 	struct sockaddr *dst;
 	struct sockaddr *netmask;
 	struct rtentry *rt = NULL;

==== //depot/projects/vimage-commit3/src/sys/net/rtsock.c#2 (text+ko) ====

@@ -318,6 +318,7 @@
 route_output(struct mbuf *m, struct socket *so)
 {
 #define	sa_equal(a1, a2) (bcmp((a1), (a2), (a1)->sa_len) == 0)
+	INIT_VNET_NET(so->so_vnet);
 	struct rt_msghdr *rtm = NULL;
 	struct rtentry *rt = NULL;
 	struct radix_node_head *rnh;
@@ -1079,6 +1080,7 @@
 static void
 rt_dispatch(struct mbuf *m, const struct sockaddr *sa)
 {
+	INIT_VNET_NET(curvnet);
 	struct m_tag *tag;
 
 	/*
@@ -1142,6 +1144,7 @@
 static int
 sysctl_iflist(int af, struct walkarg *w)
 {
+	INIT_VNET_NET(curvnet);
 	struct ifnet *ifp;
 	struct ifaddr *ifa;
 	struct rt_addrinfo info;
@@ -1202,6 +1205,7 @@
 int
 sysctl_ifmalist(int af, struct walkarg *w)
 {
+	INIT_VNET_NET(curvnet);
 	struct ifnet *ifp;
 	struct ifmultiaddr *ifma;
 	struct	rt_addrinfo info;
@@ -1251,6 +1255,7 @@
 static int
 sysctl_rtsock(SYSCTL_HANDLER_ARGS)
 {
+	INIT_VNET_NET(curvnet);
 	int	*name = (int *)arg1;
 	u_int	namelen = arg2;
 	struct radix_node_head *rnh;

==== //depot/projects/vimage-commit3/src/sys/net80211/ieee80211.c#2 (text+ko) ====

@@ -217,6 +217,7 @@
 void
 ieee80211_ifattach(struct ieee80211com *ic)
 {
+	INIT_VNET_NET(curvnet);
 	struct ifnet *ifp = ic->ic_ifp;
 	struct sockaddr_dl *sdl;
 	struct ifaddr *ifa;

==== //depot/projects/vimage-commit3/src/sys/netgraph/ng_base.c#2 (text+ko) ====

@@ -614,6 +614,7 @@
 int
 ng_make_node_common(struct ng_type *type, node_p *nodepp)
 {
+	INIT_VNET_NETGRAPH(curvnet);
 	node_p node;
 
 	/* Require the node type to have been already installed */
@@ -648,7 +649,7 @@
 	mtx_lock(&ng_idhash_mtx);
 	for (;;) { /* wrap protection, even if silly */
 		node_p node2 = NULL;
-		node->nd_ID = V_nextID++; /* 137/second for 1 year before wrap */
+		node->nd_ID = V_nextID++; /* 137/sec for 1 year before wrap */
 
 		/* Is there a problem with the new number? */
 		NG_IDHASH_FIND(node->nd_ID, node2); /* already taken? */
@@ -795,6 +796,7 @@
 static node_p
 ng_ID2noderef(ng_ID_t ID)
 {
+	INIT_VNET_NETGRAPH(curvnet);
 	node_p node;
 	mtx_lock(&ng_idhash_mtx);
 	NG_IDHASH_FIND(ID, node);
@@ -820,6 +822,7 @@
 int
 ng_name_node(node_p node, const char *name)
 {
+	INIT_VNET_NETGRAPH(curvnet);
 	int i, hash;
 	node_p node2;
 
@@ -870,6 +873,7 @@
 node_p
 ng_name2noderef(node_p here, const char *name)
 {
+	INIT_VNET_NETGRAPH(curvnet);
 	node_p node;
 	ng_ID_t temp;
 	int	hash;
@@ -2418,6 +2422,7 @@
 static int
 ng_generic_msg(node_p here, item_p item, hook_p lasthook)
 {
+	INIT_VNET_NETGRAPH(curvnet);
 	int error = 0;
 	struct ng_mesg *msg;
 	struct ng_mesg *resp = NULL;

==== //depot/projects/vimage-commit3/src/sys/netgraph/ng_eiface.c#2 (text+ko) ====

@@ -335,6 +335,7 @@
 static int
 ng_eiface_constructor(node_p node)
 {
+	INIT_VNET_NETGRAPH(curvnet);
 	struct ifnet *ifp;
 	priv_p priv;
 	u_char eaddr[6] = {0,0,0,0,0,0};
@@ -547,11 +548,14 @@
 static int
 ng_eiface_rmnode(node_p node)
 {
+	INIT_VNET_NETGRAPH(curvnet);
 	const priv_p priv = NG_NODE_PRIVATE(node);
 	struct ifnet *const ifp = priv->ifp;
 
+	CURVNET_SET_QUIET(ifp->if_vnet);
 	ether_ifdetach(ifp);
 	if_free(ifp);
+	CURVNET_RESTORE();
 	free_unr(V_ng_eiface_unit, priv->unit);
 	FREE(priv, M_NETGRAPH);
 	NG_NODE_SET_PRIVATE(node, NULL);

==== //depot/projects/vimage-commit3/src/sys/netgraph/ng_iface.c#2 (text+ko) ====

@@ -507,6 +507,7 @@
 static int
 ng_iface_constructor(node_p node)
 {
+	INIT_VNET_NETGRAPH(curvnet);
 	struct ifnet *ifp;
 	priv_p priv;
 
@@ -767,11 +768,14 @@
 static int
 ng_iface_shutdown(node_p node)
 {
+	INIT_VNET_NETGRAPH(curvnet);
 	const priv_p priv = NG_NODE_PRIVATE(node);
 
+	CURVNET_SET_QUIET(priv->ifp->if_vnet);
 	bpfdetach(priv->ifp);
 	if_detach(priv->ifp);
 	if_free(priv->ifp);
+	CURVNET_RESTORE();
 	priv->ifp = NULL;
 	free_unr(V_ng_iface_unit, priv->unit);
 	FREE(priv, M_NETGRAPH_IFACE);

==== //depot/projects/vimage-commit3/src/sys/netinet/if_ether.c#2 (text+ko) ====

@@ -150,6 +150,8 @@
 static void
 arp_rtrequest(int req, struct rtentry *rt, struct rt_addrinfo *info)
 {
+	INIT_VNET_NET(curvnet);
+	INIT_VNET_INET(curvnet);
 	struct sockaddr *gate;
 	struct llinfo_arp *la;
 	static struct sockaddr_dl null_sdl = {sizeof(null_sdl), AF_LINK};
@@ -361,6 +363,7 @@
 arpresolve(struct ifnet *ifp, struct rtentry *rt0, struct mbuf *m,
     struct sockaddr *dst, u_char *desten)
 {
+	INIT_VNET_INET(ifp->if_vnet);
 	struct llinfo_arp *la = NULL;
 	struct rtentry *rt = NULL;
 	struct sockaddr_dl *sdl;
@@ -604,7 +607,8 @@
 	sin.sin_len = sizeof(struct sockaddr_in);
 	sin.sin_family = AF_INET;
 	sin.sin_addr.s_addr = 0;
-	
+	INIT_VNET_INET(ifp->if_vnet);
+
 	if (ifp->if_bridge)
 		bridged = 1;
 

==== //depot/projects/vimage-commit3/src/sys/netinet/igmp.c#2 (text+ko) ====

@@ -146,6 +146,7 @@
 static struct router_info *
 find_rti(struct ifnet *ifp)
 {
+	INIT_VNET_INET(ifp->if_vnet);
 	struct router_info *rti;
 
 	mtx_assert(&igmp_mtx, MA_OWNED);
@@ -184,6 +185,7 @@
 	struct in_multistep step;
 	struct router_info *rti;
 	int timer; /** timer value in the igmp query header **/
+	INIT_VNET_INET(ifp->if_vnet);
 
 	++V_igmpstat.igps_rcv_total;
 
@@ -446,6 +448,7 @@
 
 	IGMP_PRINTF("[igmp.c,_slowtimo] -- > entering \n");
 	mtx_lock(&igmp_mtx);
+	INIT_VNET_INET(vnet_iter);
 	SLIST_FOREACH(rti, &V_router_info_head, rti_list) {
 		if (rti->rti_type == IGMP_V1_ROUTER) {
 			rti->rti_time++;
@@ -460,6 +463,8 @@
 static void
 igmp_sendpkt(struct in_multi *inm, int type, unsigned long addr)
 {
+	INIT_VNET_NET(curvnet);
+	INIT_VNET_INET(curvnet);
 	struct mbuf *m;
 	struct igmp *igmp;
 	struct ip *ip;

==== //depot/projects/vimage-commit3/src/sys/netinet/in.c#2 (text+ko) ====

@@ -87,6 +87,7 @@
 int
 in_localaddr(struct in_addr in)
 {
+	INIT_VNET_INET(curvnet);
 	register u_long i = ntohl(in.s_addr);
 	register struct in_ifaddr *ia;
 
@@ -109,6 +110,7 @@
 int
 in_localip(struct in_addr in)
 {
+	INIT_VNET_INET(curvnet);
 	struct in_ifaddr *ia;
 
 	LIST_FOREACH(ia, INADDR_HASH(in.s_addr), ia_hash) {
@@ -201,6 +203,7 @@
 in_control(struct socket *so, u_long cmd, caddr_t data, struct ifnet *ifp,
     struct thread *td)
 {
+	INIT_VNET_INET(curvnet);	/* so and ifp can be 0 ! */
 	register struct ifreq *ifr = (struct ifreq *)data;
 	register struct in_ifaddr *ia = 0, *iap;
 	register struct ifaddr *ifa;
@@ -709,6 +712,7 @@
 in_ifinit(struct ifnet *ifp, struct in_ifaddr *ia, struct sockaddr_in *sin,
     int scrub)
 {
+	INIT_VNET_INET(ifp->if_vnet);
 	register u_long i = ntohl(sin->sin_addr.s_addr);
 	struct sockaddr_in oldaddr;
 	int s = splimp(), flags = RTF_UP, error = 0;
@@ -803,6 +807,7 @@
 static int
 in_addprefix(struct in_ifaddr *target, int flags)
 {
+	INIT_VNET_INET(curvnet);
 	struct in_ifaddr *ia;
 	struct in_addr prefix, mask, p, m;
 	int error;
@@ -863,6 +868,7 @@
 static int
 in_scrubprefix(struct in_ifaddr *target)
 {
+	INIT_VNET_INET(curvnet);
 	struct in_ifaddr *ia;
 	struct in_addr prefix, mask, p;
 	int error;
@@ -969,6 +975,8 @@
 static void
 in_purgemaddrs(struct ifnet *ifp)
 {
+	INIT_VNET_INET(ifp->if_vnet);
+
 	struct in_multi *inm;
 	struct in_multi *oinm;
 
@@ -991,6 +999,7 @@
 void
 in_ifdetach(struct ifnet *ifp)
 {
+	INIT_VNET_INET(ifp->if_vnet);
 
 	in_pcbpurgeif0(&V_ripcbinfo, ifp);
 	in_pcbpurgeif0(&V_udbinfo, ifp);

==== //depot/projects/vimage-commit3/src/sys/netinet/in_gif.c#2 (text+ko) ====

@@ -94,6 +94,7 @@
 int
 in_gif_output(struct ifnet *ifp, int family, struct mbuf *m)
 {
+	INIT_VNET_GIF(ifp->if_vnet);
 	struct gif_softc *sc = ifp->if_softc;
 	struct sockaddr_in *dst = (struct sockaddr_in *)&sc->gif_ro.ro_dst;
 	struct sockaddr_in *sin_src = (struct sockaddr_in *)sc->gif_psrc;
@@ -243,6 +244,7 @@
 void
 in_gif_input(struct mbuf *m, int off)
 {
+	INIT_VNET_INET(curvnet);
 	struct ifnet *gifp = NULL;
 	struct gif_softc *sc;
 	struct ip *ip;
@@ -337,6 +339,7 @@
 static int
 gif_validate4(const struct ip *ip, struct gif_softc *sc, struct ifnet *ifp)
 {
+	INIT_VNET_INET(curvnet);
 	struct sockaddr_in *src, *dst;
 	struct in_ifaddr *ia4;
 

==== //depot/projects/vimage-commit3/src/sys/netinet/in_mcast.c#2 (text+ko) ====


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


More information about the p4-projects mailing list