Date: Fri, 4 Jul 2008 08:36:28 GMT From: Julian Elischer <julian@FreeBSD.org> To: Perforce Change Reviews <perforce@freebsd.org> Subject: PERFORCE change 144603 for review Message-ID: <200807040836.m648aSre063240@repoman.freebsd.org>
next in thread | raw e-mail | index | archive | help
http://perforce.freebsd.org/chv.cgi?CH=144603 Change 144603 by julian@julian_trafmon1 on 2008/07/04 08:36:03 IFC a bunch of corrections from the vimage branch Affected files ... .. //depot/projects/vimage-devel/src/sys/compat/linux/linux_socket.c#2 integrate .. //depot/projects/vimage-devel/src/sys/compat/svr4/svr4_sockio.c#2 integrate .. //depot/projects/vimage-devel/src/sys/compat/svr4/svr4_stat.c#2 integrate .. //depot/projects/vimage-devel/src/sys/contrib/altq/altq/altq_subr.c#2 integrate .. //depot/projects/vimage-devel/src/sys/contrib/ipfilter/netinet/ip_fil_freebsd.c#2 integrate .. //depot/projects/vimage-devel/src/sys/contrib/pf/net/pf.c#2 integrate .. //depot/projects/vimage-devel/src/sys/contrib/pf/net/pf_if.c#2 integrate .. //depot/projects/vimage-devel/src/sys/contrib/pf/net/pf_ioctl.c#2 integrate .. //depot/projects/vimage-devel/src/sys/dev/ie/if_ie.c#2 integrate .. //depot/projects/vimage-devel/src/sys/dev/syscons/daemon/daemon_saver.c#2 integrate .. //depot/projects/vimage-devel/src/sys/i386/ibcs2/ibcs2_socksys.c#2 integrate .. //depot/projects/vimage-devel/src/sys/kern/kern_poll.c#2 integrate .. //depot/projects/vimage-devel/src/sys/net/bridgestp.c#2 integrate .. //depot/projects/vimage-devel/src/sys/net/if_bridge.c#2 integrate .. //depot/projects/vimage-devel/src/sys/net/if_ef.c#2 integrate .. //depot/projects/vimage-devel/src/sys/netgraph/atm/ng_atm.c#2 integrate .. //depot/projects/vimage-devel/src/sys/netipsec/xform_ah.c#3 integrate .. //depot/projects/vimage-devel/src/sys/netipsec/xform_esp.c#3 integrate .. //depot/projects/vimage-devel/src/sys/nfsclient/bootp_subr.c#2 integrate .. //depot/projects/vimage-devel/src/sys/sys/vimage.h#9 edit Differences ... ==== //depot/projects/vimage-devel/src/sys/compat/linux/linux_socket.c#2 (text+ko) ==== @@ -32,6 +32,7 @@ /* XXX we use functions that might not exist. */ #include "opt_compat.h" #include "opt_inet6.h" +#include "opt_vimage.h" #include <sys/param.h> #include <sys/proc.h> @@ -50,6 +51,9 @@ #include <sys/uio.h> #include <sys/syslog.h> #include <sys/un.h> +#include <sys/vimage.h> + +#include <net/if.h> #include <netinet/in.h> #include <netinet/in_systm.h> @@ -57,6 +61,7 @@ #ifdef INET6 #include <netinet/ip6.h> #include <netinet6/ip6_var.h> +#include <netinet6/vinet6.h> #endif #ifdef COMPAT_LINUX32 @@ -545,6 +550,10 @@ static int linux_socket(struct thread *td, struct linux_socket_args *args) { +#ifndef KLD_MODULE + INIT_VNET_INET6(curvnet); +#endif + struct linux_socket_args linux_args; struct socket_args /* { int domain; @@ -588,7 +597,7 @@ * XXX: Avoid undefined symbol error with an IPv4 only * kernel. */ - && ip6_v6only + && V_ip6_v6only #endif ) { int v6only; ==== //depot/projects/vimage-devel/src/sys/compat/svr4/svr4_sockio.c#2 (text+ko) ==== @@ -26,6 +26,8 @@ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ +#include "opt_vimage.h" + #include <sys/cdefs.h> __FBSDID("$FreeBSD: src/sys/compat/svr4/svr4_sockio.c,v 1.18 2006/08/04 21:15:09 brooks Exp $"); @@ -36,9 +38,11 @@ #include <sys/filedesc.h> #include <sys/sockio.h> #include <sys/socket.h> +#include <sys/vimage.h> + #include <net/if.h> +#include <net/vnet.h> - #include <compat/svr4/svr4.h> #include <compat/svr4/svr4_util.h> #include <compat/svr4/svr4_ioctl.h> @@ -87,6 +91,7 @@ switch (cmd) { case SVR4_SIOCGIFNUM: { + INIT_VNET_NET(curvnet); struct ifnet *ifp; struct ifaddr *ifa; int ifnum = 0; @@ -103,7 +108,7 @@ * entry per physical interface? */ IFNET_RLOCK(); - TAILQ_FOREACH(ifp, &ifnet, if_link) + TAILQ_FOREACH(ifp, &V_ifnet, if_link) if (TAILQ_EMPTY(&ifp->if_addrhead)) ifnum++; else ==== //depot/projects/vimage-devel/src/sys/compat/svr4/svr4_stat.c#2 (text+ko) ==== @@ -26,6 +26,8 @@ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ +#include "opt_vimage.h" + #include <sys/cdefs.h> __FBSDID("$FreeBSD: src/sys/compat/svr4/svr4_stat.c,v 1.23 2006/09/02 08:18:22 rwatson Exp $"); @@ -43,6 +45,7 @@ #include <sys/sysctl.h> #include <sys/sysproto.h> #include <sys/un.h> +#include <sys/vimage.h> #include <vm/vm.h> @@ -411,6 +414,8 @@ struct thread *td; struct svr4_sys_systeminfo_args *uap; { + INIT_VPROCG(TD_TO_VPROCG(td)); + char *str = NULL; int error = 0; register_t *retval = td->td_retval; @@ -426,7 +431,7 @@ break; case SVR4_SI_HOSTNAME: - str = hostname; + str = V_hostname; break; case SVR4_SI_RELEASE: @@ -454,7 +459,7 @@ break; case SVR4_SI_SRPC_DOMAIN: - str = domainname; + str = V_domainname; break; case SVR4_SI_PLATFORM: ==== //depot/projects/vimage-devel/src/sys/contrib/altq/altq/altq_subr.c#2 (text+ko) ==== @@ -29,11 +29,10 @@ #if defined(__FreeBSD__) || defined(__NetBSD__) #include "opt_altq.h" -#if (__FreeBSD__ != 2) -#include "opt_inet.h" #ifdef __FreeBSD__ #include "opt_inet6.h" -#endif +#include "opt_inet.h" +#include "opt_vimage.h" #endif #endif /* __FreeBSD__ || __NetBSD__ */ @@ -49,10 +48,12 @@ #include <sys/syslog.h> #include <sys/sysctl.h> #include <sys/queue.h> +#include <sys/vimage.h> #include <net/if.h> #include <net/if_dl.h> #include <net/if_types.h> +#include <net/vnet.h> #include <netinet/in.h> #include <netinet/in_systm.h> @@ -460,7 +461,9 @@ #if defined(__FreeBSD__) && (__FreeBSD_version >= 500000) IFNET_RLOCK(); #endif - for (ifp = TAILQ_FIRST(&ifnet); ifp; ifp = TAILQ_NEXT(ifp, if_list)) { + VNET_ITERLOOP_BEGIN(); + INIT_VNET_NET(curvnet); + for (ifp = TAILQ_FIRST(&V_ifnet); ifp; ifp = TAILQ_NEXT(ifp, if_list)) { /* read from if_snd unlocked */ if (!TBR_IS_ENABLED(&ifp->if_snd)) continue; @@ -468,6 +471,7 @@ if (!IFQ_IS_EMPTY(&ifp->if_snd) && ifp->if_start != NULL) (*ifp->if_start)(ifp); } + VNET_ITERLOOP_END() #if defined(__FreeBSD__) && (__FreeBSD_version >= 500000) IFNET_RUNLOCK(); #endif ==== //depot/projects/vimage-devel/src/sys/contrib/ipfilter/netinet/ip_fil_freebsd.c#2 (text+ko) ==== @@ -25,6 +25,9 @@ # include "opt_random_ip_id.h" #endif #include <sys/param.h> +#if __FreeBSD_version > 800000 +# include "opt_vimage.h" +#endif #if defined(__FreeBSD__) && !defined(__FreeBSD_version) # if defined(IPFILTER_LKM) # ifndef __FreeBSD_cc_version @@ -115,8 +118,17 @@ #endif extern int ip_optcopy __P((struct ip *, struct ip *)); +#if __FreeBSD_version > 800000 +# include <sys/vimage.h> +# include <netinet/vinet.h> +#endif #if (__FreeBSD_version > 460000) +#ifndef VIMAGE extern int path_mtu_discovery; +#define V_path_mtu_discovery path_mtu_discovery +#define V_ip_defttl ip_defttl +#define V_ipforwarding ipforwarding +#endif #endif # ifdef IPFILTER_M_IPFILTER @@ -233,8 +245,10 @@ bzero((char *)frcache, sizeof(frcache)); fr_running = 1; - if (fr_control_forwarding & 1) - ipforwarding = 1; + if (fr_control_forwarding & 1) { + INIT_VNET_INET(curvnet); + V_ipforwarding = 1; + } SPL_X(s); #if (__FreeBSD_version >= 300000) @@ -256,8 +270,10 @@ #ifdef USE_SPL int s; #endif - if (fr_control_forwarding & 2) - ipforwarding = 0; + if (fr_control_forwarding & 2) { + INIT_VNET_INET(curvnet); + V_ipforwarding = 0; + } SPL_NET(s); @@ -635,6 +651,7 @@ fr_info_t *fin; mb_t *m, **mpp; { + INIT_VNET_INET(curvnet); fr_info_t fnew; ip_t *ip, *oip; int hlen; @@ -652,11 +669,11 @@ ip->ip_tos = oip->ip_tos; ip->ip_id = fin->fin_ip->ip_id; #if (__FreeBSD_version > 460000) - ip->ip_off = path_mtu_discovery ? IP_DF : 0; + ip->ip_off = V_path_mtu_discovery ? IP_DF : 0; #else ip->ip_off = 0; #endif - ip->ip_ttl = ip_defttl; + ip->ip_ttl = V_ip_defttl; ip->ip_sum = 0; hlen = sizeof(*oip); break; ==== //depot/projects/vimage-devel/src/sys/contrib/pf/net/pf.c#2 (text+ko) ==== @@ -38,6 +38,7 @@ #ifdef __FreeBSD__ #include "opt_inet.h" #include "opt_inet6.h" +#include "opt_vimage.h" #include <sys/cdefs.h> __FBSDID("$FreeBSD: src/sys/contrib/pf/net/pf.c,v 1.54 2008/05/09 23:02:55 julian Exp $"); @@ -91,6 +92,7 @@ #include <sys/kthread.h> #include <sys/lock.h> #include <sys/sx.h> +#include <sys/vimage.h> #else #include <sys/rwlock.h> #endif @@ -118,6 +120,7 @@ #include <netinet/udp_var.h> #include <netinet/icmp_var.h> #include <netinet/if_ether.h> +#include <netinet/vinet.h> #ifndef __FreeBSD__ #include <dev/rndvar.h> @@ -137,6 +140,7 @@ #ifdef __FreeBSD__ #include <netinet6/ip6_var.h> #include <netinet6/in6_pcb.h> +#include <netinet6/vinet6.h> #endif #endif /* INET6 */ @@ -1757,6 +1761,7 @@ u_int8_t flags, u_int16_t win, u_int16_t mss, u_int8_t ttl, int tag, u_int16_t rtag, struct ether_header *eh, struct ifnet *ifp) { + INIT_VNET_INET(curvnet); struct mbuf *m; int len, tlen; #ifdef INET @@ -1916,13 +1921,13 @@ h->ip_hl = sizeof(*h) >> 2; h->ip_tos = IPTOS_LOWDELAY; #ifdef __FreeBSD__ - h->ip_off = path_mtu_discovery ? IP_DF : 0; + h->ip_off = V_path_mtu_discovery ? IP_DF : 0; h->ip_len = len; #else h->ip_off = htons(ip_mtudisc ? IP_DF : 0); h->ip_len = htons(len); #endif - h->ip_ttl = ttl ? ttl : ip_defttl; + h->ip_ttl = ttl ? ttl : V_ip_defttl; h->ip_sum = 0; if (eh == NULL) { #ifdef __FreeBSD__ @@ -2920,6 +2925,7 @@ pf_socket_lookup(int direction, struct pf_pdesc *pd) #endif { + INIT_VNET_INET(curvnet); struct pf_addr *saddr, *daddr; u_int16_t sport, dport; #ifdef __FreeBSD__ @@ -2953,7 +2959,7 @@ sport = pd->hdr.tcp->th_sport; dport = pd->hdr.tcp->th_dport; #ifdef __FreeBSD__ - pi = &tcbinfo; + pi = &V_tcbinfo; #else tb = &tcbtable; #endif @@ -2964,7 +2970,7 @@ sport = pd->hdr.udp->uh_sport; dport = pd->hdr.udp->uh_dport; #ifdef __FreeBSD__ - pi = &udbinfo; + pi = &V_udbinfo; #else tb = &udbtable; #endif @@ -3099,10 +3105,11 @@ u_int16_t pf_get_mss(struct mbuf *m, int off, u_int16_t th_off, sa_family_t af) { + INIT_VNET_INET(curvnet); int hlen; u_int8_t hdr[60]; u_int8_t *opt, optlen; - u_int16_t mss = tcp_mssdflt; + u_int16_t mss = V_tcp_mssdflt; hlen = th_off << 2; /* hlen <= sizeof(hdr) */ if (hlen <= sizeof(struct tcphdr)) @@ -3138,6 +3145,7 @@ pf_calc_mss(struct pf_addr *addr, sa_family_t af, u_int16_t offer) { #ifdef INET + INIT_VNET_INET(curvnet); struct sockaddr_in *dst; struct route ro; #endif /* INET */ @@ -3147,7 +3155,7 @@ #endif /* INET6 */ struct rtentry *rt = NULL; int hlen = 0; /* make the compiler happy */ - u_int16_t mss = tcp_mssdflt; + u_int16_t mss = V_tcp_mssdflt; switch (af) { #ifdef INET @@ -3195,7 +3203,7 @@ if (rt && rt->rt_ifp) { mss = rt->rt_ifp->if_mtu - hlen - sizeof(struct tcphdr); - mss = max(tcp_mssdflt, mss); + mss = max(V_tcp_mssdflt, mss); RTFREE(rt); } mss = min(mss, offer); @@ -3240,6 +3248,7 @@ struct ifqueue *ifq) #endif { + INIT_VNET_INET(curvnet); struct pf_rule *nr = NULL; struct pf_addr *saddr = pd->src, *daddr = pd->dst; struct tcphdr *th = pd->hdr.tcp; @@ -3251,7 +3260,7 @@ u_short reason; int rewrite = 0; int tag = -1, rtableid = -1; - u_int16_t mss = tcp_mssdflt; + u_int16_t mss = V_tcp_mssdflt; int asd = 0; int match = 0; @@ -6078,6 +6087,7 @@ pf_route(struct mbuf **m, struct pf_rule *r, int dir, struct ifnet *oifp, struct pf_state *s, struct pf_pdesc *pd) { + INIT_VNET_INET(curvnet); struct mbuf *m0, *m1; struct route iproute; struct route *ro = NULL; @@ -6135,7 +6145,7 @@ if (r->rt == PF_FASTROUTE) { in_rtalloc(ro, 0); if (ro->ro_rt == 0) { - ipstat.ips_noroute++; + V_ipstat.ips_noroute++; goto bad; } @@ -6266,7 +6276,7 @@ if ((ifp->if_capabilities & IFCAP_CSUM_IPv4) && ifp->if_bridge == NULL) { m0->m_pkthdr.csum_flags |= M_IPV4_CSUM_OUT; - ipstat.ips_outhwcsum++; + V_ipstat.ips_outhwcsum++; } else { ip->ip_sum = 0; ip->ip_sum = in_cksum(m0, ip->ip_hl << 2); @@ -6285,7 +6295,7 @@ * Must be able to put at least 8 bytes per fragment. */ if (ip->ip_off & htons(IP_DF)) { - ipstat.ips_cantfrag++; + V_ipstat.ips_cantfrag++; if (r->rt != PF_DUPTO) { #ifdef __FreeBSD__ /* icmp_error() expects host byte ordering */ @@ -6342,7 +6352,7 @@ } if (error == 0) - ipstat.ips_fragmented++; + V_ipstat.ips_fragmented++; done: if (r->rt != PF_DUPTO) @@ -6615,18 +6625,30 @@ if (sum) { switch (p) { case IPPROTO_TCP: - tcpstat.tcps_rcvbadsum++; + { + INIT_VNET_INET(curvnet); + V_tcpstat.tcps_rcvbadsum++; break; + } case IPPROTO_UDP: - udpstat.udps_badsum++; + { + INIT_VNET_INET(curvnet); + V_udpstat.udps_badsum++; break; + } case IPPROTO_ICMP: - icmpstat.icps_checksum++; + { + INIT_VNET_INET(curvnet); + V_icmpstat.icps_checksum++; break; + } #ifdef INET6 case IPPROTO_ICMPV6: - icmp6stat.icp6s_checksum++; + { + INIT_VNET_INET6(curvnet); + V_icmp6stat.icp6s_checksum++; break; + } #endif /* INET6 */ } return (1); ==== //depot/projects/vimage-devel/src/sys/contrib/pf/net/pf_if.c#2 (text+ko) ==== @@ -35,6 +35,7 @@ #if defined(__FreeBSD__) #include "opt_inet.h" #include "opt_inet6.h" +#include "opt_vimage.h" #include <sys/cdefs.h> __FBSDID("$FreeBSD: src/sys/contrib/pf/net/pf_if.c,v 1.15 2008/03/29 00:24:36 mlaier Exp $"); @@ -54,9 +55,11 @@ #include <sys/device.h> #endif #include <sys/time.h> +#include <sys/vimage.h> #include <net/if.h> #include <net/if_types.h> +#include <net/vnet.h> #include <netinet/in.h> #include <netinet/in_var.h> @@ -109,8 +112,10 @@ void pfi_detach_group_event(void * __unused, struct ifg_group *); void pfi_ifaddr_event(void * __unused, struct ifnet *); +#ifndef VIMAGE extern struct ifgrouphead ifg_head; #endif +#endif RB_PROTOTYPE(pfi_ifhead, pfi_kif, pfik_tree, pfi_if_compare); RB_GENERATE(pfi_ifhead, pfi_kif, pfik_tree, pfi_if_compare); @@ -121,6 +126,7 @@ void pfi_initialize(void) { + INIT_VNET_NET(curvnet); if (pfi_all != NULL) /* already initialized */ return; @@ -141,9 +147,9 @@ struct ifnet *ifp; IFNET_RLOCK(); - TAILQ_FOREACH(ifg, &ifg_head, ifg_next) + TAILQ_FOREACH(ifg, &V_ifg_head, ifg_next) pfi_attach_ifgroup(ifg); - TAILQ_FOREACH(ifp, &ifnet, if_link) + TAILQ_FOREACH(ifp, &V_ifnet, if_link) pfi_attach_ifnet(ifp); IFNET_RUNLOCK(); ==== //depot/projects/vimage-devel/src/sys/contrib/pf/net/pf_ioctl.c#2 (text+ko) ==== @@ -38,6 +38,7 @@ #ifdef __FreeBSD__ #include "opt_inet.h" #include "opt_inet6.h" +#include "opt_vimage.h" #include <sys/cdefs.h> __FBSDID("$FreeBSD: src/sys/contrib/pf/net/pf_ioctl.c,v 1.33 2008/06/05 19:30:20 mlaier Exp $"); @@ -96,11 +97,14 @@ #ifndef __FreeBSD__ #include <sys/rwlock.h> #include <uvm/uvm_extern.h> +#else +#include <sys/vimage.h> #endif #include <net/if.h> #include <net/if_types.h> #include <net/route.h> +#include <net/vnet.h> #include <netinet/in.h> #include <netinet/in_var.h> @@ -3703,6 +3707,7 @@ pf_check6_in(void *arg, struct mbuf **m, struct ifnet *ifp, int dir, struct inpcb *inp) { + INIT_VNET_NET(curvnet); /* * IPv6 is not affected by ip_len/ip_off byte order changes. */ @@ -3713,7 +3718,7 @@ * order to support scoped addresses. In order to support stateful * filtering we have change this to lo0 as it is the case in IPv4. */ - chk = pf_test6(PF_IN, (*m)->m_flags & M_LOOP ? &loif[0] : ifp, m, + chk = pf_test6(PF_IN, (*m)->m_flags & M_LOOP ? &V_loif[0] : ifp, m, NULL, inp); if (chk && *m) { m_freem(*m); ==== //depot/projects/vimage-devel/src/sys/dev/ie/if_ie.c#2 (text+ko) ==== ==== //depot/projects/vimage-devel/src/sys/dev/syscons/daemon/daemon_saver.c#2 (text+ko) ==== @@ -28,6 +28,8 @@ * $FreeBSD: src/sys/dev/syscons/daemon/daemon_saver.c,v 1.24 2007/12/29 23:26:57 wkoszek Exp $ */ +#include "opt_vimage.h" + #include <sys/param.h> #include <sys/systm.h> #include <sys/module.h> @@ -36,6 +38,7 @@ #include <sys/sysctl.h> #include <sys/consio.h> #include <sys/fbio.h> +#include <sys/vimage.h> #include <machine/pc/display.h> @@ -350,10 +353,10 @@ static int daemon_init(video_adapter_t *adp) { - messagelen = strlen(hostname) + 3 + strlen(ostype) + 1 + + messagelen = strlen(G_hostname) + 3 + strlen(ostype) + 1 + strlen(osrelease); message = malloc(messagelen + 1, M_DEVBUF, M_WAITOK); - sprintf(message, "%s - %s %s", hostname, ostype, osrelease); + sprintf(message, "%s - %s %s", G_hostname, ostype, osrelease); blanked = 0; switch (adp->va_mode) { case M_PC98_80x25: ==== //depot/projects/vimage-devel/src/sys/i386/ibcs2/ibcs2_socksys.c#2 (text+ko) ==== @@ -23,6 +23,8 @@ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ +#include "opt_vimage.h" + #include <sys/cdefs.h> __FBSDID("$FreeBSD: src/sys/i386/ibcs2/ibcs2_socksys.c,v 1.22 2006/11/06 13:41:59 rwatson Exp $"); @@ -32,6 +34,7 @@ #include <sys/jail.h> #include <sys/kernel.h> #include <sys/sysctl.h> +#include <sys/vimage.h> #include <i386/ibcs2/ibcs2_socksys.h> #include <i386/ibcs2/ibcs2_util.h> @@ -171,15 +174,16 @@ struct thread *td; struct setipdomainname_args *uap; { + INIT_VPROCG(TD_TO_VPROCG(td)); char hname[MAXHOSTNAMELEN], *ptr; int error, sctl[2], hlen; /* W/out a hostname a domain-name is nonsense */ - if ( strlen(hostname) == 0 ) + if ( strlen(V_hostname) == 0 ) return EINVAL; /* Get the host's unqualified name (strip off the domain) */ - snprintf(hname, sizeof(hname), "%s", hostname); + snprintf(hname, sizeof(hname), "%s", V_hostname); ptr = index(hname, '.'); if ( ptr != NULL ) { ptr++; ==== //depot/projects/vimage-devel/src/sys/kern/kern_poll.c#2 (text+ko) ==== @@ -25,6 +25,8 @@ * SUCH DAMAGE. */ +#include "opt_vimage.h" + #include <sys/cdefs.h> __FBSDID("$FreeBSD: src/sys/kern/kern_poll.c,v 1.32 2008/03/16 10:58:05 rwatson Exp $"); @@ -37,9 +39,11 @@ #include <sys/sockio.h> #include <sys/sysctl.h> #include <sys/syslog.h> +#include <sys/vimage.h> #include <net/if.h> /* for IFF_* flags */ #include <net/netisr.h> /* for NETISR_POLL */ +#include <net/vnet.h> /* for ifnet pointer */ #include <sys/proc.h> #include <sys/resourcevar.h> @@ -522,6 +526,7 @@ static int poll_switch(SYSCTL_HANDLER_ARGS) { + INIT_VNET_NET(curvnet); struct ifnet *ifp; int error; int val = polling; @@ -539,7 +544,7 @@ polling = val; IFNET_RLOCK(); - TAILQ_FOREACH(ifp, &ifnet, if_link) { + TAILQ_FOREACH(ifp, &V_ifnet, if_link) { if (ifp->if_capabilities & IFCAP_POLLING) { struct ifreq ifr; ==== //depot/projects/vimage-devel/src/sys/net/bridgestp.c#2 (text+ko) ==== @@ -34,6 +34,8 @@ * ISO/IEC 802.1D-2004, June 9, 2004. */ +#include "opt_vimage.h" + #include <sys/cdefs.h> __FBSDID("$FreeBSD: src/sys/net/bridgestp.c,v 1.40 2007/12/09 20:47:12 thompsa Exp $"); @@ -49,12 +51,14 @@ #include <sys/lock.h> #include <sys/mutex.h> #include <sys/taskqueue.h> +#include <sys/vimage.h> #include <net/if.h> #include <net/if_dl.h> #include <net/if_types.h> #include <net/if_llc.h> #include <net/if_media.h> +#include <net/vnet.h> #include <netinet/in.h> #include <netinet/in_systm.h> @@ -2016,6 +2020,7 @@ void bstp_reinit(struct bstp_state *bs) { + INIT_VNET_NET(curvnet); struct bstp_port *bp; struct ifnet *ifp, *mif; u_char *e_addr; @@ -2031,7 +2036,7 @@ * value. */ IFNET_RLOCK(); - TAILQ_FOREACH(ifp, &ifnet, if_link) { + TAILQ_FOREACH(ifp, &V_ifnet, if_link) { if (ifp->if_type != IFT_ETHER) continue; ==== //depot/projects/vimage-devel/src/sys/net/if_bridge.c#2 (text+ko) ==== @@ -80,6 +80,7 @@ #include "opt_inet.h" #include "opt_inet6.h" #include "opt_carp.h" +#include "opt_vimage.h" #include <sys/param.h> #include <sys/mbuf.h> @@ -100,6 +101,7 @@ #include <sys/proc.h> #include <sys/lock.h> #include <sys/mutex.h> +#include <sys/vimage.h> #include <net/bpf.h> #include <net/if.h> @@ -113,10 +115,12 @@ #include <netinet/in_systm.h> #include <netinet/in_var.h> #include <netinet/ip.h> +#include <netinet/ip_fw.h> #include <netinet/ip_var.h> #ifdef INET6 #include <netinet/ip6.h> #include <netinet6/ip6_var.h> +#include <netinet6/vinet6.h> #endif #ifdef DEV_CARP #include <netinet/ip_carp.h> @@ -127,10 +131,12 @@ #include <net/if_bridgevar.h> #include <net/if_llc.h> #include <net/if_vlan_var.h> +#include <net/vnet.h> #include <net/route.h> #include <netinet/ip_fw.h> #include <netinet/ip_dummynet.h> +#include <netinet/vinet.h> /* * Size of the route hash table. Must be a power of two. @@ -2977,9 +2983,10 @@ } if (IPFW_LOADED && pfil_ipfw != 0 && dir == PFIL_OUT && ifp != NULL) { + INIT_VNET_IPFW(curvnet); error = -1; args.rule = ip_dn_claim_rule(*mp); - if (args.rule != NULL && fw_one_pass) + if (args.rule != NULL && V_fw_one_pass) goto ipfwpass; /* packet already partially processed */ args.m = *mp; @@ -3161,6 +3168,7 @@ static int bridge_ip_checkbasic(struct mbuf **mp) { + INIT_VNET_INET(curvnet); struct mbuf *m = *mp; struct ip *ip; int len, hlen; @@ -3173,12 +3181,12 @@ if ((m = m_copyup(m, sizeof(struct ip), (max_linkhdr + 3) & ~3)) == NULL) { /* XXXJRT new stat, please */ - ipstat.ips_toosmall++; + V_ipstat.ips_toosmall++; goto bad; } } else if (__predict_false(m->m_len < sizeof (struct ip))) { if ((m = m_pullup(m, sizeof (struct ip))) == NULL) { - ipstat.ips_toosmall++; + V_ipstat.ips_toosmall++; goto bad; } } @@ -3186,17 +3194,17 @@ if (ip == NULL) goto bad; if (ip->ip_v != IPVERSION) { - ipstat.ips_badvers++; + V_ipstat.ips_badvers++; goto bad; } hlen = ip->ip_hl << 2; if (hlen < sizeof(struct ip)) { /* minimum header length */ - ipstat.ips_badhlen++; + V_ipstat.ips_badhlen++; goto bad; } if (hlen > m->m_len) { if ((m = m_pullup(m, hlen)) == 0) { - ipstat.ips_badhlen++; + V_ipstat.ips_badhlen++; goto bad; } ip = mtod(m, struct ip *); @@ -3213,7 +3221,7 @@ } } if (sum) { - ipstat.ips_badsum++; + V_ipstat.ips_badsum++; goto bad; } @@ -3224,7 +3232,7 @@ * Check for additional length bogosity */ if (len < hlen) { - ipstat.ips_badlen++; + V_ipstat.ips_badlen++; goto bad; } @@ -3234,7 +3242,7 @@ * Drop packet if shorter than we expect. */ if (m->m_pkthdr.len < len) { - ipstat.ips_tooshort++; + V_ipstat.ips_tooshort++; goto bad; } @@ -3256,6 +3264,7 @@ static int bridge_ip6_checkbasic(struct mbuf **mp) { + INIT_VNET_INET6(curvnet); struct mbuf *m = *mp; struct ip6_hdr *ip6; @@ -3270,14 +3279,14 @@ if ((m = m_copyup(m, sizeof(struct ip6_hdr), (max_linkhdr + 3) & ~3)) == NULL) { /* XXXJRT new stat, please */ - ip6stat.ip6s_toosmall++; + V_ip6stat.ip6s_toosmall++; in6_ifstat_inc(inifp, ifs6_in_hdrerr); goto bad; } } else if (__predict_false(m->m_len < sizeof(struct ip6_hdr))) { struct ifnet *inifp = m->m_pkthdr.rcvif; if ((m = m_pullup(m, sizeof(struct ip6_hdr))) == NULL) { - ip6stat.ip6s_toosmall++; + V_ip6stat.ip6s_toosmall++; in6_ifstat_inc(inifp, ifs6_in_hdrerr); goto bad; } @@ -3286,7 +3295,7 @@ ip6 = mtod(m, struct ip6_hdr *); if ((ip6->ip6_vfc & IPV6_VERSION_MASK) != IPV6_VERSION) { - ip6stat.ip6s_badvers++; + V_ip6stat.ip6s_badvers++; in6_ifstat_inc(m->m_pkthdr.rcvif, ifs6_in_hdrerr); goto bad; } @@ -3346,8 +3355,10 @@ m_freem(m); } - if (error == 0) - ipstat.ips_fragmented++; + if (error == 0) { + INIT_VNET_INET(curvnet); + V_ipstat.ips_fragmented++; + } return (error); ==== //depot/projects/vimage-devel/src/sys/net/if_ef.c#2 (text+ko) ==== @@ -29,6 +29,7 @@ #include "opt_inet.h" #include "opt_ipx.h" #include "opt_ef.h" +#include "opt_vimage.h" #include <sys/param.h> #include <sys/systm.h> @@ -39,6 +40,7 @@ #include <sys/syslog.h> #include <sys/kernel.h> #include <sys/module.h> +#include <sys/vimage.h> #include <net/ethernet.h> #include <net/if_llc.h> @@ -49,6 +51,7 @@ #include <net/netisr.h> #include <net/route.h> #include <net/bpf.h> +#include <net/vnet.h> #ifdef INET #include <netinet/in.h> @@ -489,35 +492,40 @@ int error = 0, d; IFNET_RLOCK(); - TAILQ_FOREACH(ifp, &ifnet, if_link) { - if (ifp->if_type != IFT_ETHER) continue; - EFDEBUG("Found interface %s\n", ifp->if_xname); - efl = (struct ef_link*)malloc(sizeof(struct ef_link), - M_IFADDR, M_WAITOK | M_ZERO); - if (efl == NULL) { - error = ENOMEM; - break; - } + { + VNET_ITERLOOP_BEGIN_QUIET(); + INIT_VNET_NET(curvnet); + TAILQ_FOREACH(ifp, &V_ifnet, if_link) { + if (ifp->if_type != IFT_ETHER) continue; + EFDEBUG("Found interface %s\n", ifp->if_xname); + efl = (struct ef_link*)malloc(sizeof(struct ef_link), + M_IFADDR, M_WAITOK | M_ZERO); + if (efl == NULL) { + error = ENOMEM; + break; + } - efl->el_ifp = ifp; >>> TRUNCATED FOR MAIL (1000 lines) <<<
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200807040836.m648aSre063240>