PERFORCE change 144126 for review

Julian Elischer julian at FreeBSD.org
Thu Jun 26 08:01:40 UTC 2008


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

Change 144126 by julian at julian_trafmon1 on 2008/06/26 08:01:34

	distribute teh variabels around a bit

Affected files ...

.. //depot/projects/vimage-commit3/src/sys/net/if.h#2 edit
.. //depot/projects/vimage-commit3/src/sys/net/if_gif.h#2 edit
.. //depot/projects/vimage-commit3/src/sys/net/raw_cb.c#2 edit
.. //depot/projects/vimage-commit3/src/sys/net/raw_usrreq.c#2 edit
.. //depot/projects/vimage-commit3/src/sys/netinet/in.h#2 edit
.. //depot/projects/vimage-commit3/src/sys/netinet/ip6.h#2 edit
.. //depot/projects/vimage-commit3/src/sys/netinet/ip_fw.h#2 edit
.. //depot/projects/vimage-commit3/src/sys/netinet6/scope6.c#2 edit
.. //depot/projects/vimage-commit3/src/sys/sys/vimage.h#2 integrate

Differences ...

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

@@ -457,4 +457,22 @@
 #include <net/if_var.h>
 #endif
 
+#define INIT_VNET_NET(_xXX) int vnet_net ;
+
+#define VNET_NET(sym)   VSYM(vnet_net, sym)
+
+#define V_if_index      VNET_NET(if_index)
+#define V_ifindex_table VNET_NET(ifindex_table)
+#define V_ifnet         VNET_NET(ifnet)
+#define V_ifg_head      VNET_NET(ifg_head)
+#define V_if_indexlim   VNET_NET(if_indexlim)
+#define V_ifklist       VNET_NET(ifklist)
+#define V_rtstat        VNET_NET(rtstat)
+#define V_rt_tables     VNET_NET(rt_tables)
+#define V_rttrash       VNET_NET(rttrash)
+#define V_loif          VNET_NET(loif)
+#define V_lo_list       VNET_NET(lo_list)
+#define V_rawcb_list    VNET_NET(rawcb_list)
+#define V_ether_ipfw    VNET_NET(ether_ipfw)
+ 
 #endif /* !_NET_IF_H_ */

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

@@ -110,6 +110,28 @@
 void gif_delete_tunnel(struct ifnet *);
 int gif_encapcheck(const struct mbuf *, int, int, void *);
 
+/*
+ * Virtualization support
+ */
+
+#define INIT_VNET_GIF(vnet) int vnet_gif;
+
+#define VNET_GIF(sym)		VSYM(vnet_gif, sym)
+
+struct vnet_gif {
+	LIST_HEAD(, gif_softc) _gif_softc_list;
+	int	_max_gif_nesting;
+	int	_parallel_tunnels;
+	int	_ip_gif_ttl;
+	int	_ip6_gif_hlim;
+};
+
+#define V_gif_softc_list	VNET_GIF(gif_softc_list)
+#define V_max_gif_nesting	VNET_GIF(max_gif_nesting)
+#define V_parallel_tunnels	VNET_GIF(parallel_tunnels)
+#define V_ip_gif_ttl		VNET_GIF(ip_gif_ttl)
+#define V_ip6_gif_hlim		VNET_GIF(ip6_gif_hlim)
+
 #endif /* _KERNEL */
 
 #endif /* _NET_IF_GIF_H_ */

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

@@ -43,6 +43,7 @@
 #include <sys/systm.h>
 #include <sys/vimage.h>
 
