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] [day] [month] [year] [list]
Message-ID: <1370278379.2025.40.camel@joe-AO722>
Date:	Mon, 03 Jun 2013 09:52:59 -0700
From:	Joe Perches <joe@...ches.com>
To:	Thomas Petazzoni <thomas.petazzoni@...e-electrons.com>
Cc:	"David S. Miller" <davem@...emloft.net>, netdev@...r.kernel.org,
	Jason Cooper <jason@...edaemon.net>,
	Gregory Clement <gregory.clement@...e-electrons.com>,
	Andrew Lunn <andrew@...n.ch>,
	Ezequiel Garcia <ezequiel.garcia@...e-electrons.com>,
	Lior Amsalem <alior@...vell.com>,
	linux-arm-kernel@...ts.infradead.org
Subject: Re: [PATCH] net: mvneta: read MAC address from hardware when
 available

On Mon, 2013-06-03 at 18:41 +0200, Thomas Petazzoni wrote:
> This patch improves the logic used by the mvneta driver to find a MAC
> address for a particular interface. Until now, it was only looking at
> the Device Tree, and if no address was found, was falling back to
> generating a random MAC address.
[]
> diff --git a/drivers/net/ethernet/marvell/mvneta.c b/drivers/net/ethernet/marvell/mvneta.c
[]
> @@ -2740,6 +2748,17 @@ static int mvneta_probe(struct platform_device *pdev)
[]
> +	dt_mac_addr = of_get_mac_address(dn);
> +	if (dt_mac_addr && is_valid_ether_addr(dt_mac_addr))
> +		memcpy(dev->dev_addr, dt_mac_addr, ETH_ALEN);
> +	else {
> +		mvneta_get_mac_addr(pp, hw_mac_addr);
> +		if (is_valid_ether_addr(hw_mac_addr))
> +			memcpy(dev->dev_addr, hw_mac_addr, ETH_ALEN);
> +		else
> +			eth_hw_addr_random(dev);
> +	}

maybe there could be a dmesg line like:

	const char *mac_from;
[...]
		mac_from = "device tree"
	else
[...]
			mac_from = "hardware"
		else
			mac_from = "random"
[...]
	netdev_info(dev, "Using %s mac address %pM\n",
		    mac_from, dev->dev_addr);


--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