[Users] Veth mac generation

Kirill Korotaev dev at parallels.com
Wed Jun 11 09:46:49 EDT 2008


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
> 
> 
> 
> _______________________________________________
> Users mailing list
> Users at openvz.org
> https://openvz.org/mailman/listinfo/users
> 



More information about the Users mailing list