From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1LN5CE-00065V-DF for qemu-devel@nongnu.org; Wed, 14 Jan 2009 07:50:10 -0500 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1LN5CC-00064t-Ml for qemu-devel@nongnu.org; Wed, 14 Jan 2009 07:50:09 -0500 Received: from [199.232.76.173] (port=37532 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1LN5CB-00064g-R2 for qemu-devel@nongnu.org; Wed, 14 Jan 2009 07:50:08 -0500 Received: from maiden102-075.ctimail.com ([61.93.57.75]:43893 helo=maiden102.ctimail.com) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1LN5CA-0002cN-UU for qemu-devel@nongnu.org; Wed, 14 Jan 2009 07:50:07 -0500 Message-ID: <496DDF63.4030900@wonghome.net> Date: Wed, 14 Jan 2009 20:49:39 +0800 From: John Wong MIME-Version: 1.0 References: <1231872879.4290.252.camel@localhost.localdomain> In-Reply-To: <1231872879.4290.252.camel@localhost.localdomain> Content-Type: text/plain; charset=Big5 Content-Transfer-Encoding: quoted-printable Subject: [Qemu-devel] Re: [PATCH] Fix tap downscript argument Reply-To: qemu-devel@nongnu.org List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Mark McLoughlin Cc: qemu-devel Hi Mark, the patch fixed the downscript problem. Thank you. On 2009=A6~01=A4=EB14=A4=E9 02:54, Mark McLoughlin wrote: > 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=3D/path/kvm-ifup,downscript=3D/path/kvm= -ifdown" > > This fix restores the original behavior. > > Reported-by: John Wong > Signed-off-by: Mark McLoughlin > --- > net.c | 12 ++++++------ > 1 files changed, 6 insertions(+), 6 deletions(-) > > diff --git a/net.c b/net.c > index 30ba717..e6639ec 100644 > --- a/net.c > +++ b/net.c > @@ -652,6 +652,7 @@ typedef struct TAPState { > VLANClientState *vc; > int fd; > char down_script[1024]; > + char down_script_arg[128]; > } TAPState; > =20 > #ifdef HAVE_IOVEC > @@ -978,8 +979,10 @@ static int net_tap_init(VLANState *vlan, const cha= r *model, > snprintf(s->vc->info_str, sizeof(s->vc->info_str), > "ifname=3D%s,script=3D%s,downscript=3D%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_sc= ript); > + snprintf(s->down_script_arg, sizeof(s->down_script_arg), "%s",= ifname); > + } > return 0; > } > =20 > @@ -1736,13 +1739,10 @@ void net_cleanup(void) > =20 > for(vc =3D vlan->first_client; vc !=3D NULL; vc =3D vc->next) = { > if (vc->fd_read =3D=3D tap_receive) { > - char ifname[64]; > TAPState *s =3D vc->opaque; > =20 > - if (strcmp(vc->model, "tap") =3D=3D 0 && > - sscanf(vc->info_str, "ifname=3D%63s ", ifname) =3D= =3D 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 =3D=3D vde_from_qemu) { > =20