From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:44050) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UolJ4-0001dH-UY for qemu-devel@nongnu.org; Mon, 17 Jun 2013 22:06:05 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UolJ2-0003Yt-Ke for qemu-devel@nongnu.org; Mon, 17 Jun 2013 22:06:02 -0400 Received: from mx1.redhat.com ([209.132.183.28]:28335) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UolJ2-0003Yn-C5 for qemu-devel@nongnu.org; Mon, 17 Jun 2013 22:06:00 -0400 Date: Tue, 18 Jun 2013 10:05:58 +0800 From: Fam Zheng Message-ID: <20130618020558.GA9666@localhost.nay.redhat.com> References: <1371476111-4449-1-git-send-email-akong@redhat.com> <1371476111-4449-2-git-send-email-akong@redhat.com> <20130617140018.GA10085@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20130617140018.GA10085@redhat.com> Subject: Re: [Qemu-devel] [PATCH 1/2] avoid to allcate used macaddr to to new nic List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: "Michael S. Tsirkin" Cc: aliguori@us.ibm.com, Amos Kong , qemu-devel@nongnu.org, stefanha@redhat.com On Mon, 06/17 17:00, Michael S. Tsirkin wrote: > On Mon, Jun 17, 2013 at 09:35:10PM +0800, Amos Kong wrote: > > QEMU allocates macaddr to nic if user doesn't assigne macaddr. > > But we didn't check if the allocated macaddr is used, it might > > cause macaddr repeated. > > > > # qemu -device e1000,netdev=h1,mac=52:54:00:12:34:56 > > (qemu) device_add e1000 > > (qemu) info network > > e1000.0: index=0,type=nic,model=e1000,macaddr=52:54:00:12:34:56 > > \ h1: index=0,type=user,net=10.0.2.0,restrict=off > > e1000.1: index=0,type=nic,model=e1000,macaddr=52:54:00:12:34:56 > > > > This patch adds a check in allocating macaddr, reallocate macaddr > > if it's used by other nic. > > > > Signed-off-by: Amos Kong > > I'm not sure this is not exactly what was intended in this case. > Also this ptotects against an unlikely case of mixing > implicit and explicit addresses, but not against > a likely case of multiple qemu on same LAN using same MAC. IMHO, either way we can do little to protect against collision of multiple qemu on the same LAN, but at least this patch protects against repeated MAC address in one qemu instance. Better in some degree. Leaving it to user, and asking for address explictly, absolutely helps, but makes the interface a bit harder to use: there are still cases user wants it generated automatically. Just wondering if a random one could be better? -- Fam