diff options
-rw-r--r-- | net/hub.c | 5 | ||||
-rw-r--r-- | net/net.c | 5 |
2 files changed, 6 insertions, 4 deletions
@@ -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; } @@ -882,6 +882,11 @@ static int net_client_init1(const void *object, int is_netdev, Error **errp) } else { u.net = object; opts = u.net->opts; + if (opts->kind == NET_CLIENT_OPTIONS_KIND_HUBPORT) { + error_set(errp, QERR_INVALID_PARAMETER_VALUE, "type", + "a net type"); + return -1; + } /* missing optional values have been initialized to "all bits zero" */ name = u.net->has_id ? u.net->id : u.net->name; } |