aboutsummaryrefslogtreecommitdiff
path: root/net.h
diff options
context:
space:
mode:
authorMarkus Armbruster <armbru@redhat.com>2009-10-06 12:16:57 +0100
committerAnthony Liguori <aliguori@us.ibm.com>2009-10-06 14:36:10 -0500
commit0752706de257b38763006ff5bb6b39a97e669ba2 (patch)
treedbc0c0efe57ace7812b1889fde6d35ae6d2e0d11 /net.h
parent3a179c661434364607cf45882ab8b12cd6d32b27 (diff)
downloadqemu-0752706de257b38763006ff5bb6b39a97e669ba2.zip
qemu-0752706de257b38763006ff5bb6b39a97e669ba2.tar.gz
qemu-0752706de257b38763006ff5bb6b39a97e669ba2.tar.bz2
Don't exit() in config_error()
Propagating errors up the call chain is tedious. In startup code, we can take a shortcut: terminate the program. This is wrong elsewhere, the monitor in particular. config_error() tries to cater for both customers: it terminates the program unless its mon parameter tells it it's working for the monitor. Its users need to return status anyway (unless passing a null mon argument, which none do), which their users need to check. So this automatic exit buys us exactly nothing useful. Only the dangerous delusion that we can get away without returning status. Some of its users fell for that. Their callers continue executing after failure when working for the monitor. This bites monitor command host_net_add in two places: * net_slirp_init() continues after slirp_hostfwd(), slirp_guestfwd(), or slirp_smb() failed, and may end up reporting success. This happens for "host_net_add user guestfwd=foo": it complains about the invalid guest forwarding rule, then happily creates the user network without guest forwarding. * net_client_init() can't detect slirp_guestfwd() failure, and gets fooled by net_slirp_init() lying about success. Suppresses its "Could not initialize device" message. Add the missing error reporting, make sure errors are checked, and drop the exit() from config_error(). Signed-off-by: Markus Armbruster <armbru@redhat.com> Signed-off-by: Mark McLoughlin <markmc@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Diffstat (limited to 'net.h')
-rw-r--r--net.h4
1 files changed, 2 insertions, 2 deletions
diff --git a/net.h b/net.h
index a36df45..a2d5b3c 100644
--- a/net.h
+++ b/net.h
@@ -138,10 +138,10 @@ extern const char *legacy_bootp_filename;
int net_client_init(Monitor *mon, const char *device, const char *p);
void net_client_uninit(NICInfo *nd);
int net_client_parse(const char *str);
-void net_slirp_smb(const char *exported_dir);
+int net_slirp_smb(const char *exported_dir);
void net_slirp_hostfwd_add(Monitor *mon, const QDict *qdict);
void net_slirp_hostfwd_remove(Monitor *mon, const QDict *qdict);
-void net_slirp_redir(const char *redir_str);
+int net_slirp_redir(const char *redir_str);
void net_cleanup(void);
void net_client_check(void);
void net_set_boot_mask(int boot_mask);