diff mbox

[2/3] net: Don't warn about the default network setup

Message ID 1305906601-25324-3-git-send-email-peter.maydell@linaro.org
State Accepted
Commit 641f6eae757e5b2cf854fec14038ffd229e9adea
Headers show

Commit Message

Peter Maydell May 20, 2011, 3:50 p.m. UTC
Don't warn about the default network setup that you get if no command line
-net options are specified.  There are two cases that we would otherwise
complain about:

(1) board doesn't support a NIC but the implicit "-net nic" requested one
(2) CONFIG_SLIRP not set, so the implicit "-net nic" sets up a nic that
isn't connected to anything

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
---
 net.c |   12 ++++++++++++
 1 files changed, 12 insertions(+), 0 deletions(-)

Comments

Markus Armbruster May 23, 2011, 8:30 a.m. UTC | #1
Peter Maydell <peter.maydell@linaro.org> writes:

> Don't warn about the default network setup that you get if no command line
> -net options are specified.  There are two cases that we would otherwise
> complain about:
>
> (1) board doesn't support a NIC but the implicit "-net nic" requested one

Maybe such board should declare no_nic, similar to no_parallel &
friends.  But that's out of this patch's scope.

This complaint is only added in the next patch, isn't it?  I don't mind.

> (2) CONFIG_SLIRP not set, so the implicit "-net nic" sets up a nic that
> isn't connected to anything

This one's already there, I think.
Peter Maydell May 23, 2011, 8:55 a.m. UTC | #2
On 23 May 2011 09:30, Markus Armbruster <armbru@redhat.com> wrote:
> Peter Maydell <peter.maydell@linaro.org> writes:
>
>> Don't warn about the default network setup that you get if no command line
>> -net options are specified.  There are two cases that we would otherwise
>> complain about:
>>
>> (1) board doesn't support a NIC but the implicit "-net nic" requested one
>
> Maybe such board should declare no_nic, similar to no_parallel &
> friends.  But that's out of this patch's scope.

I think in the brave new qdev world this kind of thing should be
handled generically by warning about any -device requested devices
which couldn't be plugged into anything sensible.

> This complaint is only added in the next patch, isn't it?  I don't mind.

It won't explicitly say "you asked for a NIC and didn't get one",
but it will make the obscurer complaint "Warning: vlan 0 with no
nics", because the implicit '-net user' is then not connected to
anything. I was deliberately slightly vague with the comment text
so it would be true both before and after the following patch :-)

>> (2) CONFIG_SLIRP not set, so the implicit "-net nic" sets up a nic that
>> isn't connected to anything
>
> This one's already there, I think.

No, without this patch qemu will complain
"Warning: vlan 0 is not connected to host network" if you configured
with --disable-slirp.

(--disable-slirp seems to have been left out of configure --help;
I assume that's an oversight.)

-- PMM
diff mbox

Patch

diff --git a/net.c b/net.c
index 1b521a9..68c2840 100644
--- a/net.c
+++ b/net.c
@@ -1305,6 +1305,18 @@  void net_check_clients(void)
     VLANState *vlan;
     VLANClientState *vc;
 
+    /* Don't warn about the default network setup that you get if
+     * no command line -net or -netdev options are specified. There
+     * are two cases that we would otherwise complain about:
+     * (1) board doesn't support a NIC but the implicit "-net nic"
+     * requested one
+     * (2) CONFIG_SLIRP not set, in which case the implicit "-net nic"
+     * sets up a nic that isn't connected to anything.
+     */
+    if (default_net) {
+        return;
+    }
+
     QTAILQ_FOREACH(vlan, &vlans, next) {
         int has_nic = 0, has_host_dev = 0;