+#include <net/if.h>
 #include <net/raw_cb.h>
 
 /*

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

@@ -47,6 +47,7 @@
 #include <sys/systm.h>
 #include <sys/vimage.h>
 
+#include <net/if.h>
 #include <net/raw_cb.h>
 
 MTX_SYSINIT(rawcb_mtx, &rawcb_mtx, "rawcb", MTX_DEF);

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

@@ -743,4 +743,133 @@
 #undef __KAME_NETINET_IN_H_INCLUDED_
 #endif
 
+
+#define INIT_VNET_INET(vnet) int  vnet_inet;
+
+#define VNET_INET(sym)	VSYM(vnet_inet, sym)
+
+#define V_in_ifaddrhead		VNET_INET(in_ifaddrhead)
+#define V_in_ifaddrhashtbl	VNET_INET(in_ifaddrhashtbl)
+#define V_in_ifaddrhmask	VNET_INET(in_ifaddrhmask)
+#define V_in_multihead		VNET_INET(in_multihead)
+
+#define V_llinfo_arp		VNET_INET(llinfo_arp)
+#define V_arpt_prune		VNET_INET(arpt_prune)
+#define V_arpt_keep		VNET_INET(arpt_keep)
+#define V_arp_maxtries		VNET_INET(arp_maxtries)
+#define V_useloopback		VNET_INET(useloopback)
+#define V_arp_proxyall		VNET_INET(arp_proxyall)
+#define V_subnetsarelocal	VNET_INET(subnetsarelocal)
+#define V_sameprefixcarponly	VNET_INET(sameprefixcarponly)
+
+#define V_ipforwarding		VNET_INET(ipforwarding)
+#define V_ipfastforward_active	VNET_INET(ipfastforward_active)
+#define V_ipsendredirects	VNET_INET(ipsendredirects)
+#define V_ip_defttl		VNET_INET(ip_defttl)
+#define V_ip_keepfaith		VNET_INET(ip_keepfaith)
+#define V_ip_sendsourcequench	VNET_INET(ip_sendsourcequench)
+#define V_ip_id			VNET_INET(ip_id)
+#define V_ip_do_randomid	VNET_INET(ip_do_randomid)
+#define V_ip_checkinterface	VNET_INET(ip_checkinterface)
+
+#define V_ipq			VNET_INET(ipq)
+#define V_ipq_zone		VNET_INET(ipq_zone)
+#define V_nipq			VNET_INET(nipq)
+#define V_maxnipq		VNET_INET(maxnipq)
+#define V_maxfragsperpacket	VNET_INET(maxfragsperpacket)
+
+#define V_tcb			VNET_INET(tcb)
+#define V_tcbinfo		VNET_INET(tcbinfo)
+#define V_tcpstat		VNET_INET(tcpstat)
+#define V_twq_2msl		VNET_INET(twq_2msl)
+#define V_tcp_hostcache		VNET_INET(tcp_hostcache)
+#define V_tcp_hc_callout	VNET_INET(tcp_hc_callout)
+#define V_tcp_syncache		VNET_INET(tcp_syncache)
+#define V_tcp_sc_rst_sock_fail	VNET_INET(tcp_sc_rst_sock_fail)
+
+#define V_tcp_mssdflt		VNET_INET(tcp_mssdflt)
+#define V_tcp_v6mssdflt		VNET_INET(tcp_v6mssdflt)
+#define V_tcp_minmss		VNET_INET(tcp_minmss)
+#define V_tcp_do_rfc1323	VNET_INET(tcp_do_rfc1323)
+#define V_icmp_may_rst		VNET_INET(icmp_may_rst)
+#define V_tcp_isn_reseed_interval VNET_INET(tcp_isn_reseed_interval)
+#define V_tcp_inflight_enable	VNET_INET(tcp_inflight_enable)
+#define V_tcp_inflight_rttthresh VNET_INET(tcp_inflight_rttthresh)
+#define V_tcp_inflight_min	VNET_INET(tcp_inflight_min)
+#define V_tcp_inflight_max	VNET_INET(tcp_inflight_max)
+#define V_tcp_inflight_stab	VNET_INET(tcp_inflight_stab)
+#define V_nolocaltimewait	VNET_INET(nolocaltimewait)
+#define V_path_mtu_discovery	VNET_INET(path_mtu_discovery)
+#define V_ss_fltsz		VNET_INET(ss_fltsz)
+#define V_ss_fltsz_local	VNET_INET(ss_fltsz_local)
+#define V_tcp_do_newreno	VNET_INET(tcp_do_newreno)
+#define V_tcp_do_tso		VNET_INET(tcp_do_tso)
+#define V_tcp_do_autosndbuf	VNET_INET(tcp_do_autosndbuf)
+#define V_tcp_autosndbuf_inc	VNET_INET(tcp_autosndbuf_inc)
+#define V_tcp_autosndbuf_max	VNET_INET(tcp_autosndbuf_max)
+#define V_tcp_do_sack		VNET_INET(tcp_do_sack)
+#define V_tcp_sack_maxholes	VNET_INET(tcp_sack_maxholes)
+#define V_tcp_sack_globalmaxholes VNET_INET(tcp_sack_globalmaxholes)
+#define V_tcp_sack_globalholes	VNET_INET(tcp_sack_globalholes)
+#define V_blackhole		VNET_INET(blackhole)
+#define V_tcp_delack_enabled	VNET_INET(tcp_delack_enabled)
+#define V_drop_synfin		VNET_INET(drop_synfin)
+#define V_tcp_do_rfc3042	VNET_INET(tcp_do_rfc3042)
+#define V_tcp_do_rfc3390	VNET_INET(tcp_do_rfc3390)
+#define V_tcp_insecure_rst	VNET_INET(tcp_insecure_rst)
+#define V_tcp_do_autorcvbuf	VNET_INET(tcp_do_autorcvbuf)
+#define V_tcp_autorcvbuf_inc	VNET_INET(tcp_autorcvbuf_inc)
+#define V_tcp_autorcvbuf_max	VNET_INET(tcp_autorcvbuf_max)
+#define V_tcp_reass_maxseg	VNET_INET(tcp_reass_maxseg)
+#define V_tcp_reass_qsize	VNET_INET(tcp_reass_qsize)
+#define V_tcp_reass_maxqlen	VNET_INET(tcp_reass_maxqlen)
+#define V_tcp_reass_overflows	VNET_INET(tcp_reass_overflows)
+
+#define V_isn_secret		VNET_INET(isn_secret)
+#define V_isn_last_reseed	VNET_INET(isn_last_reseed)
+#define V_isn_offset		VNET_INET(isn_offset)
+#define V_isn_offset_old	VNET_INET(isn_offset_old)
+#define V_isn_ctx		VNET_INET(isn_ctx)
+
+#define V_udb			VNET_INET(udb)
+#define V_udbinfo		VNET_INET(udbinfo)
+#define V_udpstat		VNET_INET(udpstat)
+
+#define V_ripcb			VNET_INET(ripcb)
+#define V_ripcbinfo		VNET_INET(ripcbinfo)
+#define V_ip_mrouter		VNET_INET(ip_mrouter)
+
+#define V_rsvp_on		VNET_INET(rsvp_on)
+#define V_ip_rsvp_on		VNET_INET(ip_rsvp_on)
+#define V_ip_rsvpd		VNET_INET(ip_rsvpd)
+
+#define V_icmpstat		VNET_INET(icmpstat)
+#define V_ipstat		VNET_INET(ipstat)
+#define V_igmpstat		VNET_INET(igmpstat)
+
+#define V_router_info_head	VNET_INET(router_info_head)
+
+#define V_rtq_timeout		VNET_INET(rtq_timeout)
+#define V_rtq_reallyold		VNET_INET(rtq_reallyold)
+#define V_rtq_minreallyold	VNET_INET(rtq_minreallyold)
+#define V_rtq_toomany		VNET_INET(rtq_toomany)
+#define V_rtq_timer		VNET_INET(rtq_timer)
+
+#define V_ipport_lowfirstauto	VNET_INET(ipport_lowfirstauto)
+#define V_ipport_lowlastauto	VNET_INET(ipport_lowlastauto)
+#define V_ipport_firstauto	VNET_INET(ipport_firstauto)
+#define V_ipport_lastauto	VNET_INET(ipport_lastauto)
+#define V_ipport_hifirstauto	VNET_INET(ipport_hifirstauto)
+#define V_ipport_hilastauto	VNET_INET(ipport_hilastauto)
+#define V_ipport_reservedhigh	VNET_INET(ipport_reservedhigh)
+#define V_ipport_reservedlow	VNET_INET(ipport_reservedlow)
+#define V_ipport_randomized	VNET_INET(ipport_randomized)
+#define V_ipport_randomcps	VNET_INET(ipport_randomcps)
+#define V_ipport_randomtime	VNET_INET(ipport_randomtime)
+#define V_ipport_stoprandom	VNET_INET(ipport_stoprandom)
+#define V_ipport_tcpallocs	VNET_INET(ipport_tcpallocs)
+#define V_ipport_tcplastcount	VNET_INET(ipport_tcplastcount)
+
+#define V_divcb			VNET_INET(divcb)
+#define V_divcbinfo		VNET_INET(divcbinfo)
 #endif /* !_NETINET_IN_H_*/

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

