diff options
Diffstat (limited to 'include/linux/etherdevice.h')
| -rw-r--r-- | include/linux/etherdevice.h | 25 |
1 files changed, 19 insertions, 6 deletions
diff --git a/include/linux/etherdevice.h b/include/linux/etherdevice.h index 3d406e0ede6d..d426336d92d9 100644 --- a/include/linux/etherdevice.h +++ b/include/linux/etherdevice.h | |||
| @@ -124,17 +124,30 @@ 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 | */ |
| 133 | static inline void random_ether_addr(u8 *addr) | 133 | static 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 | } | ||
| 139 | |||
| 140 | #define random_ether_addr(addr) eth_random_addr(addr) | ||
| 141 | |||
| 142 | /** | ||
| 143 | * eth_broadcast_addr - Assign broadcast address | ||
| 144 | * @addr: Pointer to a six-byte array containing the Ethernet address | ||
| 145 | * | ||
| 146 | * Assign the broadcast address to the given address array. | ||
| 147 | */ | ||
| 148 | static inline void eth_broadcast_addr(u8 *addr) | ||
| 149 | { | ||
| 150 | memset(addr, 0xff, ETH_ALEN); | ||
| 138 | } | 151 | } |
| 139 | 152 | ||
| 140 | /** | 153 | /** |
| @@ -149,7 +162,7 @@ static inline void random_ether_addr(u8 *addr) | |||
| 149 | static inline void eth_hw_addr_random(struct net_device *dev) | 162 | static inline void eth_hw_addr_random(struct net_device *dev) |
| 150 | { | 163 | { |
| 151 | dev->addr_assign_type |= NET_ADDR_RANDOM; | 164 | dev->addr_assign_type |= NET_ADDR_RANDOM; |
| 152 | random_ether_addr(dev->dev_addr); | 165 | eth_random_addr(dev->dev_addr); |
| 153 | } | 166 | } |
| 154 | 167 | ||
| 155 | /** | 168 | /** |
