summary refs log tree commit diff stats
path: root/net/hub.c
diff options
context:
space:
mode:
authorMarkus Armbruster <armbru@redhat.com>2015-05-15 13:58:49 +0200
committerStefan Hajnoczi <stefanha@redhat.com>2015-05-27 09:51:04 +0100
commitca7eb1848bb06d9b75784d7760b83c7b0beb1102 (patch)
tree0ba064ee634dc92b920a6b7d8453a827335fbaf4 /net/hub.c
parent6a8b4a5be21ad4941c8a6a5db1d355a522aea2fb (diff)
downloadfocaccia-qemu-ca7eb1848bb06d9b75784d7760b83c7b0beb1102.tar.gz
focaccia-qemu-ca7eb1848bb06d9b75784d7760b83c7b0beb1102.zip
net: Improve error message for -net hubport a bit
Type "hubport" is valid only with -netdev.  Unfortunately, that's
detected late and the error message doesn't explain why:

    $ qemu-system-i386 -net hubport,id=foo,hubid=0
    qemu-system-i386: -net hubport,id=foo,hubid=0: Device 'hubport' could not be initialized

Improve the error message to "Parameter 'type' expects a net type".

Not fixed: -net hubport without the parameters required by -netdev
hubport still asks for those parameters:

    $ qemu-system-i386 -net hubport
    qemu-system-i386: -net hubport: Parameter 'hubid' is missing

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Message-id: 1431691143-1015-2-git-send-email-armbru@redhat.com
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
Diffstat (limited to 'net/hub.c')
-rw-r--r--net/hub.c5
1 files changed, 1 insertions, 4 deletions
diff --git a/net/hub.c b/net/hub.c
index 2b60ab9a60..261f8ccc3f 100644
--- a/net/hub.c
+++ b/net/hub.c
@@ -286,12 +286,9 @@ int net_init_hubport(const NetClientOptions *opts, const char *name,
     const NetdevHubPortOptions *hubport;
 
     assert(opts->kind == NET_CLIENT_OPTIONS_KIND_HUBPORT);
+    assert(!peer);
     hubport = opts->hubport;
 
-    if (peer) {
-        return -EINVAL;
-    }
-
     net_hub_add_port(hubport->hubid, name);
     return 0;
 }