aboutsummaryrefslogtreecommitdiff
path: root/vl.c
diff options
context:
space:
mode:
authorAmos Kong <akong@redhat.com>2012-12-11 22:20:15 +0800
committerStefan Hajnoczi <stefanha@redhat.com>2013-01-07 10:43:21 +0100
commitf30dbae63a46f23116715dff8d130c7d01ff02be (patch)
tree48cb59af5643df31a1fd65ebe87240d0405d3f87 /vl.c
parent2c0331f4f7d241995452b99afaf0aab00493334a (diff)
downloadqemu-f30dbae63a46f23116715dff8d130c7d01ff02be.zip
qemu-f30dbae63a46f23116715dff8d130c7d01ff02be.tar.gz
qemu-f30dbae63a46f23116715dff8d130c7d01ff02be.tar.bz2
net: clean up network at qemu process termination
We don't clean up network if fails to parse "-device" parameters without calling net_cleanup(). I touch a problem, the tap device which is created by qemu-ifup script could not be removed by qemu-ifdown script. Some similar problems also exist in vl.c In this patch, if network initialization successes, a cleanup function will be registered to be called at qemu process termination. Signed-off-by: Amos Kong <akong@redhat.com> Acked-by: Michael S. Tsirkin <mst@redhat.com> Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
Diffstat (limited to 'vl.c')
-rw-r--r--vl.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/vl.c b/vl.c
index f056c95..79e5122 100644
--- a/vl.c
+++ b/vl.c
@@ -3762,6 +3762,9 @@ int main(int argc, char **argv, char **envp)
}
configure_icount(icount_option);
+ /* clean up network at qemu process termination */
+ atexit(&net_cleanup);
+
if (net_init_clients() < 0) {
exit(1);
}
@@ -4014,7 +4017,6 @@ int main(int argc, char **argv, char **envp)
main_loop();
bdrv_close_all();
pause_all_vcpus();
- net_cleanup();
res_free();
return 0;