lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Date:   Thu, 5 Mar 2020 13:31:02 +0100
From:   Sascha Hauer <s.hauer@...gutronix.de>
To:     Madalin Bucur <madalin.bucur@....com>
Cc:     "netdev@...r.kernel.org" <netdev@...r.kernel.org>
Subject: Re: [PATCH] fsl/fman: Use random MAC address when none is given

On Thu, Mar 05, 2020 at 11:57:37AM +0000, Madalin Bucur wrote:
> > -----Original Message-----
> > From: Sascha Hauer <s.hauer@...gutronix.de>
> > Sent: Thursday, March 5, 2020 1:54 PM
> > To: netdev@...r.kernel.org
> > Cc: Madalin Bucur <madalin.bucur@....com>; Sascha Hauer
> > <s.hauer@...gutronix.de>
> > Subject: [PATCH] fsl/fman: Use random MAC address when none is given
> > 
> > There's no need to fail probing when no MAC address is given in the
> > device tree, just use a random MAC address.
> > 
> > Signed-off-by: Sascha Hauer <s.hauer@...gutronix.de>
> > ---
> >  drivers/net/ethernet/freescale/dpaa/dpaa_eth.c   | 13 +++++++++++--
> >  drivers/net/ethernet/freescale/fman/fman_memac.c |  4 ----
> >  drivers/net/ethernet/freescale/fman/mac.c        | 10 ++--------
> >  3 files changed, 13 insertions(+), 14 deletions(-)
> > 
> > diff --git a/drivers/net/ethernet/freescale/dpaa/dpaa_eth.c
> > b/drivers/net/ethernet/freescale/dpaa/dpaa_eth.c
> > index fd93d542f497..18a7235af7c2 100644
> > --- a/drivers/net/ethernet/freescale/dpaa/dpaa_eth.c
> > +++ b/drivers/net/ethernet/freescale/dpaa/dpaa_eth.c
> > @@ -233,8 +233,17 @@ static int dpaa_netdev_init(struct net_device
> > *net_dev,
> >  	net_dev->features |= net_dev->hw_features;
> >  	net_dev->vlan_features = net_dev->features;
> > 
> > -	memcpy(net_dev->perm_addr, mac_addr, net_dev->addr_len);
> > -	memcpy(net_dev->dev_addr, mac_addr, net_dev->addr_len);
> > +	if (is_valid_ether_addr(mac_addr)) {
> > +		dev_info(dev, "FMan MAC address: %pM\n", mac_addr);
> > +		memcpy(net_dev->perm_addr, mac_addr, net_dev->addr_len);
> > +		memcpy(net_dev->dev_addr, mac_addr, net_dev->addr_len);
> > +	} else {
> > +		eth_hw_addr_random(net_dev);
> > +		dev_info(dev, "Using random MAC address: %pM\n",
> > +			 net_dev->dev_addr);
> > +	}
> > +
> > +	dev_info(dev, "FMan perm MAC address: %pM\n", net_dev->perm_addr);
> 
> Do you need both prints when using a random MAC address? Otherwise, it's ok.

Erm, no, I accidently committed it. Will remove.

Sascha

-- 
Pengutronix e.K.                           |                             |
Steuerwalder Str. 21                       | http://www.pengutronix.de/  |
31137 Hildesheim, Germany                  | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

Powered by blists - more mailing lists