aboutsummaryrefslogtreecommitdiff
path: root/net
diff options
context:
space:
mode:
authorDmitry Krivenok <krivenok.dmitry@gmail.com>2013-10-21 12:08:44 +0400
committerStefan Hajnoczi <stefanha@redhat.com>2013-11-08 17:32:34 +0100
commitd60b20cf2ae6644b05159b9361cba83fb6c0cb84 (patch)
tree604f933282237e67d258dde4ad0896a8ea0fdc49 /net
parent964668b03d26f0b5baa5e5aff0c966f4fcb76e9e (diff)
downloadqemu-d60b20cf2ae6644b05159b9361cba83fb6c0cb84.zip
qemu-d60b20cf2ae6644b05159b9361cba83fb6c0cb84.tar.gz
qemu-d60b20cf2ae6644b05159b9361cba83fb6c0cb84.tar.bz2
net: disallow to specify multicast MAC address
[Assigning a multicast MAC address to a NIC leads to confusing behavior. Reject multicast MAC addresses so users are alerted to their error straight away. The "net/eth.h" in6_addr rename prevents a name collision with <netinet/in.h> on Linux. -- Stefan] Signed-off-by: Dmitry V. Krivenok <krivenok.dmitry@gmail.com> Reviewed-by: Amos Kong <kongjianjun@gmail.com> Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
Diffstat (limited to 'net')
-rw-r--r--net/net.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/net/net.c b/net/net.c
index c330c9a..870d3bb 100644
--- a/net/net.c
+++ b/net/net.c
@@ -27,6 +27,7 @@
#include "clients.h"
#include "hub.h"
#include "net/slirp.h"
+#include "net/eth.h"
#include "util.h"
#include "monitor/monitor.h"
@@ -689,6 +690,11 @@ static int net_init_nic(const NetClientOptions *opts, const char *name,
error_report("invalid syntax for ethernet address");
return -1;
}
+ if (nic->has_macaddr &&
+ is_multicast_ether_addr(nd->macaddr.a)) {
+ error_report("NIC cannot have multicast MAC address (odd 1st byte)");
+ return -1;
+ }
qemu_macaddr_default_if_unset(&nd->macaddr);
if (nic->has_vectors) {