aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/etherdevice.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/linux/etherdevice.h')
-rw-r--r--include/linux/etherdevice.h14
1 files changed, 8 insertions, 6 deletions
diff --git a/include/linux/etherdevice.h b/include/linux/etherdevice.h
index 98a27cccedfd..d426336d92d9 100644
--- a/include/linux/etherdevice.h
+++ b/include/linux/etherdevice.h
@@ -124,19 +124,21 @@ static inline bool is_valid_ether_addr(const u8 *addr)
124} 124}
125 125
126/** 126/**
127 * random_ether_addr - Generate software assigned random Ethernet address 127 * eth_random_addr - Generate software assigned random Ethernet address
128 * @addr: Pointer to a six-byte array containing the Ethernet address 128 * @addr: Pointer to a six-byte array containing the Ethernet address
129 * 129 *
130 * Generate a random Ethernet address (MAC) that is not multicast 130 * Generate a random Ethernet address (MAC) that is not multicast
131 * and has the local assigned bit set. 131 * and has the local assigned bit set.
132 */ 132 */
133static inline void random_ether_addr(u8 *addr) 133static inline void eth_random_addr(u8 *addr)
134{ 134{
135 get_random_bytes (addr, ETH_ALEN); 135 get_random_bytes(addr, ETH_ALEN);
136 addr [0] &= 0xfe; /* clear multicast bit */ 136 addr[0] &= 0xfe; /* clear multicast bit */
137 addr [0] |= 0x02; /* set local assignment bit (IEEE802) */ 137 addr[0] |= 0x02; /* set local assignment bit (IEEE802) */
138} 138}
139 139
140#define random_ether_addr(addr) eth_random_addr(addr)
141
140/** 142/**
141 * eth_broadcast_addr - Assign broadcast address 143 * eth_broadcast_addr - Assign broadcast address
142 * @addr: Pointer to a six-byte array containing the Ethernet address 144 * @addr: Pointer to a six-byte array containing the Ethernet address
@@ -160,7 +162,7 @@ static inline void eth_broadcast_addr(u8 *addr)
160static inline void eth_hw_addr_random(struct net_device *dev) 162static inline void eth_hw_addr_random(struct net_device *dev)
161{ 163{
162 dev->addr_assign_type |= NET_ADDR_RANDOM; 164 dev->addr_assign_type |= NET_ADDR_RANDOM;
163 random_ether_addr(dev->dev_addr); 165 eth_random_addr(dev->dev_addr);
164} 166}
165 167
166/** 168/**