[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20200508131042.GP208718@lunn.ch>
Date: Fri, 8 May 2020 15:10:42 +0200
From: Andrew Lunn <andrew@...n.ch>
To: Igor Russkikh <irusskikh@...vell.com>
Cc: Jakub Kicinski <kuba@...nel.org>, netdev@...r.kernel.org,
"David S . Miller" <davem@...emloft.net>,
Mark Starovoytov <mstarovoitov@...vell.com>
Subject: Re: [PATCH net-next 7/7] net: atlantic: unify get_mac_permanent
On Fri, May 08, 2020 at 12:14:51PM +0300, Igor Russkikh wrote:
> Hi Jakub,
>
>
> >> This patch moves MAC generation into a separate function, which is
> > called
> >> from both places to reduce the amount of copy/paste.
> >
> > Right, but why do you have your own mac generation rather than using
> > eth_hw_addr_random(). You need to set NET_ADDR_RANDOM for example,
> > just use standard helpers, please.
>
> We want this still be an Aquantia vendor id MAC, not a fully random mac.
> Thats why the logic below randomizes only low three octets.
Hi Igor
How safe is that? It reduces the available pool space by 22
bits. It greatly increases the likelihood of a collision.
>
> >> + get_random_bytes(&rnd, sizeof(unsigned int));
> >> + l = 0xE300 0000U | (0xFFFFU & rnd) | (0x00 << 16);
> >> + h = 0x8001300EU;
Is this Marvell/Aquantias OUI? Are you setting the locally
administered bit? You probably should be, since this is local, not
issued with a guarantee of being unique.
Andrew
Powered by blists - more mailing lists