From owner-freebsd-virtualization@FreeBSD.ORG Thu Feb 3 11:06:47 2011 Return-Path: Delivered-To: freebsd-virtualization@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 9A403106564A for ; Thu, 3 Feb 2011 11:06:47 +0000 (UTC) (envelope-from monthadar@gmail.com) Received: from mail-wy0-f182.google.com (mail-wy0-f182.google.com [74.125.82.182]) by mx1.freebsd.org (Postfix) with ESMTP id 2382D8FC08 for ; Thu, 3 Feb 2011 11:06:46 +0000 (UTC) Received: by wyf19 with SMTP id 19so1010370wyf.13 for ; Thu, 03 Feb 2011 03:06:46 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:in-reply-to:references:date :message-id:subject:from:to:cc:content-type :content-transfer-encoding; bh=olUTCzIRbzePULxNSVrBYZBiaTPF4uIlXhtzCK7/kW0=; b=gqjGApmMhFRlPpR5p3ezokvUDbUhe/w0NTtfQoFrsEW71r7vtXFPwbLumLKt8pXWaZ qS0WddvbfETIDmP1r1CEEoZBNn3/kX3lf/7kKYqwBFCNcmBCz0orOd7kKidt3p3a/fKf o3sIzI6ob45XywdxopZUKsQxBbkdq92kAG52k= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type:content-transfer-encoding; b=ArmZ/fIfXU/2T2R5MRbCFVsMM6I4g4PSt2KFirq8D4dxhyV7rB3H11mIFRfpZUZq8G AKj2QqVMV27hbi42rNjHm1sGIBvSFW6zLak9FLkF3ddpDqwyGPaPRiBfrIzoSYhI58Jw 4Nt4iJ/q/W2S7DP9FzPoTLZHqzMjAylEiDMH0= MIME-Version: 1.0 Received: by 10.227.167.8 with SMTP id o8mr10379183wby.166.1296731205965; Thu, 03 Feb 2011 03:06:45 -0800 (PST) Received: by 10.227.134.137 with HTTP; Thu, 3 Feb 2011 03:06:45 -0800 (PST) In-Reply-To: <20110203105747.K80258@maildrop.int.zabbadoz.net> References: <4D484213.6050100@freebsd.org> <4D486108.5060805@freebsd.org> <20110202164827.I80258@maildrop.int.zabbadoz.net> <4D4994CE.2090209@freebsd.org> <4D49AB29.7070909@freebsd.org> <20110203095019.N80258@maildrop.int.zabbadoz.net> <20110203105747.K80258@maildrop.int.zabbadoz.net> Date: Thu, 3 Feb 2011 12:06:45 +0100 Message-ID: From: Monthadar Al Jaberi To: "Bjoern A. Zeeb" Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Cc: FreeBSD virtualization mailing list Subject: Re: simulating wireless device (if_alloc panic, VirtualBox, VIMAGE) X-BeenThere: freebsd-virtualization@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Discussion of various virtualization techniques FreeBSD supports." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 03 Feb 2011 11:06:47 -0000 On Thu, Feb 3, 2011 at 11:59 AM, Bjoern A. Zeeb wrote: > On Thu, 3 Feb 2011, Monthadar Al Jaberi wrote: > >>>>> I don't understand why you saw a CRED_TO_VNET of 0 >>>>> I was under the impression that every process/thread in the system >>>>> would >>>>> be >>>>> on vnet0 >>>>> in a vimage kernel. >>>> >>>> This is how my printf looks like: >>>> struct thread *td =3D curthread; >>>> struct vnet *v =3D TD_TO_VNET(td); >>>> struct ucred *cred =3D CRED_TO_VNET(td->ucred); >>>> struct vnet *td_vnet =3D td->td_vnet; >>> >>> here's your problem: >>> >>> strcut vnet *vnet =3D cred->cr_prison->pr_vnet; >> >> When I add CURVNET_SET(CRED_TO_VNET(curthread->td_ucred)); I get a panic >> too... >> But your suggestion works if I do like this: >> curthread->td_vnet =3D curthread->td_ucred->cr_prison->pr_vnet; >> >> CRED_TO_VNET(curthread->td_ucred) returns NULL > > I wonder how you are building your module and if VIMAGE is properly > defined. =A0If it's not that would explain a lot of things. I have put options VIMAGE, rebuild both world and kernel. I can create jails with vnet options... I build my module with the standard Makefile for modules: ... KMOD =3D wtap ... SRCS =3D if_wtap_module.c if_wtap.c if_medium.c hal.c .include > > >>>> printf("td=3D%p, td->td_vnet=3D%p, td->td_ucred=3D%p, TD_TO_VNET=3D%p, >>>> CRED_TO_VNET=3D%p\n", td, td_vnet, td->td_ucred, v, cred); >>>> >>>> I made a fast search in /usr/src for "td_vnet" and found it was >>>> assigned only in >>>> int fork1(td, flags, pages, procp): >>>> #ifdef VIMAGE >>>> =A0 =A0 =A0 =A0td2->td_vnet =3D NULL; >>>> =A0 =A0 =A0 =A0td2->td_vnet_lpush =3D NULL; >>>> #endif >>> >>> Nice try. =A0Want another search? =A0Hint: there is this in vnet.h: >>> >>> #define curvnet curthread->td_vnet >>> >>> And then you'll, again, find the CURVNET_SET_* macros. >> >> Thank you > > Something you may find useful as well btw is: > > http://people.freebsd.org/~bz/20100530-02.vnet.9.html weired compiler complains about that there is no , I include maybe old documentation? > > -- > Bjoern A. Zeeb =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 = =A0 =A0 You have to have visions! > =A0 =A0 =A0 =A0 Going to jail sucks -- All my daemons like it! > =A0http://www.freebsd.org/doc/en_US.ISO8859-1/books/handbook/jails.html --=20 //Monthadar Al Jaberi