All of lore.kernel.org
 help / color / mirror / Atom feed
From: Marcelo Tosatti <mtosatti@redhat.com>
To: Markus Armbruster <armbru@redhat.com>
Cc: qemu-devel@nongnu.org
Subject: [Qemu-devel] [PATCH] net: fix default MAC assignment for hotplugged NICs
Date: Thu, 28 Jul 2011 12:12:16 -0300	[thread overview]
Message-ID: <20110728151216.GA18809@amt.cnet> (raw)


The index for assignment of default MAC address is duplicated:
qemu_macaddr_default_if_unset has its own variable and net_init_nic uses
the nic table index.

This leads to assignment of same MAC addresses to NICs initialized via
command line and hotplugged ones.

Fix by not assigning default MAC address in net_init_nic, leaving
that job to qemu_macaddr_default_if_unset.

Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
Reported-by: Amos Kong <akong@redhat.com>
BZ: https://bugzilla.redhat.com/show_bug.cgi?id=712046

diff --git a/net.c b/net.c
index 66123ad..f34400c 100644
--- a/net.c
+++ b/net.c
@@ -776,13 +776,6 @@ static int net_init_nic(QemuOpts *opts,
         nd->devaddr = qemu_strdup(qemu_opt_get(opts, "addr"));
     }
 
-    nd->macaddr[0] = 0x52;
-    nd->macaddr[1] = 0x54;
-    nd->macaddr[2] = 0x00;
-    nd->macaddr[3] = 0x12;
-    nd->macaddr[4] = 0x34;
-    nd->macaddr[5] = 0x56 + idx;
-
     if (qemu_opt_get(opts, "macaddr") &&
         net_parse_macaddr(nd->macaddr, qemu_opt_get(opts, "macaddr")) < 0) {
         error_report("invalid syntax for ethernet address");

             reply	other threads:[~2011-07-28 15:12 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-07-28 15:12 Marcelo Tosatti [this message]
2011-07-28 15:22 ` [Qemu-devel] [PATCH] net: fix default MAC assignment for hotplugged NICs Peter Maydell
2011-07-28 15:26   ` Marcelo Tosatti

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=20110728151216.GA18809@amt.cnet \
    --to=mtosatti@redhat.com \
    --cc=armbru@redhat.com \
    --cc=qemu-devel@nongnu.org \
    /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.