From: Amos Kong <akong@redhat.com>
To: Qemu Devel Mail List <qemu-devel@nongnu.org>,
Stefan Hajnoczi <stefanha@redhat.com>
Cc: mst@redhat.com
Subject: [Qemu-devel] Network isn't clean when qemu exits
Date: Tue, 11 Dec 2012 13:57:04 +0800 [thread overview]
Message-ID: <20121211055704.GA5080@t430s.nay.redhat.com> (raw)
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.
next reply other threads:[~2012-12-11 5:57 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-12-11 5:57 Amos Kong [this message]
2012-12-11 8:38 ` [Qemu-devel] Network isn't clean when qemu exits Stefan Hajnoczi
2012-12-11 13:02 ` Michael S. Tsirkin
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20121211055704.GA5080@t430s.nay.redhat.com \
--to=akong@redhat.com \
--cc=mst@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=stefanha@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).