OpenVZ Forum


Home » Mailing lists » Users » Veth mac generation
Re: Veth mac generation [message #30973 is a reply to message #30964] Wed, 11 June 2008 13:46 Go to previous messageGo to previous message
Kirill Korotaev is currently offline  Kirill Korotaev
Messages: 137
Registered: January 2006
Senior Member
and yes and no.
These upper 3 bytes are reserved for our company, so selecting them you
will never conflict with other devices in network infrastructure.
i.e. the worst what can happen 2 veths will conflict.

On the other hand - you are right, 6 bytes are better :)

Kirill

Dietmar Maurer wrote:
> 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: Fri Oct 18 03:12:50 GMT 2024

Total time taken to generate the page: 0.05163 seconds