OpenVZ Forum


Home » Mailing lists » Users » Veth mac generation
Veth mac generation [message #30964] Wed, 11 June 2008 10:46 Go to previous message
dietmar is currently offline  dietmar
Messages: 54
Registered: March 2007
Member
From: openvz.org
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
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: /usr/bin/hostid in VPS
Next Topic: Socket app hang in VE
Goto Forum:
  


Current Time: Tue Dec 10 03:25:29 GMT 2019