@@ -346,6 +346,118 @@
 		}							\
 	}								\
 } while (/*CONSTCOND*/ 0)
+
+#define INIT_VNET_INET6(vnet) int vnet_inet6;
+
+#define VNET_INET6(sym)		VSYM(vnet_inet6, sym)
+
+/*
+ * Symbol translation macros
+ */
+#define V_in6_ifaddr			VNET_INET6(in6_ifaddr)
+
+#define V_frag6_nfragpackets		VNET_INET6(frag6_nfragpackets)
+#define V_frag6_nfrags			VNET_INET6(frag6_nfrags)
+#define V_ip6q				VNET_INET6(ip6q)
+
+#define V_ip6_forward_rt		VNET_INET6(ip6_forward_rt)
+
+#define V_defaultaddrpolicy		VNET_INET6(defaultaddrpolicy)
+#define V_addrsel_policytab		VNET_INET6(addrsel_policytab)
+#define V_in6_maxmtu			VNET_INET6(in6_maxmtu)
+#define V_ip6_auto_linklocal		VNET_INET6(ip6_auto_linklocal)
+
+#define V_ip6stat			VNET_INET6(ip6stat)
+#define V_rip6stat			VNET_INET6(rip6stat)
+#define V_icmp6stat			VNET_INET6(icmp6stat)
+
+#define V_rtq_timeout6			VNET_INET6(rtq_timeout6)
+#define V_rtq_timer6			VNET_INET6(rtq_timer6)
+#define V_rtq_mtutimer			VNET_INET6(rtq_mtutimer)
+#define V_nd6_slowtimo_ch		VNET_INET6(nd6_slowtimo_ch)
+#define V_nd6_timer_ch			VNET_INET6(nd6_timer_ch)
+#define V_in6_tmpaddrtimer_ch		VNET_INET6(in6_tmpaddrtimer_ch)
+
+#define V_nd6_inuse			VNET_INET6(nd6_inuse)
+#define V_nd6_allocated			VNET_INET6(nd6_allocated)
+#define V_llinfo_nd6			VNET_INET6(llinfo_nd6)
+#define V_nd_defrouter			VNET_INET6(nd_defrouter)
+#define V_nd_prefix			VNET_INET6(nd_prefix)
+#define V_nd6_defifp			VNET_INET6(nd6_defifp)
+#define V_nd6_defifindex		VNET_INET6(nd6_defifindex)
+
+#define V_sid_default			VNET_INET6(sid_default)
+
+#define V_dadq				VNET_INET6(dadq)
+#define V_dad_init			VNET_INET6(dad_init)
+
+//#define V_icmp6errppslim		VNET_INET6(icmp6errppslim)
+#define V_icmp6errpps_count		VNET_INET6(icmp6errpps_count)
+//#define V_icmp6_nodeinfo		VNET_INET6(icmp6_nodeinfo)
+
+#define V_ip6_forwarding		VNET_INET6(ip6_forwarding)
+#define V_ip6_sendredirects		VNET_INET6(ip6_sendredirects)
+#define V_ip6_defhlim			VNET_INET6(ip6_defhlim)
+#define V_ip6_defmcasthlim		VNET_INET6(ip6_defmcasthlim)
+#define V_ip6_accept_rtadv		VNET_INET6(ip6_accept_rtadv)
+#define V_ip6_maxfragpackets		VNET_INET6(ip6_maxfragpackets)
+#define V_ip6_maxfrags			VNET_INET6(ip6_maxfrags)
+#define V_ip6_log_interval		VNET_INET6(ip6_log_interval)
+#define V_ip6_hdrnestlimit		VNET_INET6(ip6_hdrnestlimit)
+#define V_ip6_dad_count			VNET_INET6(ip6_dad_count)
+#define V_ip6_auto_flowlabel		VNET_INET6(ip6_auto_flowlabel)
+#define V_ip6_use_deprecated		VNET_INET6(ip6_use_deprecated)
+#define V_ip6_rr_prune			VNET_INET6(ip6_rr_prune)
+#define V_ip6_mcast_pmtu		VNET_INET6(ip6_mcast_pmtu)
+#define V_ip6_v6only			VNET_INET6(ip6_v6only)
+#define V_ip6_keepfaith			VNET_INET6(ip6_keepfaith)
+#define V_ip6stealth			VNET_INET6(ip6stealth)
+#define V_ip6_log_time			VNET_INET6(ip6_log_time)
+
+#define V_pmtu_expire			VNET_INET6(pmtu_expire)
+#define V_pmtu_probe			VNET_INET6(pmtu_probe)
+#define V_rip6_sendspace		VNET_INET6(rip6_sendspace)
+#define V_rip6_recvspace		VNET_INET6(rip6_recvspace)
+#define V_icmp6_rediraccept		VNET_INET6(icmp6_rediraccept)
+#define V_icmp6_redirtimeout		VNET_INET6(icmp6_redirtimeout)
+#define V_icmp6errppslim		VNET_INET6(icmp6errppslim)
+#define V_icmp6_nodeinfo		VNET_INET6(icmp6_nodeinfo)
+#define V_udp6_sendspace		VNET_INET6(udp6_sendspace)
+#define V_udp6_recvspace		VNET_INET6(udp6_recvspace)	
+#define V_icmp6errppslim_last		VNET_INET6(icmp6errppslim_last)
+#define V_ip6_prefer_tempaddr		VNET_INET6(ip6_prefer_tempaddr)
+#define V_ip6qmaxlen			VNET_INET6(ip6qmaxlen)
+#define V_ip6_forward_srcrt		VNET_INET6(ip6_forward_srcrt)
+#define V_ip6_sourcecheck		VNET_INET6(ip6_sourcecheck)
+#define V_ip6_sourcecheck_interval	VNET_INET6(ip6_sourcecheck_interval)
+#define V_ip6_ours_check_algorithm	VNET_INET6(ip6_ours_check_algorithm)
+#define V_nd6_prune			VNET_INET6(nd6_prune)
+#define V_nd6_delay			VNET_INET6(nd6_delay)
+#define V_nd6_umaxtries			VNET_INET6(nd6_umaxtries)
+#define V_nd6_mmaxtries			VNET_INET6(nd6_mmaxtries)
+#define V_nd6_useloopback		VNET_INET6(nd6_useloopback)
+#define V_nd6_gctimer			VNET_INET6(nd6_gctimer)
+#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)
+#define V_ip6_use_tempaddr		VNET_INET6(ip6_use_tempaddr)
+#define V_ip6_desync_factor		VNET_INET6(ip6_desync_factor)
+#define V_ip6_temp_preferred_lifetime	VNET_INET6(ip6_temp_preferred_lifetime)
+#define V_ip6_temp_valid_lifetime	VNET_INET6(ip6_temp_valid_lifetime)
+
+#define V_ip6_mrouter_ver		VNET_INET6(ip6_mrouter_ver)
+#define V_pim6				VNET_INET6(pim6)
+#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)
+
+#define V_ip6_opts			VNET_INET6(ip6_opts)
+
 #endif /*_KERNEL*/
 
 #endif /* not _NETINET_IP6_H_ */

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

