This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
Home Products Support Community News


[Xen-devel] [PATCH] Really randomize generated MAC addresses

To: xen-devel@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-devel] [PATCH] Really randomize generated MAC addresses
From: James Dykman <dykman@xxxxxxxxxx>
Date: Tue, 16 Aug 2005 14:48:29 -0400
Delivery-date: Tue, 16 Aug 2005 18:49:17 +0000
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
Importance: Normal
List-help: <mailto:xen-devel-request@lists.xensource.com?subject=help>
List-id: Xen developer discussion <xen-devel.lists.xensource.com>
List-post: <mailto:xen-devel@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=unsubscribe>
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
Randomly generated vif MAC addresses are decidedly non-random..... 
duplicate even. I tracked it down to the PRNG being re-seeded
with the same seed (the current timestamp) for each vif.


# HG changeset patch
# User Jim Dykman dykman@xxxxxxxxxx
# Node ID 06be64b17a136d2d6029b500611e32199b8065f1
# Parent  3d187585c1415fbb14cb285cc71e0ff0faf81e67

Really randomize generated MAC addresses
random.seed() uses the timestamp as a new seed and we're calling
randomMAC faster than the timestamp changes, resulting in duplicate MACs.

Signed-off-by: Jim Dykman <dykman@xxxxxxxxxx>

diff -r 3d187585c141 -r 06be64b17a13 tools/python/xen/xm/create.py
--- a/tools/python/xen/xm/create.py     Tue Aug 16 11:20:47 2005
+++ b/tools/python/xen/xm/create.py     Tue Aug 16 17:07:25 2005
@@ -380,7 +380,6 @@

     @return: MAC address string
-    random.seed()
     mac = [ 0xaa, 0x00, 0x00,
             random.randint(0x00, 0x7f),
             random.randint(0x00, 0xff),

Xen-devel mailing list

<Prev in Thread] Current Thread [Next in Thread>
  • [Xen-devel] [PATCH] Really randomize generated MAC addresses, James Dykman <=