From owner-freebsd-emulation@FreeBSD.ORG Wed Jan 26 09:20:09 2011 Return-Path: Delivered-To: freebsd-emulation@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 0DF0B1065673; Wed, 26 Jan 2011 09:20:09 +0000 (UTC) (envelope-from bzeeb-lists@lists.zabbadoz.net) Received: from mail.cksoft.de (mail.cksoft.de [IPv6:2001:4068:10::3]) by mx1.freebsd.org (Postfix) with ESMTP id 80A3D8FC13; Wed, 26 Jan 2011 09:20:08 +0000 (UTC) Received: from localhost (amavis.fra.cksoft.de [192.168.74.71]) by mail.cksoft.de (Postfix) with ESMTP id 5AA9741C72F; Wed, 26 Jan 2011 10:20:07 +0100 (CET) X-Virus-Scanned: amavisd-new at cksoft.de Received: from mail.cksoft.de ([192.168.74.103]) by localhost (amavis.fra.cksoft.de [192.168.74.71]) (amavisd-new, port 10024) with ESMTP id OFad-UFQoGtt; Wed, 26 Jan 2011 10:20:06 +0100 (CET) Received: by mail.cksoft.de (Postfix, from userid 66) id 77FBE41C72C; Wed, 26 Jan 2011 10:20:06 +0100 (CET) Received: from maildrop.int.zabbadoz.net (maildrop.int.zabbadoz.net [10.111.66.10]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mail.int.zabbadoz.net (Postfix) with ESMTP id C2F314448F3; Wed, 26 Jan 2011 09:15:46 +0000 (UTC) Date: Wed, 26 Jan 2011 09:15:46 +0000 (UTC) From: "Bjoern A. Zeeb" X-X-Sender: bz@maildrop.int.zabbadoz.net To: Mikolaj Golub In-Reply-To: <86tygwy9p0.fsf@kopusha.home.net> Message-ID: <20110126091038.C3489@maildrop.int.zabbadoz.net> References: <86oc77heqk.fsf@kopusha.home.net> <4D3D2DE9.2060004@freebsd.org> <86tygwy9p0.fsf@kopusha.home.net> X-OpenPGP-Key: 0x14003F198FEFA3E77207EE8D2B58B8F83CCF1842 MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed Cc: freebsd-emulation@freebsd.org, FreeBSD virtualization mailing list Subject: Re: VirtualBox + VIMAGE X-BeenThere: freebsd-emulation@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Development of Emulators of other operating systems List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 26 Jan 2011 09:20:09 -0000 On Tue, 25 Jan 2011, Mikolaj Golub wrote: > > On Sun, 23 Jan 2011 23:44:41 -0800 Julian Elischer wrote: > > JE> On 1/23/11 6:33 AM, Mikolaj Golub wrote: > > >> As a quick fix I added in VBoxNetFlt-freebsd.c in all "problem" functions > >> CURVNET_SET_QUIET(vnet0) macro, which sets td->td_vnet to default vnet (see the > >> attached patch). This has fixed the issue for me and now I am happily running > >> both VNET jails and VirtualBox machines on my desktop. > >> > >> But the way I fixed the issue looks hackish for me. Could someone suggest a > >> better solution? > JE> this is probably at east partially the correct solution. > JE> Usually you should also set the value back to its previous value when > JE> you leave that code as well. > > Thank you for the comments. Actually the patch contained CURVNET_RESTORE() > too. I just did not mentioned it :-). So if it looks like right solution here > is an "improved" version of the patch: vnet to switch is taken from thread's > ucred (on interface initialization) or from ifp->if_vnet. > > >> In case someone is interested in trying this patch, below are the instructions > >> how to build "VIMAGE safe" vbox driver from ports: > >> > >> cd /usr/ports/emulators/virtualbox-ose-kmod > >> make patch > >> cd work > >> patch -p0< /path/to/VirtualBox-3.2.12.VIMAGE.patch > >> cd .. > >> VIMAGE=1 make I think you should wrap the CURVNET changes in __FreeBSD_version checks so that the port, should it run elsewhere or on older FreeBSDs (if it runs there) not trouble people having to patch it away. #if defined(__FreeBSD_version) && __FreeBSD_version >= 800500 #endif might be a save bet. /bz -- Bjoern A. Zeeb You have to have visions! Going to jail sucks -- All my daemons like it! http://www.freebsd.org/doc/en_US.ISO8859-1/books/handbook/jails.html