From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1N6EZg-0005qY-R4 for qemu-devel@nongnu.org; Thu, 05 Nov 2009 21:29:16 -0500 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1N6EZc-0005iC-0u for qemu-devel@nongnu.org; Thu, 05 Nov 2009 21:29:16 -0500 Received: from [199.232.76.173] (port=49463 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1N6EZb-0005i7-UJ for qemu-devel@nongnu.org; Thu, 05 Nov 2009 21:29:11 -0500 Received: from mail2.shareable.org ([80.68.89.115]:56556) by monty-python.gnu.org with esmtps (TLS-1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1N6EZb-0003fK-HT for qemu-devel@nongnu.org; Thu, 05 Nov 2009 21:29:11 -0500 Date: Fri, 6 Nov 2009 02:29:09 +0000 From: Jamie Lokier Subject: Re: [Qemu-devel] [PATCH 4/4] Add support for -net bridge Message-ID: <20091106022909.GN21630@shareable.org> References: <1257294485-27015-1-git-send-email-aliguori@us.ibm.com> <1257294485-27015-5-git-send-email-aliguori@us.ibm.com> <4AF2E407.9000809@redhat.com> <4AF2E519.8030808@us.ibm.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <4AF2E519.8030808@us.ibm.com> List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Anthony Liguori Cc: Mark McLoughlin , Arnd Bergmann , Dustin Kirkland , Michael Tsirkin , Juan Quintela , qemu-devel@nongnu.org, Avi Kivity Anthony Liguori wrote: > Avi Kivity wrote: > >>+int net_init_bridge(QemuOpts *opts, Monitor *mon, const char *name, > >>VLANState *vlan); > >>+ > >> > > > >Don't we need to tear the interface down after shutdown? > > net_init_bridge calls net_tap_fd_init which registers tap_cleanup. That > closes the fd and frees associated memory. > > The helper does not allocate a persistent tap device so closing the file > descriptor is sufficient for cleanup. I think you should at least have the option to call a/the helper when cleaning up too. For the same reason that -net downscript= was added. (From the names I get the impression that was added later than -net script=, perhaps due to the same kind of oversight ;-) A user-supplied helper (I'm thinking of my needs) would create per-tap iptables/ebtables rules and perhaps routing table entries, in addition to creating the tap interface itself. Routing table entries are automatically deleted when the interface is, but iptables/ebtables rules are not. (Although it would be a nice little kernel addition if they could be flagged to be.) But now, thinking a bit more clearly... why is the helper separate from "-net script="? Overall, I envisage this happening (sorry for making up the name tap-up-helper, as I seem to have lost your patch mails): tap-up-helper= # Sets up tap interface, adds to bridge if needed. script= # Sets up IP config ....QEMU runs.... downscript= # Removes IP config tap-down-helper= # If only for symmetry! We does tap-up-helper need to be separate from script? Does QEMU need to do something in between calling the two? If not, then the existing "-net script=" script could just send the tap descriptor as well as anything else it does, couldn't it? -- Jamie