diff options
author | aliguori <aliguori@c046a42c-6fe2-441c-8c8c-71466251a162> | 2009-01-13 19:15:55 +0000 |
---|---|---|
committer | aliguori <aliguori@c046a42c-6fe2-441c-8c8c-71466251a162> | 2009-01-13 19:15:55 +0000 |
commit | 973cbd37ce6d4c33dea7f4ed6b8e0e602fa50d25 (patch) | |
tree | c3e61484c9fcf14660ddea4507409eabb5510244 /net.c | |
parent | f5cbc474e8d810c8fc176311a70252ceb2368f94 (diff) |
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 <johnw@wonghome.net>
Signed-off-by: Mark McLoughlin <markmc@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@6285 c046a42c-6fe2-441c-8c8c-71466251a162
Diffstat (limited to 'net.c')
-rw-r--r-- | net.c | 12 |
1 files changed, 6 insertions, 6 deletions
@@ -652,6 +652,7 @@ typedef struct TAPState { VLANClientState *vc; int fd; char down_script[1024]; + char down_script_arg[128]; } TAPState; #ifdef HAVE_IOVEC @@ -978,8 +979,10 @@ static int net_tap_init(VLANState *vlan, const char *model, 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 @@ void net_cleanup(void) 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) { |