ethernet: avoid pre-assigned OUI values in random_ether_addr
Subsystems (2)
RFC 1/1 ethernet: avoid pre-assigned OUI values in random_ether_addr
There are some addresses in the assigned vendor block that don't obey the locally assigned convention. These should be avoided by random_ether_addr assignment.
--- include/linux/etherdevice.h | 17 +---------------- net/ethernet/eth.c | 42 ++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 43 insertions(+), 16 deletions(-)
include/linux/etherdevice.h +1 -16
@@ -45,8 +45,7 @@ extern void eth_header_cache_update(struextern int eth_mac_addr (struct net_device *dev,void *p);extern int eth_change_mtu (struct net_device *dev,int new_mtu);extern int eth_validate_addr (struct net_device *dev); - - +extern void random_ether_addr (u8 *addr);extern struct net_device *alloc_etherdev_mqs (int sizeof_priv,unsigned int txqs,unsigned int rxqs);
@@ -126,20 +125,6 @@ static inline int is_valid_ether_addr(co }/** -* 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) */ -} - -/** * dev_hw_addr_random - Create random MAC and set device flag * @dev: pointer to net_device structure * @hwaddr: Pointer to a six-byte array containing the Ethernet address
net/ethernet/eth.c +43 -0
46 lines not on this page · raw message
Quoted 3 lines · Stephen Hemminger
There are some addresses in the assigned vendor block that don't obey the locally assigned convention. These should be avoided by
random_ether_addrassignment.
How "recent" are these violations? Is there really a non-trivial chance of colliding? Much more than two or more stations in the same broadcast domain randomly picking the same random MAC anyway?
At one level, avoiding using those OUIs seems to be a tacit approval of the violations.
rick jones
Quoted 11 lines · On Fri, 13 May 2011 17:28:25 -0700 Rick Jones <[email protected]> wrote:
Quoted 3 lines · Stephen Hemminger
There are some addresses in the assigned vendor block that don't obey the locally assigned convention. These should be avoided by
random_ether_addrassignment.How "recent" are these violations? Is there really a non-trivial chance of colliding? Much more than two or more stations in the same broadcast domain randomly picking the same random MAC anyway?
At one level, avoiding using those OUIs seems to be a tacit approval of the violations.
These were assigned long ago in the early days of Ethernet. It makes sense to me to avoid them as just good policy.
Quoted 12 lines · Stephen Hemminger
Quoted 9 lines · On Fri, 13 May 2011 17:28:25 -0700 Rick Jones <[email protected]> wrote:
Quoted 3 lines · Stephen Hemminger
There are some addresses in the assigned vendor block that don't obey the locally assigned convention. These should be avoided by
random_ether_addrassignment.How "recent" are these violations? Is there really a non-trivial chance of colliding? Much more than two or more stations in the same broadcast domain randomly picking the same random MAC anyway?
Quoted 5 lines
Quoted 2 lines
At one level, avoiding using those OUIs seems to be a tacit approval of the violations.
These were assigned long ago in the early days of Ethernet. It makes sense to me to avoid them as just good policy.
Well, then by a quick glance at
http://standards.ieee.org/develop/regauth/oui/oui.txt it looks like there are more to add... (some overlap with your list, I've not checked the entire thing, how the name conflicts should be resolved I've no idea)
raj@tardy:~$ grep ^02- oui.txt 02-07-01 (hex) RACAL-DATACOM 02-1C-7C (hex) PERQ SYSTEMS CORPORATION 02-60-86 (hex) LOGIC REPLACEMENT TECH. LTD. 02-60-8C (hex) 3COM CORPORATION 02-70-01 (hex) RACAL-DATACOM 02-70-B0 (hex) M/A-COM INC. COMPANIES 02-70-B3 (hex) DATA RECALL LTD 02-9D-8E (hex) CARDIAC RECORDERS INC. 02-AA-3C (hex) OLIVETTI TELECOMM SPA (OLTECO) 02-BB-01 (hex) OCTOTHORPE CORP. 02-C0-8C (hex) 3COM CORPORATION 02-CF-1C (hex) COMMUNICATION MACHINERY CORP. 02-E6-D3 (hex) NIXDORF COMPUTER CORPORATION
The ieee's list doesn't have any 52's though.
rick
Quoted 21 lines
Well, then by a quick glance at
http://standards.ieee.org/develop/regauth/oui/oui.txt it looks like there are more to add... (some overlap with your list, I've not checked the entire thing, how the name conflicts should be resolved I've no idea)raj@tardy:~$ grep ^02- oui.txt 02-07-01 (hex) RACAL-DATACOM 02-1C-7C (hex) PERQ SYSTEMS CORPORATION 02-60-86 (hex) LOGIC REPLACEMENT TECH. LTD. 02-60-8C (hex) 3COM CORPORATION 02-70-01 (hex) RACAL-DATACOM 02-70-B0 (hex) M/A-COM INC. COMPANIES 02-70-B3 (hex) DATA RECALL LTD 02-9D-8E (hex) CARDIAC RECORDERS INC. 02-AA-3C (hex) OLIVETTI TELECOMM SPA (OLTECO) 02-BB-01 (hex) OCTOTHORPE CORP. 02-C0-8C (hex) 3COM CORPORATION 02-CF-1C (hex) COMMUNICATION MACHINERY CORP. 02-E6-D3 (hex) NIXDORF COMPUTER CORPORATION
Quoted 1 line
The ieee's list doesn't have any 52's though.
It does have some A's though:
~$ grep ^.[26AE]- oui.txt
[the aforementioned 02's]
AA-00-00 (hex) DIGITAL EQUIPMENT CORPORATION AA-00-01 (hex) DIGITAL EQUIPMENT CORPORATION AA-00-02 (hex) DIGITAL EQUIPMENT CORPORATION AA-00-03 (hex) DIGITAL EQUIPMENT CORPORATION AA-00-04 (hex) DIGITAL EQUIPMENT CORPORATION
which if I've not botched my bits has the locally administered bit set.
rick
Quoted 26 lines · Rick Jones
Quoted 21 lines
Well, then by a quick glance at
http://standards.ieee.org/develop/regauth/oui/oui.txt it looks like there are more to add... (some overlap with your list, I've not checked the entire thing, how the name conflicts should be resolved I've no idea)raj@tardy:~$ grep ^02- oui.txt 02-07-01 (hex) RACAL-DATACOM 02-1C-7C (hex) PERQ SYSTEMS CORPORATION 02-60-86 (hex) LOGIC REPLACEMENT TECH. LTD. 02-60-8C (hex) 3COM CORPORATION 02-70-01 (hex) RACAL-DATACOM 02-70-B0 (hex) M/A-COM INC. COMPANIES 02-70-B3 (hex) DATA RECALL LTD 02-9D-8E (hex) CARDIAC RECORDERS INC. 02-AA-3C (hex) OLIVETTI TELECOMM SPA (OLTECO) 02-BB-01 (hex) OCTOTHORPE CORP. 02-C0-8C (hex) 3COM CORPORATION 02-CF-1C (hex) COMMUNICATION MACHINERY CORP. 02-E6-D3 (hex) NIXDORF COMPUTER CORPORATIONQuoted 1 line
The ieee's list doesn't have any 52's though.
It does have some A's though:
~$ grep ^.[26AE]- oui.txt
[the aforementioned 02's]
Quoted 7 lines
AA-00-00 (hex) DIGITAL EQUIPMENT CORPORATION AA-00-01 (hex) DIGITAL EQUIPMENT CORPORATION AA-00-02 (hex) DIGITAL EQUIPMENT CORPORATION AA-00-03 (hex) DIGITAL EQUIPMENT CORPORATION AA-00-04 (hex) DIGITAL EQUIPMENT CORPORATIONwhich if I've not botched my bits has the locally administered bit set.
The AA addresses are used by DECNET and related protocols.
-Bill
Quoted 34 lines · Bill Fink
Quoted 32 lines · Rick Jones
Quoted 21 lines
Well, then by a quick glance at
http://standards.ieee.org/develop/regauth/oui/oui.txt it looks like there are more to add... (some overlap with your list, I've not checked the entire thing, how the name conflicts should be resolved I've no idea)raj@tardy:~$ grep ^02- oui.txt 02-07-01 (hex) RACAL-DATACOM 02-1C-7C (hex) PERQ SYSTEMS CORPORATION 02-60-86 (hex) LOGIC REPLACEMENT TECH. LTD. 02-60-8C (hex) 3COM CORPORATION 02-70-01 (hex) RACAL-DATACOM 02-70-B0 (hex) M/A-COM INC. COMPANIES 02-70-B3 (hex) DATA RECALL LTD 02-9D-8E (hex) CARDIAC RECORDERS INC. 02-AA-3C (hex) OLIVETTI TELECOMM SPA (OLTECO) 02-BB-01 (hex) OCTOTHORPE CORP. 02-C0-8C (hex) 3COM CORPORATION 02-CF-1C (hex) COMMUNICATION MACHINERY CORP. 02-E6-D3 (hex) NIXDORF COMPUTER CORPORATIONQuoted 1 line
The ieee's list doesn't have any 52's though.
It does have some A's though:
~$ grep ^.[26AE]- oui.txt
[the aforementioned 02's]AA-00-00 (hex) DIGITAL EQUIPMENT CORPORATION AA-00-01 (hex) DIGITAL EQUIPMENT CORPORATION AA-00-02 (hex) DIGITAL EQUIPMENT CORPORATION AA-00-03 (hex) DIGITAL EQUIPMENT CORPORATION AA-00-04 (hex) DIGITAL EQUIPMENT CORPORATION
Quoted 3 lines
Quoted 1 line
which if I've not botched my bits has the locally administered bit set.
The AA addresses are used by DECNET and related protocols.
Um, ok, I was figuring something along those lines - but regardless, in the context of Stephen's RFC, they are pre-assigned OUIs with the locally administered bit set and presumably as such ones that should not be assigned by the random ethernet address generator. Assuming that checking for such things is indeed necessary in the first place.
rick jones
Quoted 5 lines · Stephen Hemminger
There are some addresses in the assigned vendor block that don't obey the locally assigned convention. These should be avoided by
random_ether_addrassignment.Signed-off-by Stephen Hemminger <[email protected]>
We call random_ether_addr() for some virtual devices, maybe we can add a __random_ether_addr() helper for them and not avoid these OUI ?
Quoted 6 lines · Eric Dumazet
Quoted 3 lines · Stephen Hemminger
There are some addresses in the assigned vendor block that don't obey the locally assigned convention. These should be avoided by
random_ether_addrassignment.We call
random_ether_addr()for some virtual devices, maybe we can add a__random_ether_addr()helper for them and not avoid these OUI ?
Unless it's speed critical, it's probably not worthwhile.
I think that using get_random_bytes, because it can drain the entropy pool, may not be a great thing to do.
There's little value in crypto secure OUI's for random ethernet addresses.
I think using get_random_int or random32 is probably good enough.
Quoted 10 lines · Joe Perches
Quoted 6 lines · Eric Dumazet
Quoted 3 lines · Stephen Hemminger
There are some addresses in the assigned vendor block that don't obey the locally assigned convention. These should be avoided by
random_ether_addrassignment.We call
random_ether_addr()for some virtual devices, maybe we can add a__random_ether_addr()helper for them and not avoid these OUI ?Unless it's speed critical, it's probably not worthwhile.
Speed was not my concern, but getting idea of why avoiding pre-assigned OUI was a concern for them, if they dont hit a real Ethernet domain.
Quoted 3 lines
I think that using
get_random_bytes, because it can drain the entropy pool, may not be a great thing to do.
This has litle to do with Stephen patch. You could discuss this with Matt Mackall.
By the way, since 2.6.29 every exec() gets 16 bytes from get_random_bytes() for PRNG seeding.
Typical machine starts far more programs than network interfaces ;)
Anyway, it seems to have no impact at all, even gathering 128*6 bytes here :
# cat /proc/sys/kernel/random/entropy_avail 142 # modprobe dummy numdummies=128 # cat /proc/sys/kernel/random/entropy_avail 156
Quoted 6 lines · On Sun, 15 May 2011 23:10:26 +0200 Eric Dumazet <[email protected]> wrote:
Quoted 5 lines · Joe Perches
Quoted 4 lines · Eric Dumazet
Quoted 3 lines · Stephen Hemminger
There are some addresses in the assigned vendor block that don't obey the locally assigned convention. These should be avoided by
random_ether_addrassignment.
Quoted 8 lines
Quoted 5 lines
Quoted 2 lines
We call
random_ether_addr()for some virtual devices, maybe we can add a__random_ether_addr()helper for them and not avoid these OUI ?Unless it's speed critical, it's probably not worthwhile.
Speed was not my concern, but getting idea of why avoiding pre-assigned OUI was a concern for them, if they dont hit a real Ethernet domain.
My concern was that after some discussion with IEEE committee that many virtual environments are using locally assigned addresses that get bridged onto real networks.
That started me thinking that the current code should be more careful to avoid potential conflicts. My opinion is that this not worth worrying about because the likelihood of conflict with any one of these old addresses is as about as the unlikely as two hosts choosing the same value. But I wanted to raise the issue for explicit discussion and frame it with what would be required to handle it.
Quoted 22 lines · On Mon, 16 May 2011 08:46:44 -0700 Stephen Hemminger <[email protected]>…
Quoted 6 lines · On Sun, 15 May 2011 23:10:26 +0200 Eric Dumazet <[email protected]> wrote:
Quoted 5 lines · Joe Perches
Quoted 4 lines · Eric Dumazet
Quoted 3 lines · Stephen Hemminger
There are some addresses in the assigned vendor block that don't obey the locally assigned convention. These should be avoided by
random_ether_addrassignment.Quoted 8 lines
Quoted 5 lines
Quoted 2 lines
We call
random_ether_addr()for some virtual devices, maybe we can add a__random_ether_addr()helper for them and not avoid these OUI ?Unless it's speed critical, it's probably not worthwhile.
Speed was not my concern, but getting idea of why avoiding pre-assigned OUI was a concern for them, if they dont hit a real Ethernet domain.
My concern was that after some discussion with IEEE committee that many virtual environments are using locally assigned addresses that get bridged onto real networks.
Quoted 6 lines
That started me thinking that the current code should be more careful to avoid potential conflicts. My opinion is that this not worth worrying about because the likelihood of conflict with any one of these old addresses is as about as the unlikely as two hosts choosing the same value. But I wanted to raise the issue for explicit discussion and frame it with what would be required to handle it.
I thought of one problem that the current code has related to udev. If a virtual device chooses one of the pre-assigned OUI values then udev will put in the persistent network device file. This will cause the device to change name.
If you look at /lib/udev/rules.d/75-persistent-net-generator-rules it has special case code for this.
# ignore KVM virtual interfaces
ENV{MATCHADDR}=="52:54:00:*", GOTO="persistent_net_generator_end"
# ignore VMWare virtual interfaces
ENV{MATCHADDR}=="00:0c:29:*|00:50:56:*", GOTO="persistent_net_generator_end"# These vendors are known to violate the local MAC address assignment scheme # Interlan, DEC (UNIBUS or QBUS), Apollo, Cisco, Racal-Datacom ENV{MATCHADDR}=="02:07:01:*", GOTO="globally_administered_whitelist" # 3Com
ENV{MATCHADDR}=="02:60:60:*", GOTO="globally_administered_whitelist" # 3Com IBM PC; Imagen; Valid; Cisco; Apple ENV{MATCHADDR}=="02:60:8c:*", GOTO="globally_administered_whitelist" # Intel
ENV{MATCHADDR}=="02:a0:c9:*", GOTO="globally_administered_whitelist" # Olivetti
ENV{MATCHADDR}=="02:aa:3c:*", GOTO="globally_administered_whitelist" # CMC Masscomp; Silicon Graphics; Prime EXL ENV{MATCHADDR}=="02:cf:1f:*", GOTO="globally_administered_whitelist" # Prominet Corporation Gigabit Ethernet Switch ENV{MATCHADDR}=="02:e0:3b:*", GOTO="globally_administered_whitelist" # BTI (Bus-Tech, Inc.) IBM Mainframes ENV{MATCHADDR}=="02:e6:d3:*", GOTO="globally_administered_whitelist" # Realtek
ENV{MATCHADDR}=="52:54:00:*", GOTO="globally_administered_whitelist" # Novell 2000
ENV{MATCHADDR}=="52:54:4c:*", GOTO="globally_administered_whitelist" # Realtec
ENV{MATCHADDR}=="52:54:ab:*", GOTO="globally_administered_whitelist" # Kingston Technologies
ENV{MATCHADDR}=="e2:0c:0f:*", GOTO="globally_administered_whitelist"
# match interface dev_id
ATTR{dev_id}=="?*", ENV{MATCHDEVID}="$attr{dev_id}"# do not use "locally administered" MAC address
ENV{MATCHADDR}=="?[2367abef]:*", ENV{MATCHADDR}=""# do not use empty address
ENV{MATCHADDR}=="00:00:00:00:00:00", ENV{MATCHADDR}=""LABEL="globally_administered_whitelist"