Commit 973cbd37ce6d4c33dea7f4ed6b8e0e602fa50d25
1 parent
f5cbc474
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
Showing
1 changed file
with
6 additions
and
6 deletions
net.c
... | ... | @@ -652,6 +652,7 @@ typedef struct TAPState { |
652 | 652 | VLANClientState *vc; |
653 | 653 | int fd; |
654 | 654 | char down_script[1024]; |
655 | + char down_script_arg[128]; | |
655 | 656 | } TAPState; |
656 | 657 | |
657 | 658 | #ifdef HAVE_IOVEC |
... | ... | @@ -978,8 +979,10 @@ static int net_tap_init(VLANState *vlan, const char *model, |
978 | 979 | snprintf(s->vc->info_str, sizeof(s->vc->info_str), |
979 | 980 | "ifname=%s,script=%s,downscript=%s", |
980 | 981 | ifname, setup_script, down_script); |
981 | - if (down_script && strcmp(down_script, "no")) | |
982 | + if (down_script && strcmp(down_script, "no")) { | |
982 | 983 | snprintf(s->down_script, sizeof(s->down_script), "%s", down_script); |
984 | + snprintf(s->down_script_arg, sizeof(s->down_script_arg), "%s", ifname); | |
985 | + } | |
983 | 986 | return 0; |
984 | 987 | } |
985 | 988 | |
... | ... | @@ -1770,13 +1773,10 @@ void net_cleanup(void) |
1770 | 1773 | |
1771 | 1774 | for(vc = vlan->first_client; vc != NULL; vc = vc->next) { |
1772 | 1775 | if (vc->fd_read == tap_receive) { |
1773 | - char ifname[64]; | |
1774 | 1776 | TAPState *s = vc->opaque; |
1775 | 1777 | |
1776 | - if (strcmp(vc->model, "tap") == 0 && | |
1777 | - sscanf(vc->info_str, "ifname=%63s ", ifname) == 1 && | |
1778 | - s->down_script[0]) | |
1779 | - launch_script(s->down_script, ifname, s->fd); | |
1778 | + if (s->down_script[0]) | |
1779 | + launch_script(s->down_script, s->down_script_arg, s->fd); | |
1780 | 1780 | } |
1781 | 1781 | #if defined(CONFIG_VDE) |
1782 | 1782 | if (vc->fd_read == vde_from_qemu) { | ... | ... |