qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PULL 4/4] net: disallow to specify multicast MAC addre


From: Dmitry Krivenok
Subject: Re: [Qemu-devel] [PULL 4/4] net: disallow to specify multicast MAC address
Date: Sat, 19 Oct 2013 00:08:14 +0400

> Duplicate, we already have is_multicast_ether_addr() in include/net/eth.h

I tried to #include "net/eth.h" in net/net.c, but it didn't work:

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) {

$ make
  CC    net/net.o
In file included from /home/krivenok/qemu/include/qemu/sockets.h:18,
                 from net/net.c:35:
/usr/include/netinet/in.h:199: error: redefinition of 'struct in6_addr'
make: *** [net/net.o] Error 1
$

eth.h seems to be used only in vmware specific code and likely needs
to be fixed to be used in other places.
Other option is to move is_*_ether_addr() functions to another header
and include it in both places.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]