summaryrefslogtreecommitdiff
path: root/net.c
diff options
context:
space:
mode:
authorMarkus Armbruster <armbru@redhat.com>2010-02-26 15:50:51 +0100
committerAnthony Liguori <aliguori@us.ibm.com>2010-03-09 08:47:20 -0600
commit27f3f8a362570c5e9eb89b36b6c6d5db7b6e70e3 (patch)
treed0de32edc07951138978e8425d09084d3930838d /net.c
parent6bf38816df80a3b50529119c5458b151b3e2c728 (diff)
downloadqemu-27f3f8a362570c5e9eb89b36b6c6d5db7b6e70e3.tar.gz
qemu-27f3f8a362570c5e9eb89b36b6c6d5db7b6e70e3.tar.bz2
qemu-27f3f8a362570c5e9eb89b36b6c6d5db7b6e70e3.zip
qdev: Catch attempt to attach more than one device to a netdev
Guest device and host netdev are peers, i.e. it's a 1:1 relation. However, we fail to enforce that: $ qemu -nodefaults --nographic -netdev user,id=net0 -device e1000,netdev=net0 -device virtio-net-pci,netdev=net0 -monitor stdio QEMU 0.12.50 monitor - type 'help' for more information (qemu) info network Devices not on any VLAN: net0: net=10.0.2.0, restricted=n peer=virtio-net-pci.0 e1000.0: model=e1000,macaddr=52:54:00:12:34:56 peer=net0 virtio-net-pci.0: model=virtio-net-pci,macaddr=52:54:00:12:34:57 peer=net0 It's all downhill from there. Signed-off-by: Markus Armbruster <armbru@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Diffstat (limited to 'net.c')
-rw-r--r--net.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/net.c b/net.c
index dd3962e142..e47f727629 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;
}