From patchwork Tue Oct 22 09:21:08 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Amos Kong X-Patchwork-Id: 285387 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 4C96C2C0097 for ; Tue, 22 Oct 2013 20:22:28 +1100 (EST) Received: from localhost ([::1]:43764 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VYYAT-0007UZ-G0 for incoming@patchwork.ozlabs.org; Tue, 22 Oct 2013 05:22:25 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:57421) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VYYA3-0007UP-UU for qemu-devel@nongnu.org; Tue, 22 Oct 2013 05:22:05 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1VYY9x-0005ph-RT for qemu-devel@nongnu.org; Tue, 22 Oct 2013 05:21:59 -0400 Received: from mx1.redhat.com ([209.132.183.28]:1862) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VYY9x-0005pS-J5 for qemu-devel@nongnu.org; Tue, 22 Oct 2013 05:21:53 -0400 Received: from int-mx10.intmail.prod.int.phx2.redhat.com (int-mx10.intmail.prod.int.phx2.redhat.com [10.5.11.23]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id r9M9LCT2030126 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Tue, 22 Oct 2013 05:21:13 -0400 Received: from localhost (vpn1-49-115.bne.redhat.com [10.64.49.115]) by int-mx10.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id r9M9L9i0005663; Tue, 22 Oct 2013 05:21:11 -0400 Date: Tue, 22 Oct 2013 17:21:08 +0800 From: Amos Kong To: Dmitry Krivenok Message-ID: <20131022092108.GA3085@amosk.info> References: <1382103314-21608-1-git-send-email-stefanha@redhat.com> <1382103314-21608-5-git-send-email-stefanha@redhat.com> <20131018145655.GA22563@amosk.info> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.21 (2010-09-15) X-Scanned-By: MIMEDefang 2.68 on 10.5.11.23 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 209.132.183.28 Cc: qemu-devel@nongnu.org, Stefan Hajnoczi , Anthony Liguori Subject: Re: [Qemu-devel] [PULL 4/4] net: disallow to specify multicast MAC address X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org 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 , you can remove the definition in eth.h > > 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. 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 #include +#include #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 {