Re: What makes a good fake MAC address?

Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
From: Eric Dumazet
Date: Wednesday, April 22, 2009 - 2:13 pm

Inaky Perez-Gonzalez a écrit :

We have random_ether_addr(), it should be self explained :)

/**
 * random_ether_addr - Generate software assigned random Ethernet address
 * @addr: Pointer to a six-byte array containing the Ethernet address
 *
 * Generate a random Ethernet address (MAC) that is not multicast
 * and has the local assigned bit set.
 */
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) */
}




--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
What makes a good fake MAC address?, Inaky Perez-Gonzalez, (Wed Apr 22, 1:48 pm)
Re: What makes a good fake MAC address?, Stephen Hemminger, (Wed Apr 22, 2:13 pm)
Re: What makes a good fake MAC address?, Eric Dumazet, (Wed Apr 22, 2:13 pm)
Re: What makes a good fake MAC address?, Inaky Perez-Gonzalez, (Wed Apr 22, 2:28 pm)