From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1HCGf7-00030r-7E for qemu-devel@nongnu.org; Wed, 31 Jan 2007 09:42:13 -0500 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1HCGf5-0002zx-N5 for qemu-devel@nongnu.org; Wed, 31 Jan 2007 09:42:12 -0500 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1HCGf5-0002zq-JQ for qemu-devel@nongnu.org; Wed, 31 Jan 2007 09:42:11 -0500 Received: from www.eclis.ch ([144.85.15.72] helo=mail.eclis.ch) by monty-python.gnu.org with esmtp (Exim 4.52) id 1HCGf4-0004Av-W4 for qemu-devel@nongnu.org; Wed, 31 Jan 2007 09:42:11 -0500 Message-ID: <45C0AABF.6030501@eclis.ch> Date: Wed, 31 Jan 2007 15:42:07 +0100 From: Jean-Christian de Rivaz MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="------------040902040104070406010903" Subject: [Qemu-devel] [PATCH] script=no for the TUN/TAP net option Reply-To: qemu-devel@nongnu.org List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org This is a multi-part message in MIME format. --------------040902040104070406010903 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Hello, The following small patch disable the execution of a script while using the -net tap option with a already existing TUN/TAP interface. So you can as root bring up a TUN/TAP interface to a user with the command 'tunctl -u -t ' and setup the routing. Then the user don't need to sudo a script, it simply tell QEMU to use the interface with the option '-net nic -net tap,ifname=,script=no'. Have a good day, -- Jean-Christian de Rivaz --------------040902040104070406010903 Content-Type: text/plain; name="net-tap-script-no.patch.txt" Content-Transfer-Encoding: 7bit Content-Disposition: inline; filename="net-tap-script-no.patch.txt" Index: qemu-doc.texi =================================================================== RCS file: /sources/qemu/qemu/qemu-doc.texi,v retrieving revision 1.125 diff -u -r1.125 qemu-doc.texi --- qemu-doc.texi 28 Jan 2007 01:53:16 -0000 1.125 +++ qemu-doc.texi 31 Jan 2007 14:29:48 -0000 @@ -358,7 +358,8 @@ @item -net tap[,vlan=n][,fd=h][,ifname=name][,script=file] Connect the host TAP network interface @var{name} to VLAN @var{n} and use the network script @var{file} to configure it. The default -network script is @file{/etc/qemu-ifup}. If @var{name} is not +network script is @file{/etc/qemu-ifup}. Use @option{script=no} to +disable script execution. If @var{name} is not provided, the OS automatically provides one. @option{fd=h} can be used to specify the handle of an already opened host TAP interface. Example: Index: vl.c =================================================================== RCS file: /sources/qemu/qemu/vl.c,v retrieving revision 1.244 diff -u -r1.244 vl.c --- vl.c 28 Jan 2007 01:53:16 -0000 1.244 +++ vl.c 31 Jan 2007 14:29:49 -0000 @@ -3289,7 +3289,7 @@ if (fd < 0) return -1; - if (!setup_script) + if (!setup_script || !strcmp(setup_script, "no")) setup_script = ""; if (setup_script[0] != '\0') { /* try to launch network init script */ @@ -6066,6 +6066,7 @@ "-net tap[,vlan=n][,fd=h][,ifname=name][,script=file]\n" " connect the host TAP network interface to VLAN 'n' and use\n" " the network script 'file' (default=%s);\n" + " use 'script=no' to disable script execution;\n" " use 'fd=h' to connect to an already opened TAP interface\n" #endif "-net socket[,vlan=n][,fd=h][,listen=[host]:port][,connect=host:port]\n" --------------040902040104070406010903--