All of lore.kernel.org
 help / color / mirror / Atom feed
From: Amos Kong <akong@redhat.com>
To: Dmitry Krivenok <krivenok.dmitry@gmail.com>
Cc: qemu-devel@nongnu.org, Stefan Hajnoczi <stefanha@redhat.com>,
	Anthony Liguori <aliguori@amazon.com>
Subject: Re: [Qemu-devel] [PULL 4/4] net: disallow to specify multicast MAC address
Date: Tue, 22 Oct 2013 17:21:08 +0800	[thread overview]
Message-ID: <20131022092108.GA3085@amosk.info> (raw)
In-Reply-To: <CAJN_NGZBZ14+idHGZOZm-bEA7VfhSfmFc8JXeh-PmURdDF3vZg@mail.gmail.com>

On Sat, Oct 19, 2013 at 12:08:14AM +0400, Dmitry Krivenok wrote:
> > 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
> $

Hi Dmitry,

"struct in6_addr" exists in <netinet/in.h>, you can remove the
definition in eth.h

diff --git a/include/net/eth.h b/include/net/eth.h
index 1d48e06..1cce570 100644
--- a/include/net/eth.h
+++ b/include/net/eth.h
@@ -28,6 +28,7 @@
 
 #include <sys/types.h>
 #include <string.h>
+#include <netinet/in.h>
 #include "qemu/bswap.h"
 #include "qemu/iov.h"
 
@@ -83,13 +84,6 @@ typedef struct ip_pseudo_header {
     uint16_t ip_payload;
 } ip_pseudo_header;
 
-/* IPv6 address */
-struct in6_addr {
-    union {
-        uint8_t __u6_addr8[16];
-    } __in6_u;
-};
-
 struct ip6_header {
     union {
         struct ip6_hdrctl {

> 
> 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.

-- 
			Amos.

  reply	other threads:[~2013-10-22  9:22 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-10-18 13:35 [Qemu-devel] [PULL 0/4] Net patches Stefan Hajnoczi
2013-10-18 13:35 ` [Qemu-devel] [PULL 1/4] net: update nic info during device reset Stefan Hajnoczi
2013-10-18 13:35 ` [Qemu-devel] [PULL 2/4] net/e1000: update network information when macaddr is changed in guest Stefan Hajnoczi
2013-10-18 13:35 ` [Qemu-devel] [PULL 3/4] net/rtl8139: " Stefan Hajnoczi
2013-10-18 13:35 ` [Qemu-devel] [PULL 4/4] net: disallow to specify multicast MAC address Stefan Hajnoczi
2013-10-18 14:56   ` Amos Kong
2013-10-18 16:34     ` Stefan Hajnoczi
2013-10-18 16:39       ` Eric Blake
2013-10-18 16:41     ` Stefan Hajnoczi
2013-10-18 17:37       ` Dmitry Krivenok
2013-10-18 20:08     ` Dmitry Krivenok
2013-10-22  9:21       ` Amos Kong [this message]
2013-10-22  9:51         ` Dmitry Krivenok

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20131022092108.GA3085@amosk.info \
    --to=akong@redhat.com \
    --cc=aliguori@amazon.com \
    --cc=krivenok.dmitry@gmail.com \
    --cc=qemu-devel@nongnu.org \
    --cc=stefanha@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.