summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--hw/qdev-properties.c7
-rw-r--r--net.c1
2 files changed, 8 insertions, 0 deletions
diff --git a/hw/qdev-properties.c b/hw/qdev-properties.c
index 438eaea4d..24671aff9 100644
--- a/hw/qdev-properties.c
+++ b/hw/qdev-properties.c
@@ -341,6 +341,9 @@ static int parse_netdev(DeviceState *dev, Property *prop, const char *str)
*ptr = qemu_find_netdev(str);
if (*ptr == NULL)
return -ENOENT;
+ if ((*ptr)->peer) {
+ return -EEXIST;
+ }
return 0;
}
@@ -557,6 +560,10 @@ int qdev_prop_parse(DeviceState *dev, const char *name, const char *value)
ret = prop->info->parse(dev, prop, value);
if (ret < 0) {
switch (ret) {
+ case -EEXIST:
+ fprintf(stderr, "property \"%s.%s\": \"%s\" is already in use\n",
+ dev->info->name, name, value);
+ break;
default:
case -EINVAL:
fprintf(stderr, "property \"%s.%s\": failed to parse \"%s\"\n",
diff --git a/net.c b/net.c
index dd3962e14..e47f72762 100644
--- a/net.c
+++ b/net.c
@@ -246,6 +246,7 @@ VLANClientState *qemu_new_net_client(NetClientInfo *info,
QTAILQ_INSERT_TAIL(&vc->vlan->clients, vc, next);
} else {
if (peer) {
+ assert(!peer->peer);
vc->peer = peer;
peer->peer = vc;
}