Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
L
linux
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
linux
Commits
ed58762a
Commit
ed58762a
authored
Apr 09, 2004
by
Stephen Hemminger
Committed by
David S. Miller
Apr 09, 2004
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[NET]: Add random_ether_addr to ether_device.h
parent
ee02b9e0
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
14 additions
and
0 deletions
+14
-0
include/linux/etherdevice.h
include/linux/etherdevice.h
+14
-0
No files found.
include/linux/etherdevice.h
View file @
ed58762a
...
...
@@ -25,6 +25,7 @@
#define _LINUX_ETHERDEVICE_H
#include <linux/if_ether.h>
#include <linux/random.h>
#ifdef __KERNEL__
extern
int
eth_header
(
struct
sk_buff
*
skb
,
struct
net_device
*
dev
,
...
...
@@ -64,6 +65,19 @@ static inline int is_valid_ether_addr( const u8 *addr )
return
!
(
addr
[
0
]
&
1
)
&&
memcmp
(
addr
,
zaddr
,
6
);
}
/**
* 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) */
}
#endif
#endif
/* _LINUX_ETHERDEVICE_H */
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment