mirror of
https://git.proxmox.com/git/pve-common
synced 2025-08-03 19:06:13 +00:00
random_ether_addr: code cleanups
This commit is contained in:
parent
de9a267fec
commit
85d5625a15
@ -940,15 +940,10 @@ sub random_ether_addr {
|
||||
|
||||
my $rand = Digest::SHA::sha1_hex($$, rand(), $seconds, $microseconds);
|
||||
|
||||
# clear multicast, set local id
|
||||
# clear multicast, set local id
|
||||
vec($rand, 0, 8) = (vec($rand, 0, 8) & 0xfe) | 2;
|
||||
|
||||
my $mac = sprintf("%02X:" x 6, unpack("C6", $rand));
|
||||
|
||||
# remove superfluous ":" at end
|
||||
chop($mac);
|
||||
|
||||
return $mac;
|
||||
return sprintf("%02X:%02X:%02X:%02X:%02X:%02X", unpack("C6", $rand));
|
||||
}
|
||||
|
||||
sub shellquote {
|
||||
|
Loading…
Reference in New Issue
Block a user