[virt-tools-list] random MAC generation and top bit?

Daniel P. Berrange berrange at redhat.com
Mon Nov 30 15:27:28 UTC 2009


On Mon, Nov 30, 2009 at 10:24:50AM -0500, John Levon wrote:
> 
>     mac = oui + [
>             random.randint(0x00, 0x7f),
>             random.randint(0x00, 0xff),
>             random.randint(0x00, 0xff) ]
>     return ':'.join(map(lambda x: "%02x" % x, mac))
> 
> Why the 0x7f?

Looks like a typo to me - there's no reason to restrict the first
byte in this way


Daniel
-- 
|: Red Hat, Engineering, London   -o-   http://people.redhat.com/berrange/ :|
|: http://libvirt.org  -o-  http://virt-manager.org  -o-  http://ovirt.org :|
|: http://autobuild.org       -o-         http://search.cpan.org/~danberr/ :|
|: GnuPG: 7D3B9505  -o-  F3C9 553F A1DA 4AC2 5648 23C1 B3DF F742 7D3B 9505 :|




More information about the virt-tools-list mailing list