[Users] Veth mac generation

Dietmar Maurer dietmar at proxmox.com
Wed Jun 11 06:46:31 EDT 2008


Hi all,

The code to generate mac addresses for veth (generate_mac in veth.c)
uses the
Constant SW_OUI for upper 3 bytes, and random values for lower 3 bytes.
Thus 
giving 2^24 possible values.

Isn't it better to use random numbers for all 6 bytes, like the code 
in the linux kernel:

static inline void random_ether_addr(u8 *addr)
{
        get_random_bytes (addr, ETH_ALEN);
        addr [0] &= 0xfe;       /* clear multicast bit */
        addr [0] |= 0x02;       /* set local assignment bit (IEEE802) */
}

That would make conflict less likely.

- Dietmar





More information about the Users mailing list