From patchwork Fri Oct 18 20:08:14 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Krivenok X-Patchwork-Id: 284713 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 460C82C00BD for ; Sat, 19 Oct 2013 07:08:35 +1100 (EST) Received: from localhost ([::1]:59266 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VXGLZ-0005Qd-0w for incoming@patchwork.ozlabs.org; Fri, 18 Oct 2013 16:08:33 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:37967) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VXGLJ-0005PA-3S for qemu-devel@nongnu.org; Fri, 18 Oct 2013 16:08:18 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1VXGLI-0003GH-6m for qemu-devel@nongnu.org; Fri, 18 Oct 2013 16:08:17 -0400 Received: from mail-la0-x234.google.com ([2a00:1450:4010:c03::234]:48725) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VXGLH-0003GB-Vi for qemu-devel@nongnu.org; Fri, 18 Oct 2013 16:08:16 -0400 Received: by mail-la0-f52.google.com with SMTP id ev20so1139683lab.39 for ; Fri, 18 Oct 2013 13:08:15 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; bh=ZtZp9vMiIhnzTXorTm3rHRlCN5xjG3pymfmeNnzAzMg=; b=VGmFvJk+iGCPsCMxAlAxKsDEImr3NMBr3vVUkm8bxX0LO0qpIt9FGK2H8ZCX515gXz bkXHL7viq7MEJggBz6Tcq3ld5TCodCvqi5wYZZUr3E3GtiO3KmBGoo0SH5n3r+PHmEd5 sjtEVJD6zv6Tt/I2EB4bBC8Kahc7V43jqml7QRagsh7p+P6n5eHTAx8THRyHmXM8bUTN DsDdglb0ZFeELasqKFZ0XDeML7EglC3oX9f/wkzTB4gw4WFOeXd4u9C/6w2ys6/myjlh akqIVF4SrObkz0YQQERZHRstYXGSyCwbPI43LtYjNFYGyXvp2cFU1do7jDQM3E1BiYr9 RHyw== MIME-Version: 1.0 X-Received: by 10.152.30.74 with SMTP id q10mr3174707lah.27.1382126894986; Fri, 18 Oct 2013 13:08:14 -0700 (PDT) Received: by 10.112.136.72 with HTTP; Fri, 18 Oct 2013 13:08:14 -0700 (PDT) In-Reply-To: <20131018145655.GA22563@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> Date: Sat, 19 Oct 2013 00:08:14 +0400 Message-ID: From: Dmitry Krivenok To: Amos Kong X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-Received-From: 2a00:1450:4010:c03::234 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 > 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: 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. 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);