Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1LMok3-0002cT-1m for qemu-devel@nongnu.org; Tue, 13 Jan 2009 14:15:59 -0500 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1LMok2-0002bm-51 for qemu-devel@nongnu.org; Tue, 13 Jan 2009 14:15:58 -0500 Received: from [199.232.76.173] (port=35009 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1LMok2-0002bd-0u for qemu-devel@nongnu.org; Tue, 13 Jan 2009 14:15:58 -0500 Received: from savannah.gnu.org ([199.232.41.3]:57494 helo=sv.gnu.org) by monty-python.gnu.org with esmtps (TLS-1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1LMok1-0000HQ-Q2 for qemu-devel@nongnu.org; Tue, 13 Jan 2009 14:15:57 -0500 Received: from cvs.savannah.gnu.org ([199.232.41.69]) by sv.gnu.org with esmtp (Exim 4.63) (envelope-from ) id 1LMok1-0006As-2I for qemu-devel@nongnu.org; Tue, 13 Jan 2009 19:15:57 +0000 Received: from aliguori by cvs.savannah.gnu.org with local (Exim 4.63) (envelope-from ) id 1LMok0-0006Am-Jn for qemu-devel@nongnu.org; Tue, 13 Jan 2009 19:15:56 +0000 MIME-Version: 1.0 Errors-To: aliguori Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit From: Anthony Liguori Message-Id: Date: Tue, 13 Jan 2009 19:15:56 +0000 Subject: [Qemu-devel] [6285] Fix tap downscript argument (Mark McLoughlin) 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 Revision: 6285 http://svn.sv.gnu.org/viewvc/?view=rev&root=qemu&revision=6285 Author: aliguori Date: 2009-01-13 19:15:55 +0000 (Tue, 13 Jan 2009) Log Message: ----------- Fix tap downscript argument (Mark McLoughlin) Kill off the hack that parses info_str for the tap interface name to pass as the argument to the downscript and, instead, just explicitly keep a copy of the string for later. As reported by John Wong, this commit: Add qemu_format_nic_info_str() changed the invocation of downscript from e.g. /path/kvm-ifdown "tap0" to: /path/kvm-ifdown "tap0,script=/path/kvm-ifup,downscript=/path/kvm-ifdown" This fix restores the original behavior. Reported-by: John Wong Signed-off-by: Mark McLoughlin Signed-off-by: Anthony Liguori Modified Paths: -------------- trunk/net.c Modified: trunk/net.c =================================================================== --- trunk/net.c 2009-01-13 19:08:18 UTC (rev 6284) +++ trunk/net.c 2009-01-13 19:15:55 UTC (rev 6285) @@ -652,6 +652,7 @@ VLANClientState *vc; int fd; char down_script[1024]; + char down_script_arg[128]; } TAPState; #ifdef HAVE_IOVEC @@ -978,8 +979,10 @@ snprintf(s->vc->info_str, sizeof(s->vc->info_str), "ifname=%s,script=%s,downscript=%s", ifname, setup_script, down_script); - if (down_script && strcmp(down_script, "no")) + if (down_script && strcmp(down_script, "no")) { snprintf(s->down_script, sizeof(s->down_script), "%s", down_script); + snprintf(s->down_script_arg, sizeof(s->down_script_arg), "%s", ifname); + } return 0; } @@ -1770,13 +1773,10 @@ for(vc = vlan->first_client; vc != NULL; vc = vc->next) { if (vc->fd_read == tap_receive) { - char ifname[64]; TAPState *s = vc->opaque; - if (strcmp(vc->model, "tap") == 0 && - sscanf(vc->info_str, "ifname=%63s ", ifname) == 1 && - s->down_script[0]) - launch_script(s->down_script, ifname, s->fd); + if (s->down_script[0]) + launch_script(s->down_script, s->down_script_arg, s->fd); } #if defined(CONFIG_VDE) if (vc->fd_read == vde_from_qemu) {