qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Qemu-devel] Network isn't clean when qemu exits


From: Amos Kong
Subject: [Qemu-devel] Network isn't clean when qemu exits
Date: Tue, 11 Dec 2012 13:57:04 +0800
User-agent: Mutt/1.5.21 (2010-09-15)

In vl.c:main(), tap device would be created when net_init_clients() is called.
"device" option is parsed after calling net_init_clients() by:
# "qemu_opts_foreach(qemu_find_opts("device"), device_init_func, NULL, 1)

Qemu will exit 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.

I did a quick fix, the tap device should be removed.

But there are many "exit(1)" after calling net_init_clients() in vl.c,
it's ugly to call net_cleanup() before each exit. Not sure if we have
other exit(1) in other sub-functions, which is also called after calling
net_init_clients().

Any comments?

=====
@@ -3882,8 +3889,11 @@ int main(int argc, char **argv, char **envp)
     }

     /* init generic devices */
-    if (qemu_opts_foreach(qemu_find_opts("device"), device_init_func,
     NULL, 1) != 0)
+    if (qemu_opts_foreach(qemu_find_opts("device"), device_init_func,
+                          NULL, 1) != 0) {
+        net_cleanup();
         exit(1);
+    }

-- 
                Amos.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]