@@ -662,5 +662,48 @@
 typedef int ipfw_nat_cfg_t(struct sockopt *);
 #endif
 
+/*
+ * Symbol translation macros
+ */
+
+#define INIT_VNET_IPFW(vnet)	int vnet_ipfw;
+ 
+#define VNET_IPFW(sym)		VSYM(vnet_ipfw, sym)
+ 
+#define V_fw_one_pass		VNET_IPFW(fw_one_pass)
+#define V_fw_enable		VNET_IPFW(fw_enable)
+#define V_fw6_enable		VNET_IPFW(fw6_enable)
+
+#define V_set_disable		VNET_IPFW(set_disable)
+#define V_fw_deny_unknown_exthdrs VNET_IPFW(fw_deny_unknown_exthdrs)
+#define V_fw_verbose		VNET_IPFW(fw_verbose)
+#define V_verbose_limit		VNET_IPFW(verbose_limit)
+
+#define V_fw_debug		VNET_IPFW(fw_debug)
+#define V_autoinc_step		VNET_IPFW(autoinc_step)
+
+#define V_ipfw_dyn_v		VNET_IPFW(ipfw_dyn_v)
+#define V_layer3_chain		VNET_IPFW(layer3_chain)
+#define V_dyn_buckets		VNET_IPFW(dyn_buckets)
+#define V_curr_dyn_buckets	VNET_IPFW(curr_dyn_buckets)
+
+#define V_dyn_ack_lifetime	VNET_IPFW(dyn_ack_lifetime)
+#define V_dyn_syn_lifetime	VNET_IPFW(dyn_syn_lifetime)
+#define V_dyn_fin_lifetime	VNET_IPFW(dyn_fin_lifetime)
+#define V_dyn_rst_lifetime	VNET_IPFW(dyn_rst_lifetime)
+#define V_dyn_udp_lifetime	VNET_IPFW(dyn_udp_lifetime)
+#define V_dyn_short_lifetime	VNET_IPFW(dyn_short_lifetime)
+#define V_dyn_keepalive_interval VNET_IPFW(dyn_keepalive_interval)
+#define V_dyn_keepalive_period	VNET_IPFW(dyn_keepalive_period)
+#define V_dyn_keepalive		VNET_IPFW(dyn_keepalive)
+#define V_static_count		VNET_IPFW(static_count)
+#define V_static_len		VNET_IPFW(static_len)
+#define V_dyn_count		VNET_IPFW(dyn_count)
+#define V_dyn_max		VNET_IPFW(dyn_max)
+
+#define V_norule_counter	VNET_IPFW(norule_counter)
+#define V_ipfw_timeout		VNET_IPFW(ipfw_timeout)
+#define V_ifaddr_event_tag	VNET_IPFW(ifaddr_event_tag)
+
 #endif /* _KERNEL */
 #endif /* _IPFW2_H */

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

@@ -47,6 +47,7 @@
 #include <net/if.h>
 
 #include <netinet/in.h>
+#include <netinet/ip6.h>
 
 #include <netinet6/in6_var.h>
 #include <netinet6/scope6_var.h>

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

