fix mac address generation limitation

Commit de9a267 introduced vec() to optimize the generation
by using binary operations instead of converting back and
forth between hex and strings, but forgot to switch over to
the binary sha1 method. This resulted in only the first 6
hex digits of the output string making up the address.
This commit is contained in:
Wolfgang Bumiller 2016-07-05 12:40:23 +02:00 committed by Fabian Grünbichler
parent e561bc74bb
commit d743b69c4b

View File

@ -983,7 +983,7 @@ sub random_ether_addr {
my ($seconds, $microseconds) = gettimeofday;
my $rand = Digest::SHA::sha1_hex($$, rand(), $seconds, $microseconds);
my $rand = Digest::SHA::sha1($$, rand(), $seconds, $microseconds);
# clear multicast, set local id
vec($rand, 0, 8) = (vec($rand, 0, 8) & 0xfe) | 2;