All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Michael S. Tsirkin" <mst@redhat.com>
To: Amos Kong <akong@redhat.com>,
	aliguori@us.ibm.com, qemu-devel@nongnu.org, stefanha@redhat.com
Subject: Re: [Qemu-devel] [PATCH 1/2] avoid to allcate used macaddr to to new nic
Date: Tue, 18 Jun 2013 09:27:35 +0300	[thread overview]
Message-ID: <20130618062735.GC23367@redhat.com> (raw)
In-Reply-To: <20130618020558.GA9666@localhost.nay.redhat.com>

On Tue, Jun 18, 2013 at 10:05:58AM +0800, Fam Zheng wrote:
> 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 <akong@redhat.com>
> > 
> > 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.

This is a policy, we should not dictate it.
Maybe you want same MAC for some reason?

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

A user that does not want to know what "MAC" even means
is the only one I'm aware of. This is not such a case.

> Just wondering if a random one could be better?

If we are talking about a guest with multiple NICs,
if you generate MACs randomly guest won't know which is which.

It also breaks assumptions guests make that MAC
is a static property of hardware. E.g. it can force windows
re-activation, break resume from suspend etc

> -- 
> Fam

  reply	other threads:[~2013-06-18  6:26 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-06-17 13:35 [Qemu-devel] [PATCH 0/2] fix macaddr allocation Amos Kong
2013-06-17 13:35 ` [Qemu-devel] [PATCH 1/2] avoid to allcate used macaddr to to new nic Amos Kong
2013-06-17 14:00   ` Michael S. Tsirkin
2013-06-18  2:05     ` Fam Zheng
2013-06-18  6:27       ` Michael S. Tsirkin [this message]
2013-06-17 13:35 ` [Qemu-devel] [PATCH 2/2] extend the macaddr space to 0xffffffff Amos Kong
2013-06-17 14:04   ` Michael S. Tsirkin
2013-06-18  1:51     ` Amos Kong
2013-06-18  6:19       ` Michael S. Tsirkin
2013-06-18 11:21 ` [Qemu-devel] [PATCH 0/2] fix macaddr allocation Stefan Hajnoczi
2013-06-18 12:39   ` Amos Kong

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=20130618062735.GC23367@redhat.com \
    --to=mst@redhat.com \
    --cc=akong@redhat.com \
    --cc=aliguori@us.ibm.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.