@@ -1,308 +1,499 @@
-#define V_hostname hostname
-#define G_hostname hostname
-#define V_domainname domainname
-#define V_acq_seq acq_seq
-#define V_acqtree acqtree
-#define V_addrsel_policytab addrsel_policytab
-#define V_ah_cleartos ah_cleartos
-#define V_ah_enable ah_enable
-#define V_ahstat ahstat
-#define V_arp_maxtries arp_maxtries
-#define V_arp_proxyall arp_proxyall
-#define V_arpt_keep arpt_keep
-#define V_arpt_prune arpt_prune
-#define V_autoinc_step autoinc_step
-#define V_blackhole blackhole
-#define V_crypto_support crypto_support
-#define V_curr_dyn_buckets curr_dyn_buckets
-#define V_dad_ignore_ns dad_ignore_ns
-#define V_dad_init dad_init
-#define V_dad_maxtry dad_maxtry
-#define V_dadq dadq
-#define V_defaultaddrpolicy defaultaddrpolicy
-#define V_divcb divcb
-#define V_divcbinfo divcbinfo
-#define V_drop_synfin drop_synfin
-#define V_dyn_ack_lifetime dyn_ack_lifetime
-#define V_dyn_buckets dyn_buckets
-#define V_dyn_count dyn_count
-#define V_dyn_fin_lifetime dyn_fin_lifetime
-#define V_dyn_keepalive dyn_keepalive
-#define V_dyn_keepalive_interval dyn_keepalive_interval
-#define V_dyn_keepalive_period dyn_keepalive_period
-#define V_dyn_max dyn_max
-#define V_dyn_rst_lifetime dyn_rst_lifetime
-#define V_dyn_short_lifetime dyn_short_lifetime
-#define V_dyn_syn_lifetime dyn_syn_lifetime
-#define V_dyn_udp_lifetime dyn_udp_lifetime
-#define V_esp_enable esp_enable
-#define V_esp_max_ivlen esp_max_ivlen
-#define V_espstat espstat
-#define V_ether_ipfw ether_ipfw
-#define V_frag6_nfragpackets frag6_nfragpackets
-#define V_frag6_nfrags frag6_nfrags
-#define V_fw6_enable fw6_enable
-#define V_fw_debug fw_debug
-#define V_fw_deny_unknown_exthdrs fw_deny_unknown_exthdrs
-#define V_fw_enable fw_enable
-#define V_fw_one_pass fw_one_pass
-#define V_fw_verbose fw_verbose
-#define V_gif_softc_list gif_softc_list
-#define V_icmp6_nodeinfo icmp6_nodeinfo
-#define V_icmp6_rediraccept icmp6_rediraccept
-#define V_icmp6_redirtimeout icmp6_redirtimeout
-#define V_icmp6errpps_count icmp6errpps_count
-#define V_icmp6errppslim icmp6errppslim
-#define V_icmp6errppslim_last icmp6errppslim_last
-#define V_icmp6stat icmp6stat
-#define V_icmp_may_rst icmp_may_rst
-#define V_icmpstat icmpstat
-#define V_if_index if_index
-#define V_if_indexlim if_indexlim
-#define V_ifaddr_event_tag ifaddr_event_tag
-#define V_ifg_head ifg_head
-#define V_ifindex_table ifindex_table
-#define V_ifklist ifklist
-#define V_ifnet ifnet
-#define V_igmpstat igmpstat
-#define V_in6_ifaddr in6_ifaddr
-#define V_in6_maxmtu in6_maxmtu
-#define V_in6_tmpaddrtimer_ch in6_tmpaddrtimer_ch
-#define V_in_ifaddrhashtbl in_ifaddrhashtbl
-#define V_in_ifaddrhead in_ifaddrhead
-#define V_in_ifaddrhmask in_ifaddrhmask
-#define V_in_multihead in_multihead
-#define V_ip4_ah_net_deflev ip4_ah_net_deflev
-#define V_ip4_ah_offsetmask ip4_ah_offsetmask
-#define V_ip4_ah_trans_deflev ip4_ah_trans_deflev
-#define V_ip4_def_policy ip4_def_policy
-#define V_ip4_esp_net_deflev ip4_esp_net_deflev
-#define V_ip4_esp_randpad ip4_esp_randpad
-#define V_ip4_esp_trans_deflev ip4_esp_trans_deflev
-#define V_ip4_ipsec_dfbit ip4_ipsec_dfbit
-#define V_ip4_ipsec_ecn ip4_ipsec_ecn
-#define V_ip6_accept_rtadv ip6_accept_rtadv
-#define V_ip6_ah_net_deflev ip6_ah_net_deflev
-#define V_ip6_ah_trans_deflev ip6_ah_trans_deflev
-#define V_ip6_auto_flowlabel ip6_auto_flowlabel
-#define V_ip6_auto_linklocal ip6_auto_linklocal
-#define V_ip6_dad_count ip6_dad_count
-#define V_ip6_defhlim ip6_defhlim
-#define V_ip6_defmcasthlim ip6_defmcasthlim
-#define V_ip6_desync_factor ip6_desync_factor
-#define V_ip6_esp_net_deflev ip6_esp_net_deflev
-#define V_ip6_esp_randpad ip6_esp_randpad
-#define V_ip6_esp_trans_deflev ip6_esp_trans_deflev
-#define V_ip6_forward_rt ip6_forward_rt
-#define V_ip6_forward_srcrt ip6_forward_srcrt
-#define V_ip6_forwarding ip6_forwarding
-#define V_ip6_gif_hlim ip6_gif_hlim
-#define V_ip6_hdrnestlimit ip6_hdrnestlimit
-#define V_ip6_ipsec_ecn ip6_ipsec_ecn
-#define V_ip6_keepfaith ip6_keepfaith
-#define V_ip6_log_interval ip6_log_interval
-#define V_ip6_log_time ip6_log_time
-#define V_ip6_maxfragpackets ip6_maxfragpackets
-#define V_ip6_maxfrags ip6_maxfrags
-#define V_ip6_mcast_pmtu ip6_mcast_pmtu
-#define V_ip6_mrouter_ver ip6_mrouter_ver
-#define V_ip6_opts ip6_opts
-#define V_ip6_ours_check_algorithm ip6_ours_check_algorithm
-#define V_ip6_prefer_tempaddr ip6_prefer_tempaddr
-#define V_ip6_rr_prune ip6_rr_prune
-#define V_ip6_sendredirects ip6_sendredirects
-#define V_ip6_sourcecheck ip6_sourcecheck
-#define V_ip6_sourcecheck_interval ip6_sourcecheck_interval
-#define V_ip6_temp_preferred_lifetime ip6_temp_preferred_lifetime
-#define V_ip6_temp_regen_advance ip6_temp_regen_advance
-#define V_ip6_temp_valid_lifetime ip6_temp_valid_lifetime
-#define V_ip6_use_defzone ip6_use_defzone
-#define V_ip6_use_deprecated ip6_use_deprecated
-#define V_ip6_use_tempaddr ip6_use_tempaddr
-#define V_ip6_v6only ip6_v6only
-#define V_ip6q ip6q
-#define V_ip6qmaxlen ip6qmaxlen
-#define V_ip6stat ip6stat
-#define V_ip6stealth ip6stealth
-#define V_ip_checkinterface ip_checkinterface
-#define V_ip_defttl ip_defttl
-#define V_ip_do_randomid ip_do_randomid
-#define V_ip_gif_ttl ip_gif_ttl
-#define V_ip_keepfaith ip_keepfaith
-#define V_ip_mrouter ip_mrouter
-#define V_ip_rsvp_on ip_rsvp_on
-#define V_ip_rsvpd ip_rsvpd
-#define V_ip_sendsourcequench ip_sendsourcequench
-#define V_ipcomp_enable ipcomp_enable
-#define V_ipcompstat ipcompstat
-#define V_ipfastforward_active ipfastforward_active
-#define V_ipforwarding ipforwarding
-#define V_ipfw_dyn_v ipfw_dyn_v
-#define V_ipfw_timeout ipfw_timeout
-#define V_ipip_allow ipip_allow
-#define V_ipipstat ipipstat
-#define V_ipport_firstauto ipport_firstauto
-#define V_ipport_hifirstauto ipport_hifirstauto
-#define V_ipport_hilastauto ipport_hilastauto
-#define V_ipport_lastauto ipport_lastauto
-#define V_ipport_lowfirstauto ipport_lowfirstauto
-#define V_ipport_lowlastauto ipport_lowlastauto
-#define V_ipport_randomcps ipport_randomcps
-#define V_ipport_randomized ipport_randomized
-#define V_ipport_randomtime ipport_randomtime
-#define V_ipport_reservedhigh ipport_reservedhigh
-#define V_ipport_reservedlow ipport_reservedlow
-#define V_ipport_stoprandom ipport_stoprandom
-#define V_ipport_tcpallocs ipport_tcpallocs
-#define V_ipport_tcplastcount ipport_tcplastcount
-#define V_ipq ipq
-#define V_ipq_zone ipq_zone
-#define V_ipsec4stat ipsec4stat
-#define V_ipsec6stat ipsec6stat
-#define V_ipsec_ah_keymin ipsec_ah_keymin
-#define V_ipsec_debug ipsec_debug
-#define V_ipsec_esp_auth ipsec_esp_auth
-#define V_ipsec_esp_keymin ipsec_esp_keymin
-#define V_ipsec_integrity ipsec_integrity
-#define V_ipsec_replay ipsec_replay
-#define V_ipsendredirects ipsendredirects
-#define V_ipstat ipstat
-#define V_ipstealth ipstealth
-#define V_isn_ctx isn_ctx
-#define V_isn_last_reseed isn_last_reseed
-#define V_isn_offset isn_offset
-#define V_isn_offset_old isn_offset_old
-#define V_isn_secret isn_secret
-#define V_key_blockacq_count key_blockacq_count
-#define V_key_blockacq_lifetime key_blockacq_lifetime
-#define V_key_cb key_cb
-#define V_key_debug_level key_debug_level
-#define V_key_dst key_dst
-#define V_key_int_random key_int_random
-#define V_key_larval_lifetime key_larval_lifetime
-#define V_key_preferred_oldsa key_preferred_oldsa
-#define V_key_spi_maxval key_spi_maxval
-#define V_key_spi_minval key_spi_minval
-#define V_key_spi_trycnt key_spi_trycnt
-#define V_key_src key_src
-#define V_layer3_chain layer3_chain
-#define V_llinfo_arp llinfo_arp
-#define V_llinfo_nd6 llinfo_nd6
-#define V_lo_list lo_list
-#define V_loif loif
-#define V_max_gif_nesting max_gif_nesting
-#define V_maxfragsperpacket maxfragsperpacket
-#define V_maxnipq maxnipq
-#define V_mrt6debug mrt6debug
-#define V_nd6_allocated nd6_allocated
-#define V_nd6_debug nd6_debug
-#define V_nd6_defifindex nd6_defifindex
-#define V_nd6_defifp nd6_defifp
-#define V_nd6_delay nd6_delay
-#define V_nd6_gctimer nd6_gctimer
-#define V_nd6_inuse nd6_inuse
-#define V_nd6_maxndopt nd6_maxndopt
-#define V_nd6_maxnudhint nd6_maxnudhint
-#define V_nd6_maxqueuelen nd6_maxqueuelen
-#define V_nd6_mmaxtries nd6_mmaxtries
-#define V_nd6_prune nd6_prune
-#define V_nd6_recalc_reachtm_interval nd6_recalc_reachtm_interval
-#define V_nd6_slowtimo_ch nd6_slowtimo_ch
-#define V_nd6_timer_ch nd6_timer_ch
-#define V_nd6_umaxtries nd6_umaxtries
-#define V_nd6_useloopback nd6_useloopback
-#define V_nd_defrouter nd_defrouter
-#define V_nd_prefix nd_prefix
-#define V_nextID nextID
-#define V_ng_ID_hash ng_ID_hash
-#define V_ng_eiface_unit ng_eiface_unit
-#define V_ng_iface_unit ng_iface_unit
-#define V_ng_name_hash ng_name_hash
-#define V_ng_nodelist ng_nodelist
-#define V_nipq nipq
-#define V_nolocaltimewait nolocaltimewait
-#define V_norule_counter norule_counter
-#define V_parallel_tunnels parallel_tunnels
-#define V_path_mtu_discovery path_mtu_discovery
-#define V_pfkeystat pfkeystat
-#define V_pim6 pim6
-#define V_pmtu_expire pmtu_expire
-#define V_pmtu_probe pmtu_probe
-#define V_policy_id policy_id
-#define V_rawcb_list rawcb_list
-#define V_regtree regtree
-#define V_rip6_recvspace rip6_recvspace
-#define V_rip6_sendspace rip6_sendspace
-#define V_rip6stat rip6stat
-#define V_ripcb ripcb
-#define V_ripcbinfo ripcbinfo
-#define V_router_info_head router_info_head
-#define V_rsvp_on rsvp_on
-#define V_rt_tables rt_tables
-#define V_rtq_minreallyold rtq_minreallyold
-#define V_rtq_mtutimer rtq_mtutimer
-#define V_rtq_reallyold rtq_reallyold
-#define V_rtq_timeout rtq_timeout
-#define V_rtq_timeout6 rtq_timeout6
-#define V_rtq_timer rtq_timer
-#define V_rtq_timer6 rtq_timer6
-#define V_rtq_toomany rtq_toomany
-#define V_rtstat rtstat
-#define V_rttrash rttrash
-#define V_sahtree sahtree
-#define V_sameprefixcarponly sameprefixcarponly
-#define V_saorder_state_alive saorder_state_alive
-#define V_saorder_state_any saorder_state_any
-#define V_set_disable set_disable
-#define V_sid_default sid_default
-#define V_spacqtree spacqtree
-#define V_sptree sptree
-#define V_ss_fltsz ss_fltsz
-#define V_ss_fltsz_local ss_fltsz_local
-#define V_static_count static_count
-#define V_subnetsarelocal subnetsarelocal
-#define V_tcb tcb
-#define V_tcbinfo tcbinfo
-#define V_tcp_autorcvbuf_inc tcp_autorcvbuf_inc
-#define V_tcp_autorcvbuf_max tcp_autorcvbuf_max
-#define V_tcp_autosndbuf_inc tcp_autosndbuf_inc
-#define V_tcp_autosndbuf_max tcp_autosndbuf_max
-#define V_tcp_delack_enabled tcp_delack_enabled
-#define V_tcp_do_autorcvbuf tcp_do_autorcvbuf
-#define V_tcp_do_autosndbuf tcp_do_autosndbuf
-#define V_tcp_do_newreno tcp_do_newreno
-#define V_tcp_do_rfc1323 tcp_do_rfc1323
-#define V_tcp_do_rfc3042 tcp_do_rfc3042
-#define V_tcp_do_rfc3390 tcp_do_rfc3390
-#define V_tcp_do_sack tcp_do_sack
-#define V_tcp_do_tso tcp_do_tso
-#define V_tcp_hc_callout tcp_hc_callout
-#define V_tcp_hostcache tcp_hostcache
-#define V_tcp_inflight_enable tcp_inflight_enable
-#define V_tcp_inflight_max tcp_inflight_max
-#define V_tcp_inflight_min tcp_inflight_min
-#define V_tcp_inflight_rttthresh tcp_inflight_rttthresh
-#define V_tcp_inflight_stab tcp_inflight_stab
-#define V_tcp_insecure_rst tcp_insecure_rst
-#define V_tcp_isn_reseed_interval tcp_isn_reseed_interval
-#define V_tcp_minmss tcp_minmss
-#define V_tcp_mssdflt tcp_mssdflt
-#define V_tcp_reass_maxqlen tcp_reass_maxqlen
-#define V_tcp_reass_maxseg tcp_reass_maxseg
-#define V_tcp_reass_overflows tcp_reass_overflows
-#define V_tcp_reass_qsize tcp_reass_qsize
-#define V_tcp_sack_globalholes tcp_sack_globalholes
-#define V_tcp_sack_globalmaxholes tcp_sack_globalmaxholes
-#define V_tcp_sack_maxholes tcp_sack_maxholes
-#define V_tcp_sc_rst_sock_fail tcp_sc_rst_sock_fail
-#define V_tcp_syncache tcp_syncache
-#define V_tcp_v6mssdflt tcp_v6mssdflt
-#define V_tcpstat tcpstat
-#define V_twq_2msl twq_2msl
-#define V_udb udb
-#define V_udbinfo udbinfo
-#define V_udp6_recvspace udp6_recvspace
-#define V_udp6_sendspace udp6_sendspace
-#define V_udpstat udpstat
-#define V_useloopback useloopback
-#define V_verbose_limit verbose_limit
+/*-
+ * Copyright (c) 2006-2008 University of Zagreb
+ * Copyright (c) 2006-2008 FreeBSD Foundation
+ *
+ * This software was developed by the University of Zagreb and the
+ * FreeBSD Foundation under sponsorship by the Stichting NLnet and the
+ * FreeBSD Foundation.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+#ifndef _NET_VIMAGE_H_
+#define _NET_VIMAGE_H_
+
+#include <sys/lock.h>
+#include <sys/proc.h>
+#include <sys/condvar.h>
+#include <sys/mutex.h>
+
+#ifdef INVARIANTS
+#define VNET_DEBUG
+#endif
+
+struct	vimage;
+struct	vprocg;
+struct	vnet;
+struct	vi_req;
+struct	kld_sym_lookup; 
+
+struct	ifnet;		/* XXX must go away */
+
+#define curvnet curthread->td_vnet
+
+#define basevnet thread0.td_ucred->cr_vimage->v_vnet
+#define basevprocg thread0.td_ucred->cr_vimage->v_procg
+#define basevcpu thread0.td_ucred->cr_vimage->v_cpu
+
+typedef int vnet_attach_fn(const void *);
+typedef int vnet_detach_fn(const void *);
+
+
+#ifdef VIMAGE
+ 
+#define	V_GLOBAL	0
+#define	V_NET		1
+#define	V_PROCG		2
+#define V_CPU		3
+
+#define VNET_MOD_NONE		-1 
+/*statefull modules */
+#define VNET_MOD_NET		 0
+#define VNET_MOD_NETGRAPH	 1
+#define VNET_MOD_INET		 2
+#define VNET_MOD_INET6		 3
+#define VNET_MOD_IPSEC		 4
+#define VNET_MOD_IPFW		 5
+#define VNET_MOD_DUMMYNET	 6
+#define VNET_MOD_PF		 7
+#define VNET_MOD_ALTQ		 8
+#define VNET_MOD_IPX		 9
+#define VNET_MOD_ATALK		10
+/* stateless modules */
+#define VNET_MOD_NG_WORMHOLE	19
+#define VNET_MOD_NG_ETHER	20
+#define VNET_MOD_NG_IFACE	21
+#define VNET_MOD_NG_EIFACE	22
+#define VNET_MOD_ESP		23
+#define VNET_MOD_IPIP		24
+#define VNET_MOD_AH		25
+#define VNET_MOD_IPCOMP	 	26	
+#define VNET_MOD_GIF		27
+#define VNET_MOD_ARP		28
+#define VNET_MOD_RTABLE		29
+#define VNET_MOD_LOIF		30
+#define VNET_MOD_DOMAIN		31
+#define VNET_MOD_DYNAMIC_START	32
+#define VNET_MOD_MAX		64
+
+/* Needed for ugly sysctl virtualization macros */
+#define V_MOD_vnet_net		VNET_MOD_NET
+#define V_MOD_vnet_netgraph	VNET_MOD_NETGRAPH
+#define V_MOD_vnet_inet		VNET_MOD_INET
+#define V_MOD_vnet_inet6	VNET_MOD_INET6
+#define V_MOD_vnet_ipfw		VNET_MOD_IPFW
+#define V_MOD_vnet_pf		VNET_MOD_PF
+#define V_MOD_vnet_gif		VNET_MOD_GIF
+#define V_MOD_vnet_ipsec	VNET_MOD_IPSEC
+
+#define V_MOD_vprocg		0
+#define V_MOD_vcpu		0
+
+struct vnet {
+	void	*mod_data[VNET_MOD_MAX];
+
+	u_int	vnet_ref;		/* reference count */
+	LIST_ENTRY(vnet) vnet_le;	/* all vnets list */
+	u_int	vnet_id;		/* ID num */
+
+	u_int	ifccnt;
+	u_int	sockcnt;
+
+	u_int	vnet_magic_n;
+};
+
+struct vnet_symmap {
+	char	*name;
+	size_t	offset;
+	size_t	size;
+};
+
+struct vnet_modinfo {
+	u_int				vmi_id;
+	u_int				vmi_dependson;
+	char				*vmi_name;
+	vnet_attach_fn			*vmi_iattach;
+	vnet_detach_fn			*vmi_idetach;
+	size_t				vmi_struct_size;
+	struct vnet_symmap		*vmi_symmap;
+};
+
+struct vnet_modlink {
+	TAILQ_ENTRY(vnet_modlink)	vml_mod_le;
+	const struct vnet_modinfo	*vml_modinfo;
+	const void			*vml_iarg;
+	const char			*vml_iname;
+};
+
+#define VNET_MOD_DECLARE(m_name_uc, m_name_lc, m_iattach, m_idetach, 	\
+    m_dependson, m_symmap)						\
+	static const struct vnet_modinfo vnet_##m_name_lc##_modinfo = {	\
+		.vmi_id			= VNET_MOD_##m_name_uc,		\
+		.vmi_dependson		= VNET_MOD_##m_dependson,	\
+		.vmi_name		= #m_name_lc,			\
+		.vmi_iattach		= m_iattach,			\
+		.vmi_idetach		= m_idetach,			\
+		.vmi_struct_size	=				\
+			sizeof(struct vnet_##m_name_lc),		\
+		.vmi_symmap		= m_symmap			\
+};
+
+#define VNET_MOD_DECLARE_STATELESS(m_name_uc, m_name_lc, m_iattach, m_idetach, \
+    m_dependson)							\
+	static const struct vnet_modinfo vnet_##m_name_lc##_modinfo = {	\
+		.vmi_id			= VNET_MOD_##m_name_uc,		\
+		.vmi_dependson		= VNET_MOD_##m_dependson,	\
+		.vmi_name		= #m_name_lc,			\
+		.vmi_iattach		= m_iattach,			\
+		.vmi_idetach		= m_idetach			\
+};
+
+#define VSYM(base, sym) ((base)->_##sym)
+
+#define VNET_SYMMAP(mod, name)						\
+	{ #name, offsetof(struct vnet_##mod, _##name),			\
+	sizeof(((struct vnet_##mod *) curthread)->_##name) }
+
+#define VNET_SYMMAP_END							\
+	{ NULL, 0 }
+
+#define VNET_MAGIC_N 0x3e0d8f29
+
+
+#ifdef VNET_DEBUG
+
+#define VNET_ASSERT(condition)						\
+	if (!(condition)) {						\
+		printf("VNET_ASSERT @ %s:%d %s():\n",			\
+			__FILE__, __LINE__, __FUNCTION__);		\
+		panic(#condition);					\
+	}
+
+#define CURVNET_SET_QUIET(arg)						\
+	VNET_ASSERT((arg)->vnet_magic_n == VNET_MAGIC_N);		\
+	struct vnet *saved_vnet = curvnet;				\
+	const char *saved_vnet_lpush = curthread->td_vnet_lpush;	\
+	curvnet = arg;							\
+	curthread->td_vnet_lpush = __FUNCTION__;
+ 
+#define CURVNET_SET_VERBOSE(arg)					\
+	CURVNET_SET_QUIET(arg)						\
+	if (saved_vnet)							\
+		printf("curvnet_set(%p) in %s() on cpu %d, prev %p in %s()\n", \
+		       curvnet, curthread->td_vnet_lpush, curcpu,	\
+		       saved_vnet, saved_vnet_lpush);
+
+#define CURVNET_SET(arg)	CURVNET_SET_VERBOSE(arg)
+ 
+#define CURVNET_RESTORE()						\
+	VNET_ASSERT(saved_vnet == NULL ||				\
+		    saved_vnet->vnet_magic_n == VNET_MAGIC_N);		\
+	curvnet = saved_vnet;						\
+	curthread->td_vnet_lpush = saved_vnet_lpush;
+ 
+#define INIT_FROM_VNET(vnet, modindex, modtype, sym)			\
+	if (vnet != curvnet) 						\
+		panic("in %s:%d %s()\n vnet=%p curvnet=%p",		\
+		      __FILE__, __LINE__, __FUNCTION__,			\
+		      vnet, curvnet);					\
+	modtype *sym = (vnet)->mod_data[modindex];
+
+#define VNET_ITERLOOP_BEGIN()						\
+	struct vnet *vnet_iter;						\
+	VNET_LIST_REF();						\
+	LIST_FOREACH(vnet_iter, &vnet_head, vnet_le) {			\
+		CURVNET_SET(vnet_iter);
+
+#define VNET_ITERLOOP_BEGIN_QUIET()					\
+	struct vnet *vnet_iter;						\
+	VNET_LIST_REF();						\
+	LIST_FOREACH(vnet_iter, &vnet_head, vnet_le) {			\
+		CURVNET_SET_QUIET(vnet_iter);
+
+#define VNET_ITERLOOP_END()						\
+		CURVNET_RESTORE();					\
+	}								\
+	VNET_LIST_UNREF();
+
+#else /* !VNET_DEBUG */
+
+#define VNET_ASSERT(condition)
+
+#define CURVNET_SET(arg)						\
+	struct vnet *saved_vnet = curvnet;				\
+	curvnet = arg;	
+ 
+#define CURVNET_SET_VERBOSE(arg)	CURVNET_SET(arg)
+#define CURVNET_SET_QUIET(arg)		CURVNET_SET(arg)
+ 
+#define CURVNET_RESTORE()						\
+	curvnet = saved_vnet;
+ 
+#define INIT_FROM_VNET(vnet, modindex, modtype, sym)			\
+	modtype *sym = (vnet)->mod_data[modindex];
+
+#define VNET_ITERLOOP_BEGIN()						\
+	struct vnet *vnet_iter;						\
+	VNET_LIST_REF();						\
+	LIST_FOREACH(vnet_iter, &vnet_head, vnet_le) {			\
+		CURVNET_SET(vnet_iter);
+
+#define VNET_ITERLOOP_BEGIN_QUIET()	VNET_ITERLOOP_BEGIN()	
+
+#define VNET_ITERLOOP_END()						\
+		CURVNET_RESTORE();					\
+	}								\
+	VNET_LIST_UNREF();
+
+#endif /* !VNET_DEBUG */
+
+#define INIT_VPROCG(arg)	struct vprocg *vprocg = (arg);

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


More information about the p4-projects mailing list