From 31288324bd348c7775fd7c28946093c7d57144a5 Mon Sep 17 00:00:00 2001 From: jbjohnso Date: Fri, 2 Oct 2009 14:48:26 +0000 Subject: [PATCH] -Reseed random generator to reduce chances of collision (though uniqueness still should be guaranteed elsewhere) git-svn-id: https://svn.code.sf.net/p/xcat/code/xcat-core/trunk@4284 8638fb3e-16cb-4fca-ae20-7b5d299a9bcd --- perl-xCAT/xCAT/VMCommon.pm | 1 + 1 file changed, 1 insertion(+) diff --git a/perl-xCAT/xCAT/VMCommon.pm b/perl-xCAT/xCAT/VMCommon.pm index b935e4e1d..c29c6e402 100644 --- a/perl-xCAT/xCAT/VMCommon.pm +++ b/perl-xCAT/xCAT/VMCommon.pm @@ -85,6 +85,7 @@ sub getMacAddresses { sub genMac { #Generates a mac address for a node, does NOT assure uniqueness, calling code needs to do that my $node=shift; my $prefix = shift; + srand(); #Re-seed the rng. I haven't been able to reproduce it, but duplicate macs were somehow making it if ($prefix) { #Specific prefix requested, honor it my $tail = int(rand(0xffffff)); #With only 24 bits of space, use random bits; $tail = sprintf("%06x",$tail);