Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 315373
b: refs/heads/master
c: 0a4dd59
h: refs/heads/master
i:
  315371: c4de18a
v: v3
  • Loading branch information
Joe Perches authored and David S. Miller committed Jul 17, 2012
1 parent 5d4ae28 commit 5a71348
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 7 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 07689b0a5c26176c528d7864b93188045439f49b
refs/heads/master: 0a4dd594982a321699000218715e28664ec49169
14 changes: 8 additions & 6 deletions trunk/include/linux/etherdevice.h
Original file line number Diff line number Diff line change
Expand Up @@ -124,19 +124,21 @@ static inline bool is_valid_ether_addr(const u8 *addr)
}

/**
* random_ether_addr - Generate software assigned random Ethernet address
* eth_random_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)
static inline void eth_random_addr(u8 *addr)
{
get_random_bytes (addr, ETH_ALEN);
addr [0] &= 0xfe; /* clear multicast bit */
addr [0] |= 0x02; /* set local assignment bit (IEEE802) */
get_random_bytes(addr, ETH_ALEN);
addr[0] &= 0xfe; /* clear multicast bit */
addr[0] |= 0x02; /* set local assignment bit (IEEE802) */
}

#define random_ether_addr(addr) eth_random_addr(addr)

/**
* eth_broadcast_addr - Assign broadcast address
* @addr: Pointer to a six-byte array containing the Ethernet address
Expand All @@ -160,7 +162,7 @@ static inline void eth_broadcast_addr(u8 *addr)
static inline void eth_hw_addr_random(struct net_device *dev)
{
dev->addr_assign_type |= NET_ADDR_RANDOM;
random_ether_addr(dev->dev_addr);
eth_random_addr(dev->dev_addr);
}

/**
Expand Down

0 comments on commit 5a71348

Please sign in to comment.