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  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:   Thu, 5 Mar 2020 15:03:48 +0000
From:   Madalin Bucur <madalin.bucur@....com>
To:     Sascha Hauer <s.hauer@...gutronix.de>
CC:     "netdev@...r.kernel.org" <netdev@...r.kernel.org>
Subject: RE: [PATCH v2] fsl/fman: Use random MAC address when none is given

> -----Original Message-----
> From: Sascha Hauer <s.hauer@...gutronix.de>
> Sent: Thursday, March 5, 2020 4:48 PM
> To: Madalin Bucur <madalin.bucur@....com>
> Cc: netdev@...r.kernel.org
> Subject: Re: [PATCH v2] fsl/fman: Use random MAC address when none is
> given
> 
> On Thu, Mar 05, 2020 at 01:38:01PM +0000, Madalin Bucur wrote:
> > > -----Original Message-----
> > > From: Sascha Hauer <s.hauer@...gutronix.de>
> > > Sent: Thursday, March 5, 2020 2:34 PM
> > > To: netdev@...r.kernel.org
> > > Cc: Madalin Bucur <madalin.bucur@....com>; Sascha Hauer
> > > <s.hauer@...gutronix.de>
> > > Subject: [PATCH v2] 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>
> > > ---
> > >
> > > Changes since v1:
> > > - Remove printing of permanent MAC address
> > >
> > >  drivers/net/ethernet/freescale/dpaa/dpaa_eth.c   | 11 +++++++++--
> > >  drivers/net/ethernet/freescale/fman/fman_memac.c |  4 ----
> > >  drivers/net/ethernet/freescale/fman/mac.c        | 10 ++--------
> > >  3 files changed, 11 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..fc117eab788d 100644
> > > --- a/drivers/net/ethernet/freescale/dpaa/dpaa_eth.c
> > > +++ b/drivers/net/ethernet/freescale/dpaa/dpaa_eth.c
> > > @@ -233,8 +233,15 @@ 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);
> > > +	}
> >
> > To make the HW MAC aware of the new random address you set in the
> dpaa_eth,
> > you also need to call mac_dev->change_addr() after
> eth_hw_addr_random(), like
> > it's done in dpaa_set_mac_address():
> >
> >         err = mac_dev->change_addr(mac_dev->fman_mac,
> >                                    (enet_addr_t *)net_dev->dev_addr);
> >
> > This will write the new MAC address in the MAC HW registers.
> 
> Ok, I see.
> 
> So when I call mac_dev->change_addr() here in dpaa_netdev_init() it
> means I can remove all the code setting the MAC address in hardware
> before this point, right?

It's not an issue if you just write it here for the random address and leave
the previous functionality in place. Do you have a board to validate your
changes?

> Sascha
> 
> --
> Pengutronix e.K.                           |
> |
> Steuerwalder Str. 21                       |
> https://eur01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww.peng
> utronix.de%2F&amp;data=02%7C01%7Cmadalin.bucur%40nxp.com%7C4b875830989945
> 006ae908d7c11439bc%7C686ea1d3bc2b4c6fa92cd99c5c301635%7C0%7C0%7C637190164
> 922597543&amp;sdata=48VF83dAoB1m5B3I0jQIf0KwhO9au4gJVIieGqt1G8c%3D&amp;re
> served=0  |
> 31137 Hildesheim, Germany                  | Phone: +49-5121-206917-0
> |
> Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555
> |

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