From owner-p4-projects@FreeBSD.ORG Thu Oct 25 05:25:34 2007 Return-Path: Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id 5B43016A41A; Thu, 25 Oct 2007 05:25:34 +0000 (UTC) Delivered-To: perforce@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id D663D16A421 for ; Thu, 25 Oct 2007 05:25:33 +0000 (UTC) (envelope-from julian@elischer.org) Received: from outR.internet-mail-service.net (outR.internet-mail-service.net [216.240.47.241]) by mx1.freebsd.org (Postfix) with ESMTP id B87F313C4A3 for ; Thu, 25 Oct 2007 05:25:33 +0000 (UTC) (envelope-from julian@elischer.org) Received: from mx0.idiom.com (HELO idiom.com) (216.240.32.160) by out.internet-mail-service.net (qpsmtpd/0.40) with ESMTP; Wed, 24 Oct 2007 22:25:32 -0700 X-Client-Authorized: MaGic Cook1e X-Client-Authorized: MaGic Cook1e Received: from julian-mac.elischer.org (home.elischer.org [216.240.48.38]) by idiom.com (Postfix) with ESMTP id 7E7771267E4; Wed, 24 Oct 2007 22:25:31 -0700 (PDT) Message-ID: <472028E6.6090809@elischer.org> Date: Wed, 24 Oct 2007 22:25:58 -0700 From: Julian Elischer User-Agent: Thunderbird 2.0.0.6 (Macintosh/20070728) MIME-Version: 1.0 To: Marko Zec References: <200710250015.l9P0FXwh015801@repoman.freebsd.org> In-Reply-To: <200710250015.l9P0FXwh015801@repoman.freebsd.org> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Cc: Perforce Change Reviews Subject: Re: PERFORCE change 128041 for review X-BeenThere: p4-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: p4 projects tree changes List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 25 Oct 2007 05:25:34 -0000 Marko Zec wrote: > http://perforce.freebsd.org/chv.cgi?CH=128041 > > Change 128041 by zec@zec_tpx32 on 2007/10/25 00:15:01 > > A hack to allow for bpf taps to be open directly on ifnets > attached to foreign vnets. > > ifname@vimage_name is the form that should be used for > tcpdump or ethereal to attach directly to an ifnet in > a foerign vnet. > by definition it would have to be a child vnet right? > Affected files ... > > .. //depot/projects/vimage/src/sys/net/bpf.c#15 edit > > Differences ... > > ==== //depot/projects/vimage/src/sys/net/bpf.c#15 (text+ko) ==== > > @@ -1156,9 +1156,32 @@ > struct bpf_if *bp; > struct ifnet *theywant; > > +#define IMUNES_BPF_HACK > +#if defined(VIMAGE) && defined(IMUNES_BPF_HACK) > + struct vnet *target_vnet = curvnet; > + char *c; > + > + /* Hack to support tapping in foreign vnets */ > + c = rindex(ifr->ifr_name, '@'); > + if ( c != NULL ) { > + struct vimage *target_vimage; > + > + *c++ = 0; > + target_vimage = vimage_by_name(TD_TO_VIMAGE(curthread), c); > + if (target_vimage == NULL) > + return ENXIO; > + target_vnet = target_vimage->v_net; > + } > + CURVNET_SET_QUIET(target_vnet); > +#endif > + > theywant = ifunit(ifr->ifr_name); > - if (theywant == NULL || theywant->if_bpf == NULL) > + if (theywant == NULL || theywant->if_bpf == NULL) { > +#if defined(VIMAGE) && defined(IMUNES_BPF_HACK) > + CURVNET_RESTORE(); > +#endif > return (ENXIO); > + } > > bp = theywant->if_bpf; > /* > @@ -1180,6 +1203,9 @@ > BPFD_LOCK(d); > reset_d(d); > BPFD_UNLOCK(d); > +#if defined(VIMAGE) && defined(IMUNES_BPF_HACK) > + CURVNET_RESTORE(); > +#endif > return (0); > } >