From owner-freebsd-emulation@FreeBSD.ORG Sun Aug 23 09:16:30 2009 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 AD635106568D; Sun, 23 Aug 2009 09:16:30 +0000 (UTC) (envelope-from Alexander.Eichner@Sun.COM) Received: from gmp-eb-inf-1.sun.com (gmp-eb-inf-1.sun.com [192.18.6.21]) by mx1.freebsd.org (Postfix) with ESMTP id 50ED38FC12; Sun, 23 Aug 2009 09:16:30 +0000 (UTC) Received: from fe-emea-09.sun.com (gmp-eb-lb-1-fe1.eu.sun.com [192.18.6.7] (may be forged)) by gmp-eb-inf-1.sun.com (8.13.7+Sun/8.12.9) with ESMTP id n7N9GTPk000380; Sun, 23 Aug 2009 09:16:29 GMT MIME-version: 1.0 Content-transfer-encoding: 7BIT Content-type: text/plain Received: from conversion-daemon.fe-emea-09.sun.com by fe-emea-09.sun.com (Sun Java(tm) System Messaging Server 7u2-7.04 64bit (built Jul 2 2009)) id <0KOT00C00OBFJ400@fe-emea-09.sun.com>; Sun, 23 Aug 2009 10:16:08 +0100 (BST) Received: from [192.168.2.100] ([unknown] [87.187.205.183]) by fe-emea-09.sun.com (Sun Java(tm) System Messaging Server 7u2-7.04 64bit (built Jul 2 2009)) with ESMTPSA id <0KOT00IXUOEUPA60@fe-emea-09.sun.com>; Sun, 23 Aug 2009 10:16:07 +0100 (BST) Date: Sun, 23 Aug 2009 11:16:04 +0200 From: Alexander Eichner In-reply-to: <20090822123611.GA8594@triton8.kn-bremen.de> Sender: Alexander.Eichner@Sun.COM To: Juergen Lock Message-id: <1251018964.4475.10.camel@Hatak> X-Mailer: Evolution 2.26.1 References: <20090819185448.GA8386@triton8.kn-bremen.de> <20090822123611.GA8594@triton8.kn-bremen.de> Cc: vbox-dev@virtualbox.org, freebsd-emulation@FreeBSD.org, "Sean C. Farley" , Juergen Lock Subject: Re: [vbox-dev] tuntap hacks for FreeBSD vbox hosts (bandaid till vbox-net driver...) 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: Sun, 23 Aug 2009 09:16:30 -0000 Hi Juergen, thank for you very much for the tuntap patch. I would like to integrate it in the in the main VirtualBox repository but you didn't specified the license the patch is under. To integrate it you either need to sign the SCA or put it under the MIT license. More information regarding the SCA is here http://www.virtualbox.org/wiki/ICA . The above is valid for the vboxnetflt driver too :) Regards, Alexander Eichner Am Samstag, den 22.08.2009, 14:36 +0200 schrieb Juergen Lock: > On Thu, Aug 20, 2009 at 03:19:36PM -0500, Sean C. Farley wrote: > > On Wed, 19 Aug 2009, Juergen Lock wrote: > > > > > Hi! > > > > > > After inquiring on the #vbox-dev channel whether the tuntap code could > > > be resurrected for hosts that don't have vbox net/bridge drivers yet > > > (like FreeBSD :) I now got it working - except the config gui and > > > ifup/down scripts, the code for at least the latter seems to have been > > > ripped out for good indeed... So for now you have to use VBoxManage > > > something like this, > > > VBoxManage modifyvm --nic1 bridged --bridgeadapter1 tap0 > > > and manually configure your tap interface and (optionally) add it to a > > > bridge before the VM starts. If you already have setup your host > > > system to use tuntap networking with qemu you probably can just > > > chown/chmod /dev/tap0 (or whichever one you use) to 660 root:vboxusers > > > and then run your /usr/local/etc/qemu-ifup script with the same tap > > > interface as arg, otherwise do something like... > > > kldload if_tap if_bridge > > > sysctl net.link.tap.user_open=1 > > > chown root:vboxusers /dev/tap0 > > > chmod 660 /dev/tap0 > > > ifconfig bridge0 create > > > ifconfig bridge0 addm > > > ifconfig tap0 netmask > > > ifconfig bridge0 addm tap0 > > > and then start the guest. (You'll have to rerun the `ifconfig tap0 > > > ...' each time before you start the guest again.) > > > > Thank you! I had started looking at the code to try to figure out why I > > could not force the use of a tap device via VBoxManage. This patch > > works for me with FreeBSD 7-STABLE. > > > > BTW, you should not need the ifconfig tap0 line above since the VM is > > getting or setting its own IP. Is there a reason to do it? > > > I was about to explain how I needed it for the guest to be able > to talk to the host here, but - turns out this was just due to me > using pf on this box and the rules were a little broken. So yes it is > not really necessary... > > > If you want it to have it look even more authenticate, you can always > > rename the tap device to vboxnet0 with ifconfig. :) > > > Haha! :) > > Btw, seems my patch has reached its ultimate goal much more quickly > than I expected: Motivating someone to implement `proper' FreeBSD vbox > net drivers: > http://lists.freebsd.org/pipermail/freebsd-emulation/2009-August/006701.html > > Thank you Fredrik!! :) > > Juergen > > _______________________________________________ > vbox-dev mailing list > vbox-dev@virtualbox.org > http://vbox.innotek.de/mailman/listinfo/vbox-dev From owner-freebsd-emulation@FreeBSD.ORG Sun Aug 23 13:47:23 2009 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 5F2E61065672; Sun, 23 Aug 2009 13:47:23 +0000 (UTC) (envelope-from vbox-devel-l@jelal.kn-bremen.de) Received: from smtp.kn-bremen.de (gelbbaer.kn-bremen.de [78.46.108.116]) by mx1.freebsd.org (Postfix) with ESMTP id 184198FC0A; Sun, 23 Aug 2009 13:47:22 +0000 (UTC) Received: by smtp.kn-bremen.de (Postfix, from userid 10) id A86251E00360; Sun, 23 Aug 2009 15:47:21 +0200 (CEST) Received: from triton8.kn-bremen.de (noident@localhost [127.0.0.1]) by triton8.kn-bremen.de (8.14.3/8.14.3) with ESMTP id n7NDfx7s078253; Sun, 23 Aug 2009 15:41:59 +0200 (CEST) (envelope-from nox@triton8.kn-bremen.de) Received: (from nox@localhost) by triton8.kn-bremen.de (8.14.3/8.14.3/Submit) id n7NDfwNH078246; Sun, 23 Aug 2009 15:41:58 +0200 (CEST) (envelope-from nox) From: Juergen Lock Date: Sun, 23 Aug 2009 15:41:58 +0200 To: Alexander Eichner Message-ID: <20090823134158.GB96781@triton8.kn-bremen.de> References: <20090819185448.GA8386@triton8.kn-bremen.de> <20090822123611.GA8594@triton8.kn-bremen.de> <1251018964.4475.10.camel@Hatak> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1251018964.4475.10.camel@Hatak> User-Agent: Mutt/1.5.20 (2009-06-14) Cc: vbox-dev@virtualbox.org, Juergen Lock , Juergen Lock , freebsd-emulation@FreeBSD.org, "Sean C. Farley" Subject: Re: [vbox-dev] tuntap hacks for FreeBSD vbox hosts (bandaid till vbox-net driver...) 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: Sun, 23 Aug 2009 13:47:23 -0000 On Sun, Aug 23, 2009 at 11:16:04AM +0200, Alexander Eichner wrote: > Hi Juergen, Hi! > > thank for you very much for the tuntap patch. I would like to integrate > it in the in the main VirtualBox repository but you didn't specified the > license the patch is under. > To integrate it you either need to sign the SCA or put it under the MIT > license. More information regarding the SCA is here > http://www.virtualbox.org/wiki/ICA . > Oh, I'm fine with the MIT license. Do need to repost the patch? > The above is valid for the vboxnetflt driver too :) Btw there seems to be another FreeBSD host patch still pending wrt raw vmdk creation: http://vbox.innotek.de/pipermail/vbox-dev/2009-June/001477.html (And I later found out there is a ticket with a similar patch too: http://www.virtualbox.org/ticket/4269 ) Just thought I'd mention... :) Juergen From owner-freebsd-emulation@FreeBSD.ORG Sun Aug 23 15:56:38 2009 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 A96F710656A3 for ; Sun, 23 Aug 2009 15:56:38 +0000 (UTC) (envelope-from mlobo@digiart.art.br) Received: from sv4.hmnoc.net (sv4.hmnoc.net [72.233.57.166]) by mx1.freebsd.org (Postfix) with ESMTP id 838DB8FC1C for ; Sun, 23 Aug 2009 15:56:38 +0000 (UTC) Received: from [189.81.43.143] (helo=papi) by sv4.hmnoc.net with esmtpa (Exim 4.69) (envelope-from ) id 1MfFV3-0002gP-4k; Sun, 23 Aug 2009 13:00:57 -0300 From: Mario Lobo Organization: DigiArt Systems To: freebsd-emulation@freebsd.org Date: Sun, 23 Aug 2009 12:57:08 -0300 User-Agent: KMail/1.9.10 References: <20090819185448.GA8386@triton8.kn-bremen.de> <20090822123611.GA8594@triton8.kn-bremen.de> <1251018964.4475.10.camel@Hatak> In-Reply-To: <1251018964.4475.10.camel@Hatak> MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-Id: <200908231257.09375.mlobo@digiart.art.br> X-AntiAbuse: This header was added to track abuse, please include it with any abuse report X-AntiAbuse: Primary Hostname - sv4.hmnoc.net X-AntiAbuse: Original Domain - freebsd.org X-AntiAbuse: Originator/Caller UID/GID - [47 12] / [47 12] X-AntiAbuse: Sender Address Domain - digiart.art.br X-Source: X-Source-Args: X-Source-Dir: Cc: Alexander Eichner , vbox-dev@virtualbox.org, Juergen Lock , Juergen Lock Subject: Re: [vbox-dev] tuntap hacks for FreeBSD vbox hosts (bandaid till vbox-net driver...) 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: Sun, 23 Aug 2009 15:56:38 -0000 On Sunday 23 August 2009 06:16:04 Alexander Eichner wrote: > Hi Juergen, > > thank for you very much for the tuntap patch. I would like to integrate > it in the in the main VirtualBox repository but you didn't specified the > license the patch is under. > To integrate it you either need to sign the SCA or put it under the MIT > license. More information regarding the SCA is here > http://www.virtualbox.org/wiki/ICA . > > The above is valid for the vboxnetflt driver too :) > > Regards, > Alexander Eichner May I suggest that Juergen's patch be added as a 6th "attached to:" type on the interface and VBoxManage? Maybe like: Attached to: Not Attached NAT Bridge Adapter Internal Network Host-only Network TAP Adapter TUN Adapter or TAP/TUN Adapter -- Mario Lobo http://www.mallavoodoo.com.br FreeBSD since version 2.2.8 [not Pro-Audio.... YET!!] (99,7% winedows FREE) From owner-freebsd-emulation@FreeBSD.ORG Sun Aug 23 16:45:50 2009 Return-Path: Delivered-To: emulation@hub.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 94A6E106568B; Sun, 23 Aug 2009 16:45:50 +0000 (UTC) (envelope-from bsam@FreeBSD.org) Received: from freefall.freebsd.org (freefall.freebsd.org [IPv6:2001:4f8:fff6::28]) by mx1.freebsd.org (Postfix) with ESMTP id 6963F8FC23; Sun, 23 Aug 2009 16:45:50 +0000 (UTC) Received: from freefall.freebsd.org (bsam@localhost [127.0.0.1]) by freefall.freebsd.org (8.14.3/8.14.3) with ESMTP id n7NGjo0R008641; Sun, 23 Aug 2009 16:45:50 GMT (envelope-from bsam@freefall.freebsd.org) Received: (from bsam@localhost) by freefall.freebsd.org (8.14.3/8.14.3/Submit) id n7NGjoXM008637; Sun, 23 Aug 2009 16:45:50 GMT (envelope-from bsam) Date: Sun, 23 Aug 2009 16:45:50 GMT Message-Id: <200908231645.n7NGjoXM008637@freefall.freebsd.org> To: codeblock@eighthbit.net, bsam@FreeBSD.org, emulation@FreeBSD.org From: bsam@FreeBSD.org Cc: Subject: Re: ports/138058: Update Port: audio/linux-f10-alsa-lib 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: Sun, 23 Aug 2009 16:45:50 -0000 Synopsis: Update Port: audio/linux-f10-alsa-lib State-Changed-From-To: open->closed State-Changed-By: bsam State-Changed-When: Sun Aug 23 16:43:23 UTC 2009 State-Changed-Why: Committed, thanks! Some changes were needed as well: 1) Fix pkg-plist. 2) Update distinfo for sources (one need to fetch and makesum with PACKAGE_BUILDING=YES). http://www.freebsd.org/cgi/query-pr.cgi?pr=138058 From owner-freebsd-emulation@FreeBSD.ORG Sun Aug 23 16:50:09 2009 Return-Path: Delivered-To: emulation@hub.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id B0F91106568E for ; Sun, 23 Aug 2009 16:50:09 +0000 (UTC) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (freefall.freebsd.org [IPv6:2001:4f8:fff6::28]) by mx1.freebsd.org (Postfix) with ESMTP id 9CFC28FC22 for ; Sun, 23 Aug 2009 16:50:09 +0000 (UTC) Received: from freefall.freebsd.org (gnats@localhost [127.0.0.1]) by freefall.freebsd.org (8.14.3/8.14.3) with ESMTP id n7NGo9Hn008746 for ; Sun, 23 Aug 2009 16:50:09 GMT (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.14.3/8.14.3/Submit) id n7NGo9Fh008745; Sun, 23 Aug 2009 16:50:09 GMT (envelope-from gnats) Date: Sun, 23 Aug 2009 16:50:09 GMT Message-Id: <200908231650.n7NGo9Fh008745@freefall.freebsd.org> To: emulation@FreeBSD.org From: dfilter@FreeBSD.ORG (dfilter service) Cc: Subject: Re: ports/138058: commit references a PR X-BeenThere: freebsd-emulation@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: dfilter service List-Id: Development of Emulators of other operating systems List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 23 Aug 2009 16:50:09 -0000 The following reply was made to PR ports/138058; it has been noted by GNATS. From: dfilter@FreeBSD.ORG (dfilter service) To: bug-followup@FreeBSD.org Cc: Subject: Re: ports/138058: commit references a PR Date: Sun, 23 Aug 2009 16:43:12 +0000 (UTC) bsam 2009-08-23 16:43:03 UTC FreeBSD ports repository Modified files: audio/linux-f10-alsa-lib Makefile distinfo.i386 pkg-plist Log: . update to version 1.0.20-1.fc10; [1] . update distinfo for sources as well; . fix pkg-plist. PR: ports/138058 [1] Submitted by: Rick Elrod [1] Revision Changes Path 1.13 +2 -2 ports/audio/linux-f10-alsa-lib/Makefile 1.8 +6 -6 ports/audio/linux-f10-alsa-lib/distinfo.i386 1.4 +5 -5 ports/audio/linux-f10-alsa-lib/pkg-plist _______________________________________________ cvs-all@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/cvs-all To unsubscribe, send any mail to "cvs-all-unsubscribe@freebsd.org" From owner-freebsd-emulation@FreeBSD.ORG Sun Aug 23 22:19:43 2009 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 06872106568C for ; Sun, 23 Aug 2009 22:19:43 +0000 (UTC) (envelope-from nox@jelal.kn-bremen.de) Received: from smtp.kn-bremen.de (gelbbaer.kn-bremen.de [78.46.108.116]) by mx1.freebsd.org (Postfix) with ESMTP id 899C08FC1D for ; Sun, 23 Aug 2009 22:19:42 +0000 (UTC) Received: by smtp.kn-bremen.de (Postfix, from userid 10) id 838281E0035F; Mon, 24 Aug 2009 00:19:41 +0200 (CEST) Received: from triton8.kn-bremen.de (noident@localhost [127.0.0.1]) by triton8.kn-bremen.de (8.14.3/8.14.3) with ESMTP id n7NMFrr0007705; Mon, 24 Aug 2009 00:15:53 +0200 (CEST) (envelope-from nox@triton8.kn-bremen.de) Received: (from nox@localhost) by triton8.kn-bremen.de (8.14.3/8.14.3/Submit) id n7NMFqkK007704; Mon, 24 Aug 2009 00:15:52 +0200 (CEST) (envelope-from nox) Date: Mon, 24 Aug 2009 00:15:52 +0200 (CEST) From: Juergen Lock Message-Id: <200908232215.n7NMFqkK007704@triton8.kn-bremen.de> To: gamato@users.sf.net X-Newsgroups: local.list.freebsd.emulation In-Reply-To: Organization: home Cc: freebsd-emulation@freebsd.org Subject: Re: Automagic bridged networking with QEMU (tap) 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: Sun, 23 Aug 2009 22:19:43 -0000 In article you write: >Hallo list, Hi! > >I spent a good portion of yesterday trying to find out how to change >from using user mode to bridged networking with QEMU on FreeBSD 7.2. >As I found a few how-to's of differing quality and I couldn't manage to >make it work for some time, I decided to share the final results of my >journey with you as I believe it may save someone a few hours or hair. > >The proposed solution does not need any manual steps and is fully >transparent to users (like user mode networking is). It does not even >permanently bridge your real NIC, only when necessary, which is good >because of some performance penalties when bridging. And you can run as >many guests as you want and it's all set up automagically. :-) > >OK, enough words, here's what to do: > >/boot/loader.conf[.local]: > if_bridge_load="YES" > if_tap_load="YES" > >/etc/sysctl.conf: > net.link.tap.up_on_open=1 > net.link.tap.user_open=1 > >/etc/devfs.rules: > [localrules=10] > add path 'tap*' mode 0660 > >/etc/rc.conf[.local]: > devfs_system_ruleset="localrules" > kqemu_enable="YES" > >/usr/local/etc/qemu-ifup -- custom script >/usr/local/etc/qemu-ifdown -- custom script > >--- /usr/local/etc/qemu-ifup > >#!/bin/sh ># ># /usr/local/etc/qemu-ifup : martinko [20-aug-2009] ># > >IFNAME=re0 > >for BRIDGE in $(ifconfig -a | grep '^bridge' | cut -d: -f1) >do > if [ -n "$(ifconfig "$BRIDGE" | grep -w "member: $IFNAME")" ] > then > echo "${0##*/}: Adding $1 as a member of $BRIDGE" > sudo /sbin/ifconfig "$BRIDGE" addm "$1" up > exit > fi >done > >BRIDGE="$(sudo /sbin/ifconfig bridge create)" >sudo /sbin/ifconfig "$BRIDGE" addm "$IFNAME" addm "$1" up >echo "${0##*/}: Created $BRIDGE and added $1 as a member" > >--- /usr/local/etc/qemu-ifdown > >#!/bin/sh ># ># /usr/local/etc/qemu-ifdown : martinko [20-aug-2009] ># > >for BRIDGE in $(ifconfig -a | grep '^bridge' | cut -d: -f1) >do > if [ -n "$(ifconfig "$BRIDGE" | grep -w "member: $1")" ] > then > if [ "$(ifconfig "$BRIDGE" | grep -c -w "member:")" -le 2 ] > then > echo "${0##*/}: Destroying $BRIDGE" > sudo /sbin/ifconfig "$BRIDGE" destroy > fi > echo "${0##*/}: Destroying $1" > sudo /sbin/ifconfig "$1" destroy > fi >done > >--- > >And that's all, folks! :) > >Enjoy and if you find a better solution please let me/us know. > >Cheers, > >Martin > >PS1: Of course change IFNAME in qemu-ifup according to your setup. >PS2: You man want/need to change the group in devfs.rules as well. I like the idea, but found it needs a patch to qemu or otherwise a KASSERT gets triggered in the tap driver (sys/net/if_tap.c:tap_destroy(), causing a `tapX flags is out of sync' panic if the driver is built with INVARIANTS) because the tap interface gets destroyed before its /dev/tap fd is closed: Index: qemu/net.c @@ -961,11 +961,12 @@ { TAPState *s = vc->opaque; - if (s->down_script[0]) - launch_script(s->down_script, s->down_script_arg, s->fd); - qemu_set_fd_handler(s->fd, NULL, NULL, NULL); close(s->fd); + + if (s->down_script[0]) + launch_script(s->down_script, s->down_script_arg, -1); + qemu_free(s); } I guess the driver could handle this condition more gracefully, but until then... Oh and I also found the ifdown script doesn't get called in all cases, like when you quit qemu via the monitor. Btw, can someone test this on 6.3? I'm wondering if we could ship these ifup/down scripts in the qemu port(s) by default, maybe with an rcvar added to enable them or something like that. (and the other config instructions in the pkg-message file.) If you don't mind... :) Thanx, Juergen From owner-freebsd-emulation@FreeBSD.ORG Sun Aug 23 23:49:49 2009 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 5BDBA106568D for ; Sun, 23 Aug 2009 23:49:49 +0000 (UTC) (envelope-from bakul@bitblocks.com) Received: from mail.bitblocks.com (mail.bitblocks.com [64.142.15.60]) by mx1.freebsd.org (Postfix) with ESMTP id 345858FC17 for ; Sun, 23 Aug 2009 23:49:48 +0000 (UTC) Received: from bitblocks.com (localhost.bitblocks.com [127.0.0.1]) by mail.bitblocks.com (Postfix) with ESMTP id 790325B2E; Sun, 23 Aug 2009 16:34:19 -0700 (PDT) To: Juergen Lock In-reply-to: Your message of "Mon, 24 Aug 2009 00:15:52 +0200." <200908232215.n7NMFqkK007704@triton8.kn-bremen.de> References: <200908232215.n7NMFqkK007704@triton8.kn-bremen.de> Comments: In-reply-to Juergen Lock message dated "Mon, 24 Aug 2009 00:15:52 +0200." Date: Sun, 23 Aug 2009 16:34:19 -0700 From: Bakul Shah Message-Id: <20090823233419.790325B2E@mail.bitblocks.com> Cc: freebsd-emulation@freebsd.org, gamato@users.sf.net Subject: Re: Automagic bridged networking with QEMU (tap) 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: Sun, 23 Aug 2009 23:49:49 -0000 I use something simpler that is perhaps less flexible but I find my machines don't have enough oomph to handle more than 3 or 4 qemu VMs! /boot/loader.conf if_tap_load="YES" # if_bridge will be autoloaded later /etc/rc.conf cloned_interfaces="bridge0" # create these interfaces on bootup autobridge_interfaces="bridge0" # autoconfigure these bridges autobridge_bridge0="tap* $eth" # $eth = eth interface you want bridged # if your machine has static ip address $ipaddr, with prefix length $len ifconfig_bridge0="inet $ipaddr/$len # if your machine is given a dynamic ip address #ifconfig_bridge0="DHCP" /etc/devfs.conf # create as many as you are likely to use own tap0 $user:$group # set to user/group of person invoking qemu own tap1 $user:$group own tap2 $user:$group own tap3 $user:$group /etc/sysctl.conf net.link.tap.user_open=1 net.link.tap.up_on_open=1 ln -s /usr/bin/true /etc/qemu-ifup ln -s /usr/bin/true /etc/qemu-ifdown Note that on a wifi only machine you are only allowed one mac address for the wifi link so bridging with VMs won't work and you need NAT but you can still bridge all your tap interfaces together. Also note that each qemu VM will need a unique mac address. On Mon, 24 Aug 2009 00:15:52 +0200 Juergen Lock wrote: > In article you write: > >Hallo list, > Hi! > > > >I spent a good portion of yesterday trying to find out how to change > >from using user mode to bridged networking with QEMU on FreeBSD 7.2. > >As I found a few how-to's of differing quality and I couldn't manage to > >make it work for some time, I decided to share the final results of my > >journey with you as I believe it may save someone a few hours or hair. > > > >The proposed solution does not need any manual steps and is fully > >transparent to users (like user mode networking is). It does not even > >permanently bridge your real NIC, only when necessary, which is good > >because of some performance penalties when bridging. And you can run as > >many guests as you want and it's all set up automagically. :-) > > > >OK, enough words, here's what to do: > > > >/boot/loader.conf[.local]: > > if_bridge_load="YES" > > if_tap_load="YES" > > > >/etc/sysctl.conf: > > net.link.tap.up_on_open=1 > > net.link.tap.user_open=1 > > > >/etc/devfs.rules: > > [localrules=10] > > add path 'tap*' mode 0660 > > > >/etc/rc.conf[.local]: > > devfs_system_ruleset="localrules" > > kqemu_enable="YES" > > > >/usr/local/etc/qemu-ifup -- custom script > >/usr/local/etc/qemu-ifdown -- custom script > > > >--- /usr/local/etc/qemu-ifup > > > >#!/bin/sh > ># > ># /usr/local/etc/qemu-ifup : martinko [20-aug-2009] > ># > > > >IFNAME=re0 > > > >for BRIDGE in $(ifconfig -a | grep '^bridge' | cut -d: -f1) > >do > > if [ -n "$(ifconfig "$BRIDGE" | grep -w "member: $IFNAME")" ] > > then > > echo "${0##*/}: Adding $1 as a member of $BRIDGE" > > sudo /sbin/ifconfig "$BRIDGE" addm "$1" up > > exit > > fi > >done > > > >BRIDGE="$(sudo /sbin/ifconfig bridge create)" > >sudo /sbin/ifconfig "$BRIDGE" addm "$IFNAME" addm "$1" up > >echo "${0##*/}: Created $BRIDGE and added $1 as a member" > > > >--- /usr/local/etc/qemu-ifdown > > > >#!/bin/sh > ># > ># /usr/local/etc/qemu-ifdown : martinko [20-aug-2009] > ># > > > >for BRIDGE in $(ifconfig -a | grep '^bridge' | cut -d: -f1) > >do > > if [ -n "$(ifconfig "$BRIDGE" | grep -w "member: $1")" ] > > then > > if [ "$(ifconfig "$BRIDGE" | grep -c -w "member:")" -le 2 ] > > then > > echo "${0##*/}: Destroying $BRIDGE" > > sudo /sbin/ifconfig "$BRIDGE" destroy > > fi > > echo "${0##*/}: Destroying $1" > > sudo /sbin/ifconfig "$1" destroy > > fi > >done > > > >--- > > > >And that's all, folks! :) > > > >Enjoy and if you find a better solution please let me/us know. > > > >Cheers, > > > >Martin > > > >PS1: Of course change IFNAME in qemu-ifup according to your setup. > >PS2: You man want/need to change the group in devfs.rules as well. > > I like the idea, but found it needs a patch to qemu or otherwise a > KASSERT gets triggered in the tap driver (sys/net/if_tap.c:tap_destroy(), > causing a `tapX flags is out of sync' panic if the driver is built with > INVARIANTS) because the tap interface gets destroyed before its /dev/tap > fd is closed: > > Index: qemu/net.c > @@ -961,11 +961,12 @@ > { > TAPState *s = vc->opaque; > > - if (s->down_script[0]) > - launch_script(s->down_script, s->down_script_arg, s->fd); > - > qemu_set_fd_handler(s->fd, NULL, NULL, NULL); > close(s->fd); > + > + if (s->down_script[0]) > + launch_script(s->down_script, s->down_script_arg, -1); > + > qemu_free(s); > } > > I guess the driver could handle this condition more gracefully, but > until then... Oh and I also found the ifdown script doesn't get called > in all cases, like when you quit qemu via the monitor. > > Btw, can someone test this on 6.3? I'm wondering if we could ship > these ifup/down scripts in the qemu port(s) by default, maybe with an > rcvar added to enable them or something like that. (and the other > config instructions in the pkg-message file.) If you don't mind... :) From owner-freebsd-emulation@FreeBSD.ORG Mon Aug 24 06:58:33 2009 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 D926C106568C for ; Mon, 24 Aug 2009 06:58:33 +0000 (UTC) (envelope-from freebsd-emulation@m.gmane.org) Received: from lo.gmane.org (lo.gmane.org [80.91.229.12]) by mx1.freebsd.org (Postfix) with ESMTP id 6969D8FC12 for ; Mon, 24 Aug 2009 06:58:33 +0000 (UTC) Received: from list by lo.gmane.org with local (Exim 4.50) id 1MfTVZ-0001X7-J9 for freebsd-emulation@freebsd.org; Mon, 24 Aug 2009 08:58:25 +0200 Received: from 200.41.broadband11.iol.cz ([90.178.41.200]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Mon, 24 Aug 2009 08:58:25 +0200 Received: from gamato by 200.41.broadband11.iol.cz with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Mon, 24 Aug 2009 08:58:25 +0200 X-Injected-Via-Gmane: http://gmane.org/ To: freebsd-emulation@freebsd.org From: martinko Date: Mon, 24 Aug 2009 08:58:02 +0200 Lines: 46 Message-ID: References: <200908232215.n7NMFqkK007704@triton8.kn-bremen.de> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-2; format=flowed Content-Transfer-Encoding: 7bit X-Complaints-To: usenet@ger.gmane.org X-Gmane-NNTP-Posting-Host: 200.41.broadband11.iol.cz User-Agent: Mozilla/5.0 (X11; U; FreeBSD i386; en-US; rv:1.8.1.18) Gecko/20081125 SeaMonkey/1.1.13 In-Reply-To: <200908232215.n7NMFqkK007704@triton8.kn-bremen.de> Sender: news Subject: Re: Automagic bridged networking with QEMU (tap) 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: Mon, 24 Aug 2009 06:58:33 -0000 Juergen Lock wrote: > > I like the idea, but found it needs a patch to qemu or otherwise a > KASSERT gets triggered in the tap driver (sys/net/if_tap.c:tap_destroy(), > causing a `tapX flags is out of sync' panic if the driver is built with > INVARIANTS) because the tap interface gets destroyed before its /dev/tap > fd is closed: > > Index: qemu/net.c > @@ -961,11 +961,12 @@ > { > TAPState *s = vc->opaque; > > - if (s->down_script[0]) > - launch_script(s->down_script, s->down_script_arg, s->fd); > - > qemu_set_fd_handler(s->fd, NULL, NULL, NULL); > close(s->fd); > + > + if (s->down_script[0]) > + launch_script(s->down_script, s->down_script_arg, -1); > + > qemu_free(s); > } > > I guess the driver could handle this condition more gracefully, but > until then... Oh and I also found the ifdown script doesn't get called > in all cases, like when you quit qemu via the monitor. > > Btw, can someone test this on 6.3? I'm wondering if we could ship > these ifup/down scripts in the qemu port(s) by default, maybe with an > rcvar added to enable them or something like that. (and the other > config instructions in the pkg-message file.) If you don't mind... :) Hallo Juergen, I certainly don't mind shipping those scripts of mine. Thank you for the patch, I wasn't aware of any panics, though I was thinking along the lines if it's ok to destroy a tap while Qemu apparently has got it open. I don't use Qemu monitor but I quess quitting from there should behave the same way and it's a Qemu bug if the scripts are not called, imho. Regards and thank you for all the work on Qemu port. Martin From owner-freebsd-emulation@FreeBSD.ORG Mon Aug 24 07:35:03 2009 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 B6F8D106568B for ; Mon, 24 Aug 2009 07:35:03 +0000 (UTC) (envelope-from freebsd-emulation@m.gmane.org) Received: from lo.gmane.org (lo.gmane.org [80.91.229.12]) by mx1.freebsd.org (Postfix) with ESMTP id 46C328FC18 for ; Mon, 24 Aug 2009 07:35:03 +0000 (UTC) Received: from list by lo.gmane.org with local (Exim 4.50) id 1MfU50-0004dR-7R for freebsd-emulation@freebsd.org; Mon, 24 Aug 2009 09:35:02 +0200 Received: from 200.41.broadband11.iol.cz ([90.178.41.200]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Mon, 24 Aug 2009 09:35:02 +0200 Received: from gamato by 200.41.broadband11.iol.cz with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Mon, 24 Aug 2009 09:35:02 +0200 X-Injected-Via-Gmane: http://gmane.org/ To: freebsd-emulation@freebsd.org From: martinko Date: Mon, 24 Aug 2009 09:34:39 +0200 Lines: 119 Message-ID: References: <200908232215.n7NMFqkK007704@triton8.kn-bremen.de> <20090823233419.790325B2E@mail.bitblocks.com> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-2; format=flowed Content-Transfer-Encoding: 7bit X-Complaints-To: usenet@ger.gmane.org X-Gmane-NNTP-Posting-Host: 200.41.broadband11.iol.cz User-Agent: Mozilla/5.0 (X11; U; FreeBSD i386; en-US; rv:1.8.1.18) Gecko/20081125 SeaMonkey/1.1.13 In-Reply-To: <20090823233419.790325B2E@mail.bitblocks.com> Sender: news Subject: Re: Automagic bridged networking with QEMU (tap) 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: Mon, 24 Aug 2009 07:35:03 -0000 Bakul Shah wrote: > I use something simpler that is perhaps less flexible but I > find my machines don't have enough oomph to handle more than > 3 or 4 qemu VMs! > > /boot/loader.conf > if_tap_load="YES" # if_bridge will be autoloaded later > > /etc/rc.conf > cloned_interfaces="bridge0" # create these interfaces on bootup > autobridge_interfaces="bridge0" # autoconfigure these bridges > autobridge_bridge0="tap* $eth" # $eth = eth interface you want bridged > > # if your machine has static ip address $ipaddr, with prefix length $len > ifconfig_bridge0="inet $ipaddr/$len > > # if your machine is given a dynamic ip address > #ifconfig_bridge0="DHCP" > > /etc/devfs.conf > # create as many as you are likely to use > own tap0 $user:$group # set to user/group of person invoking qemu > own tap1 $user:$group > own tap2 $user:$group > own tap3 $user:$group > > /etc/sysctl.conf > net.link.tap.user_open=1 > net.link.tap.up_on_open=1 > > ln -s /usr/bin/true /etc/qemu-ifup > ln -s /usr/bin/true /etc/qemu-ifdown Hi, I was thinking of using autobridge but eventually decided not to because: - Putting an interface into bridge has certain drawbacks like disabling checksum offloading. So I'd prefer not to bridge until I have to. - I'm not sure whether it's generally acceptable to autobridge all tap* devices. I might be OK with it now but I may not in the future and/or other users may have different uses of tap* devices. Problem with your devfs.conf is that it's static and thus the solution is sort of halfway between not using autobridging at all (precreating a few tap? devices and bridging them in rc.conf, like I found in many examples on the internet). Again, it may be OK for you and me but I was trying to find a more general solution. Also, I'm not sure how is it possible that it works for you at all. I tried "perm tap* 0660" but it did not work and then I learned devfs.conf is only good for interfaces available at boot. That's why I had to use /etc/devfs.rules config file. > Note that on a wifi only machine you are only allowed one mac > address for the wifi link so bridging with VMs won't work and > you need NAT but you can still bridge all your tap interfaces > together. Thanks for the note, I wasn't aware of this. Although I guess that if people run VMs on wifi connected machines they would be happy with user mode networking. > Also note that each qemu VM will need a unique mac address. Yes, this is true and I wrote another script to help me automate it. And MAC generation is "stolen" from you -- thank you for publishing! :-) Well, the script is not that general and polished but here it is: --- #!/bin/sh # # ~/bin/qemu_tap : mato [21-aug-2009] # # 1st parameter must be number of bridged NICs to create (tap interface) # 3rd parameter should be primary / boot disk (MACs are generated based on it) # [ "$1" -ge 0 ] || { echo "usage: ${0##*/} number_of_nics [qemu_options]" >&2 ; exit 1 ; } nics="$1" shift opts="$*" vlan=0 macaddr() { echo "52:54:00:$(echo "$1" | md5 | cut -c1-6 | sed 's/\(..\)\(..\)/\1:\2:/')" } while [ $vlan -lt "$nics" ] do opts="$opts -net nic,vlan=$vlan,macaddr=$(macaddr "$(realpath $2)-$vlan") -net tap,vlan=$vlan" vlan="$(expr $vlan + 1)" done exec qemu $opts --- I create a runscript for each VM I want to bridge as follows: $ cat img/matoqemu #!/bin/sh qemu_tap 1 -hda ~/img/matoqemu_winxp-pro-en-vlp.raw.img -name matoqemu/192.168.11.201 -alt-grab -kernel-kqemu -localtime -soundhw es1370 -m 256 "$@" For ad hoc VMs and ones I do not require to be bridged I happily use qemu-launcher (though I haven't tried anything else and I would certainly welcome port of qemuctl). With regards, Martin From owner-freebsd-emulation@FreeBSD.ORG Mon Aug 24 11:06:53 2009 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 4F2A61065692 for ; Mon, 24 Aug 2009 11:06:53 +0000 (UTC) (envelope-from owner-bugmaster@FreeBSD.org) Received: from freefall.freebsd.org (freefall.freebsd.org [IPv6:2001:4f8:fff6::28]) by mx1.freebsd.org (Postfix) with ESMTP id 3CFA28FC2D for ; Mon, 24 Aug 2009 11:06:53 +0000 (UTC) Received: from freefall.freebsd.org (localhost [127.0.0.1]) by freefall.freebsd.org (8.14.3/8.14.3) with ESMTP id n7OB6rlM048534 for ; Mon, 24 Aug 2009 11:06:53 GMT (envelope-from owner-bugmaster@FreeBSD.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.14.3/8.14.3/Submit) id n7OB6qP6048530 for freebsd-emulation@FreeBSD.org; Mon, 24 Aug 2009 11:06:52 GMT (envelope-from owner-bugmaster@FreeBSD.org) Date: Mon, 24 Aug 2009 11:06:52 GMT Message-Id: <200908241106.n7OB6qP6048530@freefall.freebsd.org> X-Authentication-Warning: freefall.freebsd.org: gnats set sender to owner-bugmaster@FreeBSD.org using -f From: FreeBSD bugmaster To: freebsd-emulation@FreeBSD.org Cc: Subject: Current problem reports assigned to freebsd-emulation@FreeBSD.org 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: Mon, 24 Aug 2009 11:06:53 -0000 Note: to view an individual PR, use: http://www.freebsd.org/cgi/query-pr.cgi?pr=(number). The following is a listing of current problems submitted by FreeBSD users. These represent problem reports covering all versions including experimental development code and obsolete releases. S Tracker Resp. Description -------------------------------------------------------------------------------- o ports/137332 emulation add caution messages to some adobe products f ports/136321 emulation x11-toolkits/linux-pango: please update linux based po o ports/136229 emulation [linux] certain linux apps look for libraries using a o ports/135337 emulation [PATCH] emulators/linux_base-f10: incorrect bash usage o ports/135322 emulation Port graphics/linux_dri has incorrect packaging list c o kern/130724 emulation [linprocfs] [patch] cpuinfo in linprocfs is dated, cau o kern/129169 emulation [linux] [patch] Linux Emulation ENOTCONN error using n f ports/127018 emulation Linuxulator incapable of using FreeBSD's LDAP environm o kern/126232 emulation [linux] Linux ioctl TCGETS (0x5401) always fails o kern/97326 emulation [linux] file descriptor leakage in linux emulation o kern/73777 emulation [linux] [patch] linux emulation: root dir special hand a kern/72920 emulation [linux]: path "prefixing" is not done on unix domain s o kern/56451 emulation [linprocfs] /compat/linux/proc/cpuinfo gives wrong CPU o kern/41543 emulation [patch] [request] easier wine/w23 support o kern/39201 emulation [linux] [patch] ptrace(2) and rfork(RFLINUXTHPN) confu o kern/29698 emulation [linux] [patch] linux ipcs doesn'work o kern/21463 emulation [linux] Linux compatability mode should not allow setu o kern/11165 emulation [ibcs2] IBCS2 doesn't work correctly with PID_MAX 9999 18 problems total. From owner-freebsd-emulation@FreeBSD.ORG Mon Aug 24 15:59:04 2009 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 3B9BF1065690 for ; Mon, 24 Aug 2009 15:59:04 +0000 (UTC) (envelope-from bakul@bitblocks.com) Received: from mail.bitblocks.com (ns1.bitblocks.com [64.142.15.60]) by mx1.freebsd.org (Postfix) with ESMTP id 1C4468FC1A for ; Mon, 24 Aug 2009 15:59:03 +0000 (UTC) Received: from bitblocks.com (localhost.bitblocks.com [127.0.0.1]) by mail.bitblocks.com (Postfix) with ESMTP id 0C9675B30; Mon, 24 Aug 2009 08:59:01 -0700 (PDT) To: martinko In-reply-to: Your message of "Mon, 24 Aug 2009 09:34:39 +0200." References: <200908232215.n7NMFqkK007704@triton8.kn-bremen.de> <20090823233419.790325B2E@mail.bitblocks.com> Comments: In-reply-to martinko message dated "Mon, 24 Aug 2009 09:34:39 +0200." Date: Mon, 24 Aug 2009 08:59:01 -0700 From: Bakul Shah Message-Id: <20090824155902.0C9675B30@mail.bitblocks.com> Cc: freebsd-emulation@freebsd.org Subject: Re: Automagic bridged networking with QEMU (tap) 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: Mon, 24 Aug 2009 15:59:04 -0000 On Mon, 24 Aug 2009 09:34:39 +0200 martinko wrote: > > I was thinking of using autobridge but eventually decided not to because: > - Putting an interface into bridge has certain drawbacks like disabling > checksum offloading. So I'd prefer not to bridge until I have to. > - I'm not sure whether it's generally acceptable to autobridge all tap* > devices. I might be OK with it now but I may not in the future and/or > other users may have different uses of tap* devices. > > Problem with your devfs.conf is that it's static and thus the solution > is sort of halfway between not using autobridging at all (precreating a > few tap? devices and bridging them in rc.conf, like I found in many > examples on the internet). Again, it may be OK for you and me but I was > trying to find a more general solution. There is no one solution that works for all. In any case we have to touch too many files and things like devfs.conf and devfs.rules are confusing so what would be most useful is a "wizard" script that asks some questions and modifies appropriate files to configure qemu. > Also, I'm not sure how is it possible that it works for you at all. I > tried "perm tap* 0660" but it did not work and then I learned > devfs.conf is only good for interfaces available at boot. It works fine for me. I think you have to use specific tap devices and not tap*. If you want the same behavior for additional tap devices created at run time, devfs.conf won't do. From owner-freebsd-emulation@FreeBSD.ORG Tue Aug 25 14:30:01 2009 Return-Path: Delivered-To: emulation@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 4C838106568B for ; Tue, 25 Aug 2009 14:30:01 +0000 (UTC) (envelope-from doconnor@gsoft.com.au) Received: from cain.gsoft.com.au (cain.gsoft.com.au [203.31.81.10]) by mx1.freebsd.org (Postfix) with ESMTP id B3DA38FC2E for ; Tue, 25 Aug 2009 14:30:00 +0000 (UTC) Received: from inchoate.gsoft.com.au (ppp121-45-154-162.lns11.adl6.internode.on.net [121.45.154.162]) (authenticated bits=0) by cain.gsoft.com.au (8.13.8/8.13.8) with ESMTP id n7PDv8O3033661 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES128-SHA bits=128 verify=NO); Tue, 25 Aug 2009 23:27:08 +0930 (CST) (envelope-from doconnor@gsoft.com.au) From: "Daniel O'Connor" To: emulation@freebsd.org Date: Tue, 25 Aug 2009 23:26:53 +0930 User-Agent: KMail/1.9.10 MIME-Version: 1.0 Content-Type: multipart/signed; boundary="nextPart1278801.IRVPc93Gfi"; protocol="application/pgp-signature"; micalg=pgp-sha1 Content-Transfer-Encoding: 7bit Message-Id: <200908252327.00701.doconnor@gsoft.com.au> X-Spam-Score: -1.538 () AWL,BAYES_00,RDNS_DYNAMIC X-Scanned-By: MIMEDefang 2.63 on 203.31.81.10 Cc: Subject: virtualbox port bug 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: Tue, 25 Aug 2009 14:30:01 -0000 --nextPart1278801.IRVPc93Gfi Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Content-Disposition: inline Hi, The Virtualbox port works fine except that the permissions=20 on /usr/local/lib/virtualbox appear to be too restrictive. I think it should be 755 (or 555, or perhaps 550 :vboxusers), but when I=20 install it, it's 700 and hence no-one except root can use it. Please CC me, I'm not on the list. =2D-=20 Daniel O'Connor software and network engineer for Genesis Software - http://www.gsoft.com.au "The nice thing about standards is that there are so many of them to choose from." -- Andrew Tanenbaum GPG Fingerprint - 5596 B766 97C0 0E94 4347 295E E593 DC20 7B3F CE8C --nextPart1278801.IRVPc93Gfi Content-Type: application/pgp-signature; name=signature.asc Content-Description: This is a digitally signed message part. -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.12 (FreeBSD) iD8DBQBKk+2s5ZPcIHs/zowRAiIlAJ0cC2ANhYdIQyd+8y7nQQPb8AxjYgCfam4T Bg22cxWoYKTlClQwJgZGjmM= =8Ce/ -----END PGP SIGNATURE----- --nextPart1278801.IRVPc93Gfi-- From owner-freebsd-emulation@FreeBSD.ORG Tue Aug 25 16:39:00 2009 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 078D2106568E for ; Tue, 25 Aug 2009 16:39:00 +0000 (UTC) (envelope-from rwatson@FreeBSD.org) Received: from cyrus.watson.org (cyrus.watson.org [65.122.17.42]) by mx1.freebsd.org (Postfix) with ESMTP id D5A5B8FC21 for ; Tue, 25 Aug 2009 16:38:59 +0000 (UTC) Received: from fledge.watson.org (fledge.watson.org [65.122.17.41]) by cyrus.watson.org (Postfix) with ESMTPS id 75BFC46B29; Tue, 25 Aug 2009 12:38:59 -0400 (EDT) Date: Tue, 25 Aug 2009 17:38:59 +0100 (BST) From: Robert Watson X-X-Sender: robert@fledge.watson.org To: Fredrik Lindberg In-Reply-To: <4A8EB3D2.7010109@shapeshifter.se> Message-ID: References: <4A8EB3D2.7010109@shapeshifter.se> User-Agent: Alpine 2.00 (BSF 1167 2008-08-23) MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed Cc: freebsd-emulation@freebsd.org Subject: Re: VirtualBox bridged adapter (vboxnetflt) 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: Tue, 25 Aug 2009 16:39:00 -0000 On Fri, 21 Aug 2009, Fredrik Lindberg wrote: > I've started working on the missing bits of the FreeBSD network > implementation in VirtualBox. > > I now have a working vboxnetflt.ko driver that allows automatic bridged > networking in VirtualBox (probably what most people want). This allows > guests to automatically bridge with your existing network adapter providing > seamless network access. > > Work on host-only adapter mode is in progress (this should not be confused > with host-interface in previous vbox 2.x releases). Hi Fredrik: The technical approach you've taken here is a bit unusual and potentially quite fragile -- replacing the method pointers on struct ifnet's maintained by other drivers and "borrowing" spare fields is likely going to prove problematic in the future (and, in fact, already). It looks like a lot of what the driver is trying to accomplish can already be done entirely from userspace using bpf(4): taking a tee of incoming frames arriving at the NIC, perhaps selecting down to ones to specific ethernet addresses, taking the card into and out of promiscuous mode, and injecting frames into the output path, are exactly what BPF is designed to support. I was wondering if you'd looked at this approach as an alternative to a custom kernel driver? Robert > > The patch can be found at > http://www.shapeshifter.se/pub/patches/vbox-freebsd-network.patch > > Additional patch for emulators/virtualbox/Makefile > http://www.shapeshifter.se/pub/patches/virtualbox-Makefile.patch > > > You'll have to rebuild VirtualBox to make it work, the following lines > should do the trick. > > cd /usr/ports/emulators/virtualbox > make clean patch > mkdir work/virtualbox-3.0.51r22226/src/VBox/HostDrivers/VBoxNetFlt/freebsd > > patch -d work/virtualbox-3.0.51r22226 < vbox-freebsd-network.patch > patch < virtualbox-Makefile.patch > make install > > In addition to vboxdrv.ko you'll need to load vboxnetflt.ko too. > > kldload /boot/modules/vboxnetflt.ko > > In VirtualBox network settings, under "Bridged Adapter" you should now > see your available network interfaces. Select the one connected to your > network and boot your virtual machine. It should now be connected to > your local network as any other machine. > > > Please note that this is just the first iteration of the patch and it > should by no means be considered complete. It has only been tested > on FreeBSD 8/i386. Slippery when wet :) > > > The kld is also a bit hackish at the moment regarding to how it > interfaces with the network stack to avoid kernel code modifications. > > Fredrik > _______________________________________________ > freebsd-emulation@freebsd.org mailing list > http://lists.freebsd.org/mailman/listinfo/freebsd-emulation > To unsubscribe, send any mail to "freebsd-emulation-unsubscribe@freebsd.org" > From owner-freebsd-emulation@FreeBSD.ORG Tue Aug 25 18:00:34 2009 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 5D36B106568B; Tue, 25 Aug 2009 18:00:34 +0000 (UTC) (envelope-from fli@shapeshifter.se) Received: from mx1.h3q.net (mx1.h3q.net [IPv6:2001:16d8:ffe5:1::f1]) by mx1.freebsd.org (Postfix) with ESMTP id 22C888FC14; Tue, 25 Aug 2009 18:00:33 +0000 (UTC) Received: from smtp-auth.h3q.net (smtp-auth.h3q.net [127.0.0.1]) (Authenticated sender: hidden) by mx1.h3q.net (Postfix) with ESMTPSA id 9B11B33CB7 ; Tue, 25 Aug 2009 20:00:32 +0200 (CEST) Message-ID: <4A9426BD.1050503@shapeshifter.se> Date: Tue, 25 Aug 2009 20:00:29 +0200 From: Fredrik Lindberg User-Agent: Thunderbird 2.0.0.22 (X11/20090801) MIME-Version: 1.0 To: Robert Watson References: <4A8EB3D2.7010109@shapeshifter.se> In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Cc: freebsd-emulation@freebsd.org Subject: Re: VirtualBox bridged adapter (vboxnetflt) 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: Tue, 25 Aug 2009 18:00:34 -0000 Robert Watson wrote: > > On Fri, 21 Aug 2009, Fredrik Lindberg wrote: > >> I've started working on the missing bits of the FreeBSD network >> implementation in VirtualBox. >> >> I now have a working vboxnetflt.ko driver that allows automatic >> bridged networking in VirtualBox (probably what most people want). >> This allows guests to automatically bridge with your existing network >> adapter providing seamless network access. >> >> Work on host-only adapter mode is in progress (this should not be >> confused with host-interface in previous vbox 2.x releases). > > Hi Fredrik: > > The technical approach you've taken here is a bit unusual and > potentially quite fragile -- replacing the method pointers on struct > ifnet's maintained by other drivers and "borrowing" spare fields is > likely going to prove problematic in the future (and, in fact, already). > > It looks like a lot of what the driver is trying to accomplish can > already be done entirely from userspace using bpf(4): taking a tee of > incoming frames arriving at the NIC, perhaps selecting down to ones to > specific ethernet addresses, taking the card into and out of promiscuous > mode, and injecting frames into the output path, are exactly what BPF is > designed to support. I was wondering if you'd looked at this approach > as an alternative to a custom kernel driver? > > Robert > That's why I ended my mail by saying it's "hackish" (which usually mean fragile) :) vboxnetflt is a driver that exists for all operating systems capable of running in virtualbox host mode. It consists of both operating system independent code and operating system dependent code. This together forms a kernel module (on all host OS) which in turn depend on symbols in the other kernel support driver (vboxdrv.ko). So, unless we re-write a lot of the generic code in VBox, this have to be done in the kernel (disclaimer, I haven't really looked on what would have to be changed, but it's not very attractive to start messing with their generic code). I've actually looked at BPF..but didn't find a clean API from the kernel (maybe I just don't know where to look). (Opening /dev/bpf from the kernel seemed just as fragile as the current approach if it's even possible). The third approach is to add vbox glue to ifnet and ether_output, but that is just as bad (accounting for third party software in the kernel is just ugly). At least Darwin seems to have a "filtering" mechanism that allows you to manipulate mbufs before they are sent to the interface. Linux seems to have a similar mechanism, but not as flexible as the one in Darwin. I was thinking along the same lines for FreeBSD. Implementing generic hooks in the input/output path that could be used for vbox, if_bridge, carp, etc, instead of the current hard coded calls in ether_{output,input}. This could also have the effect of removing module specific glue from struct ifnet. Anything worth pursuing ? Fredrik Lindberg From owner-freebsd-emulation@FreeBSD.ORG Wed Aug 26 17:46:57 2009 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 80971106568B for ; Wed, 26 Aug 2009 17:46:57 +0000 (UTC) (envelope-from julian@elischer.org) Received: from outD.internet-mail-service.net (outd.internet-mail-service.net [216.240.47.227]) by mx1.freebsd.org (Postfix) with ESMTP id 6A6998FC29 for ; Wed, 26 Aug 2009 17:46:57 +0000 (UTC) Received: from idiom.com (mx0.idiom.com [216.240.32.160]) by out.internet-mail-service.net (Postfix) with ESMTP id 67C47B98AA for ; Wed, 26 Aug 2009 10:33:40 -0700 (PDT) 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 32C952D600F for ; Wed, 26 Aug 2009 10:33:40 -0700 (PDT) Message-ID: <4A9571F3.1010605@elischer.org> Date: Wed, 26 Aug 2009 10:33:39 -0700 From: Julian Elischer User-Agent: Thunderbird 2.0.0.23 (Macintosh/20090812) MIME-Version: 1.0 To: freebsd-emulation@freebsd.org References: <20090826120020.27CAE106570D@hub.freebsd.org> In-Reply-To: <20090826120020.27CAE106570D@hub.freebsd.org> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Subject: Re: freebsd-emulation Digest, Vol 330, Issue 3 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 Aug 2009 17:46:57 -0000 ----- Robert said: > Hi Fredrik: > > The technical approach you've taken here is a bit unusual > and potentially quite fragile -- replacing the method pointers > on struct ifnet's maintained by other drivers and "borrowing" > spare fields is likely going to prove problematic in the future > (and, in fact, already). > > It looks like a lot of what the driver is trying to accomplish > can already be one entirely from userspace using bpf(4): taking > a tee of incoming frames arriving at the NIC, perhaps selecting > down to ones to specific ethernet addresses, taking the card into > and out of promiscuous mode, and injecting frames into the > output path, are exactly what BPF is designed to support. I > was wondering if you'd looked at this approach as an alternative > to a custom kernel driver? > > Robert -------------End quote---------- BPF is pretty lousy for that job.. Take a look at the netgraph hooks at interface level to divert packets to other destinations. From owner-freebsd-emulation@FreeBSD.ORG Wed Aug 26 20:56:32 2009 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 76935106568E for ; Wed, 26 Aug 2009 20:56:32 +0000 (UTC) (envelope-from matheusber@gmail.com) Received: from mail-px0-f180.google.com (mail-px0-f180.google.com [209.85.216.180]) by mx1.freebsd.org (Postfix) with ESMTP id 3AF718FC22 for ; Wed, 26 Aug 2009 20:56:32 +0000 (UTC) Received: by pxi10 with SMTP id 10so557835pxi.28 for ; Wed, 26 Aug 2009 13:56:32 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:sender:received:received :message-id:date:subject:from:to:user-agent:mime-version :content-type:x-priority:importance; bh=9gheiU0qXHszYCSNBrJ9uf52Z1mO98YMbpzy4K2L8gs=; b=DmzfWxi7nLZXEaudSLRU6LqVMmcXUsVF93WcdrbCSnDAjwrl7ECsE4F+Cf/juDv/nE AYUzZhSz2iPxdr5JoVIiwcS799lJ1XbmZNSkmdKDgURzpVXQbq4TPvrYGpY87k5PcCoC 68QFSf1KSturR41B51F+ZAdPLw2fvsyIEbH+8= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=sender:message-id:date:subject:from:to:user-agent:mime-version :content-type:x-priority:importance; b=ZbkQtStUhzOAEPr41RgJNzrJlxYFwEw10wy1mCEq6FV5MX3Q7gL2kEJoJy+kY79/nK Xn2FJoSbhjWqG0V2J47MtcKrsE/CoruhpwVsiJSYNuDD5xmyGxamsX16DvJLz5ZYDWt9 7qYsQAgQiCTkqF8KIEgIrQZyYfdtQYK8ZBZzg= Received: by 10.114.90.7 with SMTP id n7mr191749wab.130.1251320191806; Wed, 26 Aug 2009 13:56:31 -0700 (PDT) Received: from cygnus.homeunix.com ([189.71.85.93]) by mx.google.com with ESMTPS id k14sm446011waf.4.2009.08.26.13.56.27 (version=TLSv1/SSLv3 cipher=RC4-MD5); Wed, 26 Aug 2009 13:56:30 -0700 (PDT) Sender: Nenhum_de_Nos Received: by cygnus.homeunix.com (Postfix, from userid 80) id D2CA0B8052; Wed, 26 Aug 2009 17:56:15 -0300 (BRT) Received: from 189.92.224.108 (SquirrelMail authenticated user matheus) by cygnus.homeunix.com with HTTP; Wed, 26 Aug 2009 17:56:14 -0300 (BRT) Message-ID: <72dfada5029c91e5704436ec501297e7.squirrel@cygnus.homeunix.com> Date: Wed, 26 Aug 2009 17:56:14 -0300 (BRT) From: "Nenhum_de_Nos" To: freebsd-emulation@freebsd.org User-Agent: SquirrelMail/1.4.15 MIME-Version: 1.0 Content-Type: multipart/mixed;boundary="----=_20090826175614_63281" X-Priority: 3 (Normal) Importance: Normal X-Content-Filtered-By: Mailman/MimeDel 2.1.5 Subject: vbox 3.0.51 and 8-beta3 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 Aug 2009 20:56:32 -0000 ------=_20090826175614_63281 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 8bit hail, this same machine runs on in 7.2-stable. I get instant machine (just guest) crash. there was a message to send this files. if any further help needed. by the way, has anyone ever got this scenario to work ? amd64 guest running two cpu on 8-betaX. thanks, matheus -- We will call you cygnus, The God of balance you shall be A: Because it messes up the order in which people normally read text. Q: Why is top-posting such a bad thing? http://en.wikipedia.org/wiki/Posting_style ------=_20090826175614_63281-- From owner-freebsd-emulation@FreeBSD.ORG Thu Aug 27 09:29:48 2009 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 12ECA106568C; Thu, 27 Aug 2009 09:29:48 +0000 (UTC) (envelope-from pluknet@gmail.com) Received: from mail-fx0-f210.google.com (mail-fx0-f210.google.com [209.85.220.210]) by mx1.freebsd.org (Postfix) with ESMTP id 769468FC3F; Thu, 27 Aug 2009 09:29:47 +0000 (UTC) Received: by fxm6 with SMTP id 6so766191fxm.43 for ; Thu, 27 Aug 2009 02:29:46 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:date:message-id:subject :from:to:content-type:content-transfer-encoding; bh=gfTfbqr4jigcGEnZKoVSx11paEgQiVCY26fShj7iQ/E=; b=CvNNrlNbrOfJC4OysI+WXfBhMK9dKJehimHbNF/WWSJKQKansho4Q2/CJIlpyb+uYm DvFcGPYliWDAw7fKBBIVWTScT4LLB1AdlFZDr8ns9y9G0HiLarPu1xIOFxzVITHmMmTH OdAYKnTiuNGrZdh8OsQebVyCpKyDMG8ysJ6oU= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:date:message-id:subject:from:to:content-type :content-transfer-encoding; b=IbCbJpkbOpRBsUGdo0gbrHRt+ObryjmuVzPnwweRBeQEbEqtL2tOihSW2Z3JwsGNDv 588KpUkZVvJQ0KS8Q5WGbaEW40HfEVC/hs5X7Vl5D8sbA6fQnHXaGuYwIYtXweP7v4eL GofdEFWzxGb0o/jFMAuHzG/KFcWjnDlwZfoQ8= MIME-Version: 1.0 Received: by 10.204.48.131 with SMTP id r3mr4576907bkf.195.1251363522203; Thu, 27 Aug 2009 01:58:42 -0700 (PDT) Date: Thu, 27 Aug 2009 12:58:42 +0400 Message-ID: From: pluknet To: FreeBSD Current , dchagin@freebsd.org, freebsd-emulation@freebsd.org Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Cc: Subject: acquiring duplicate lock of same type: "ftlk" 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: Thu, 27 Aug 2009 09:29:48 -0000 Hi. Got it on FreeBSD 9.0-CURRENT while been running in Xorg, don't know where exactly. Acquiring duplicate lock of same type: "ftlk" 1st ftlk @ /usr/src/sys/modules/linux/../../compat/linux/linux_futex.c:177 2nd ftlk @ /usr/src/sys/modules/linux/../../compat/linux/linux_futex.c:203 KDB: stack backtrace: db_trace_self_wrapper(c07fd8ea,ea393b58,c060a145,c05fac1b,c08007b2,...) at db_trace_self_wrapper+0x26 kdb_backtrace(c05fac1b,c08007b2,c0b49757,c58ead20,ea393bb4,...) at kdb_backtrace+0x29 _witness_debugger(c08007b2,c0b49793,c0b49757,cb,0,...) at _witness_debugger+0x25 witness_checkorder(c9bba780,9,c0b49757,cb,0,...) at witness_checkorder+0x469 _sx_xlock(c9bba780,0,c0b49757,cb,0,...) at _sx_xlock+0x85 futex_get0(c0609f8c,c09cc7a8,c9ac7764,c09cc7a8,c084df3c,...) at futex_get0+0x116 linux_sys_futex(c9ac76c0,ea393cf8,ea393d18,ea393d1c,c0b4cf40,...) at linux_sys_futex+0x6f syscall(ea393d38) at syscall+0x2b4 Xint0x80_syscall() at Xint0x80_syscall+0x20 --- syscall (240, Linux ELF, linux_sys_futex), eip = 0x28799533, esp = 0xbfbfc0cc, ebp = 0x4000001 --- -- wbr, pluknet From owner-freebsd-emulation@FreeBSD.ORG Fri Aug 28 21:25:26 2009 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 EF192106564A for ; Fri, 28 Aug 2009 21:25:26 +0000 (UTC) (envelope-from rwatson@FreeBSD.org) Received: from cyrus.watson.org (cyrus.watson.org [65.122.17.42]) by mx1.freebsd.org (Postfix) with ESMTP id C85B18FC1D for ; Fri, 28 Aug 2009 21:25:26 +0000 (UTC) Received: from fledge.watson.org (fledge.watson.org [65.122.17.41]) by cyrus.watson.org (Postfix) with ESMTPS id 63E7F46B0C; Fri, 28 Aug 2009 17:25:26 -0400 (EDT) Date: Fri, 28 Aug 2009 22:25:26 +0100 (BST) From: Robert Watson X-X-Sender: robert@fledge.watson.org To: Fredrik Lindberg In-Reply-To: <4A9426BD.1050503@shapeshifter.se> Message-ID: References: <4A8EB3D2.7010109@shapeshifter.se> <4A9426BD.1050503@shapeshifter.se> User-Agent: Alpine 2.00 (BSF 1167 2008-08-23) MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed Cc: freebsd-emulation@freebsd.org Subject: Re: VirtualBox bridged adapter (vboxnetflt) 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: Fri, 28 Aug 2009 21:25:27 -0000 On Tue, 25 Aug 2009, Fredrik Lindberg wrote: > That's why I ended my mail by saying it's "hackish" (which usually mean > fragile) :) > > vboxnetflt is a driver that exists for all operating systems capable of > running in virtualbox host mode. It consists of both operating system > independent code and operating system dependent code. This together forms a > kernel module (on all host OS) which in turn depend on symbols in the other > kernel support driver (vboxdrv.ko). > > So, unless we re-write a lot of the generic code in VBox, this have to be > done in the kernel (disclaimer, I haven't really looked on what would have > to be changed, but it's not very attractive to start messing with their > generic code). > > I've actually looked at BPF..but didn't find a clean API from the kernel > (maybe I just don't know where to look). (Opening /dev/bpf from the kernel > seemed just as fragile as the current approach if it's even possible). > > The third approach is to add vbox glue to ifnet and ether_output, but that > is just as bad (accounting for third party software in the kernel is just > ugly). > > At least Darwin seems to have a "filtering" mechanism that allows you to > manipulate mbufs before they are sent to the interface. Linux seems to have > a similar mechanism, but not as flexible as the one in Darwin. > > I was thinking along the same lines for FreeBSD. Implementing generic hooks > in the input/output path that could be used for vbox, if_bridge, carp, etc, > instead of the current hard coded calls in ether_{output,input}. This could > also have the effect of removing module specific glue from struct ifnet. > Anything worth pursuing ? In the past, we've talked about adding PFIL hooks for interface input/output paths, and in fact there's already a PFIL constant for it, it's just not hooked up to anything: PFIL_TYPE_IFNET. I think it would be a useful to flesh this out, but we'll need to decide where to place them. I think the right spot is probably in the link layer input/output routines - ether_{input,output} in particular, but also at other layers, such as in the VLAN code. Not for 8.0, obviously. :-) You'll still need to use an m_tag so you can mark traffic you've generated and ignore it when it gets picked up by a hook, of course. Robert N M Watson Computer Laboratory University of Cambridge From owner-freebsd-emulation@FreeBSD.ORG Sat Aug 29 22:27:52 2009 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 AF11B106564A for ; Sat, 29 Aug 2009 22:27:52 +0000 (UTC) (envelope-from nox@jelal.kn-bremen.de) Received: from smtp.kn-bremen.de (gelbbaer.kn-bremen.de [78.46.108.116]) by mx1.freebsd.org (Postfix) with ESMTP id 306348FC14 for ; Sat, 29 Aug 2009 22:27:51 +0000 (UTC) Received: by smtp.kn-bremen.de (Postfix, from userid 10) id 709B71E00363; Sun, 30 Aug 2009 00:27:50 +0200 (CEST) Received: from triton8.kn-bremen.de (noident@localhost [127.0.0.1]) by triton8.kn-bremen.de (8.14.3/8.14.3) with ESMTP id n7TMNdmU093634; Sun, 30 Aug 2009 00:23:39 +0200 (CEST) (envelope-from nox@triton8.kn-bremen.de) Received: (from nox@localhost) by triton8.kn-bremen.de (8.14.3/8.14.3/Submit) id n7TMNdT5093633; Sun, 30 Aug 2009 00:23:39 +0200 (CEST) (envelope-from nox) From: Juergen Lock Date: Sun, 30 Aug 2009 00:23:39 +0200 To: freebsd-emulation@FreeBSD.org Message-ID: <20090829222339.GA93608@triton8.kn-bremen.de> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.5.20 (2009-06-14) Cc: qemu-devel@nongnu.org, Jung-uk Kim Subject: experimental FreeBSD qemu-devel git head port update for testing 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: Sat, 29 Aug 2009 22:27:52 -0000 Hi! Jan Kiszka asked me if the unstable guest timer irq problem still exists on qemu git head, so I made an update for that today: http://people.freebsd.org/~nox/qemu/qemu-devel-20090829.patch (and found out it does.) The bad news (for FreeBSD users anyway) is kqemu support has now been removed as `promised' (by the upstream qemu developers), so testing this version is probably less interesting for many FreeBSD users than the qemu 0.11 stable branch snapshot I posted about here, http://lists.freebsd.org/pipermail/freebsd-emulation/2009-August/006646.html but e.g. users of non-x86 targets probably will still be interested. Also the pcap patch stopped working in this snapshot and I don't yet know why. (I think the original version of that patch was submitted by Jung-uk Kim, maybe he has an idea; Cc'd.) Other misc notes: 1. I had to replace the line CFLAGS += $(call cc-option, $(CFLAGS), -fno-stack-protector,"") by CFLAGS += -fno-stack-protector in qemu/pc-bios/optionrom/Makefile because now make complained about recursive use of CFLAGS (in addition to forcing use of a newer as(1) for multiboot.S as already mentioned for the 0.11 rc, see files/patch-pc-bios-optionrom-Makefile in the update.) 2. vl.c references __FreeBSD_version in a few places but still didn't #include to get the definition: Index: qemu/vl.c @@ -57,6 +57,7 @@ #include #if defined(__FreeBSD__) || defined(__DragonFly__) #include +#include #else #include #endif 3. Do you guys think the posix timer patch is ready to be committed now? It _might_ cause -lrt to end up in $LIBS twice now tho. (not on FreeBSD since clock_gettime() is in libc there.) Btw it (-clock dynticks) also does't help the mentioned timer irq problems... Index: qemu/configure @@ -1538,6 +1538,20 @@ LIBS="-lrt $LIBS" fi +########################################## +# posix timer probe +cat > $TMPC < +int main(void) { timer_create(CLOCK_REALTIME, (struct sigevent *)NULL, (timer_t *)NULL); return 0; } +EOF +posixtimer=no +if compile_prog "" "" ; then + posixtimer=yes +elif compile_prog "" "-lrt" ; then + posixtimer=yes + LIBS="-lrt $LIBS" +fi + # Determine what linker flags to use to force archive inclusion check_linker_flags() { @@ -1872,6 +1886,9 @@ if test "$fdt" = "yes" ; then echo "CONFIG_FDT=y" >> $config_host_mak fi +if test "$posixtimer" = "yes" ; then + echo "CONFIG_POSIX_TIMER=y" >> $config_host_mak +fi # XXX: suppress that if [ "$bsd" = "yes" ] ; then Index: qemu/vl.c @@ -918,12 +918,16 @@ static int unix_start_timer(struct qemu_alarm_timer *t); static void unix_stop_timer(struct qemu_alarm_timer *t); -#ifdef __linux__ +#ifdef CONFIG_POSIX_TIMER static int dynticks_start_timer(struct qemu_alarm_timer *t); static void dynticks_stop_timer(struct qemu_alarm_timer *t); static void dynticks_rearm_timer(struct qemu_alarm_timer *t); +#endif + +#ifdef __linux__ + static int hpet_start_timer(struct qemu_alarm_timer *t); static void hpet_stop_timer(struct qemu_alarm_timer *t); @@ -1001,9 +1005,11 @@ static struct qemu_alarm_timer alarm_timers[] = { #ifndef _WIN32 -#ifdef __linux__ +#ifdef CONFIG_POSIX_TIMER {"dynticks", ALARM_FLAG_DYNTICKS, dynticks_start_timer, dynticks_stop_timer, dynticks_rearm_timer, NULL}, +#endif +#ifdef __linux__ /* HPET - if available - is preferred */ {"hpet", 0, hpet_start_timer, hpet_stop_timer, NULL, NULL}, /* ...otherwise try RTC */ @@ -1361,7 +1367,7 @@ return delta; } -#if defined(__linux__) || defined(_WIN32) +#if defined(CONFIG_POSIX_TIMER) || defined(_WIN32) static uint64_t qemu_next_deadline_dyntick(void) { int64_t delta; @@ -1506,6 +1512,10 @@ close(rtc_fd); } +#endif /* defined(__linux__) */ + +#ifdef CONFIG_POSIX_TIMER + static int dynticks_start_timer(struct qemu_alarm_timer *t) { struct sigevent ev; @@ -1577,7 +1587,7 @@ } } -#endif /* defined(__linux__) */ +#endif /* defined(CONFIG_POSIX_TIMER) */ static int unix_start_timer(struct qemu_alarm_timer *t) { Signed-off-by: Juergen Lock