aboutsummaryrefslogtreecommitdiff
path: root/net.c
diff options
context:
space:
mode:
authorPeter Maydell <peter.maydell@linaro.org>2011-05-20 16:50:01 +0100
committerAnthony Liguori <aliguori@us.ibm.com>2011-06-22 07:18:39 -0500
commit48e2faf222cbf4abab7c8e4b3f44229ec98eae7f (patch)
tree394889ebf5ddfaa49862b934fd89a16a7b7bcc5c /net.c
parent641f6eae757e5b2cf854fec14038ffd229e9adea (diff)
net: Warn about "-net nic" options which were ignored
Diagnose the case where the user asked for a NIC via "-net nic" but the board didn't instantiate that NIC (for example where the user asked for two NICs but the board only supports one). Note that this diagnostic doesn't apply to NICs created through -device, because those are always instantiated. Signed-off-by: Peter Maydell <peter.maydell@linaro.org> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Diffstat (limited to 'net.c')
-rw-r--r--net.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/net.c b/net.c
index 68c2840621..a104976b0b 100644
--- a/net.c
+++ b/net.c
@@ -1304,6 +1304,7 @@ void net_check_clients(void)
{
VLANState *vlan;
VLANClientState *vc;
+ int i;
/* Don't warn about the default network setup that you get if
* no command line -net or -netdev options are specified. There
@@ -1348,6 +1349,20 @@ void net_check_clients(void)
vc->name);
}
}
+
+ /* Check that all NICs requested via -net nic actually got created.
+ * NICs created via -device don't need to be checked here because
+ * they are always instantiated.
+ */
+ for (i = 0; i < MAX_NICS; i++) {
+ NICInfo *nd = &nd_table[i];
+ if (nd->used && !nd->instantiated) {
+ fprintf(stderr, "Warning: requested NIC (%s, model %s) "
+ "was not created (not supported by this machine?)\n",
+ nd->name ? nd->name : "anonymous",
+ nd->model ? nd->model : "unspecified");
+ }
+ }
}
static int net_init_client(QemuOpts *opts, void *dummy)