[pve-devel] [PATCH common] fix mac address generation limitation

Fabian Grünbichler f.gruenbichler at proxmox.com
Tue Jul 5 13:44:25 CEST 2016


applied

On Tue, Jul 05, 2016 at 12:40:23PM +0200, Wolfgang Bumiller wrote:
> 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.
> ---
>  src/PVE/Tools.pm | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/src/PVE/Tools.pm b/src/PVE/Tools.pm
> index 68c4e68..0d03b04 100644
> --- a/src/PVE/Tools.pm
> +++ b/src/PVE/Tools.pm
> @@ -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;
> -- 
> 2.1.4
> 
> 
> _______________________________________________
> pve-devel mailing list
> pve-devel at pve.proxmox.com
> http://pve.proxmox.com/cgi-bin/mailman/listinfo/pve-devel
> 



More information about the pve-devel mailing list