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]
Message-ID: <1328818290.2562.19.camel@bwh-desktop>
Date:	Thu, 9 Feb 2012 20:11:30 +0000
From:	Ben Hutchings <bhutchings@...arflare.com>
To:	Danny Kukawka <danny.kukawka@...ect.de>
CC:	"David S. Miller" <davem@...emloft.net>,
	Danny Kukawka <dkukawka@...e.de>, <netdev@...r.kernel.org>,
	<linux-kernel@...r.kernel.org>,
	Jeff Kirsher <jeffrey.t.kirsher@...el.com>,
	Jesse Brandeburg <jesse.brandeburg@...el.com>,
	Bruce Allan <bruce.w.allan@...el.com>,
	Carolyn Wyborny <carolyn.wyborny@...el.com>,
	Don Skidmore <donald.c.skidmore@...el.com>,
	Greg Rose <gregory.v.rose@...el.com>,
	Peter P Waskiewicz Jr <peter.p.waskiewicz.jr@...el.com>,
	Alex Duyck <alexander.h.duyck@...el.com>,
	John Ronciak <john.ronciak@...el.com>,
	Mitch Williams <mitch.a.williams@...el.com>,
	Jiri Pirko <jpirko@...hat.com>,
	Eric Dumazet <eric.dumazet@...il.com>,
	<e1000-devel@...ts.sourceforge.net>,
	Stephen Hemminger <shemminger@...tta.com>
Subject: Re: [PATCH 2/2] rename dev_hw_addr_random and remove redundant
 second

On Thu, 2012-02-09 at 20:48 +0100, Danny Kukawka wrote:
> Renamed dev_hw_addr_random to eth_hw_addr_random() to reflect that
> this function only assign a random ethernet address (MAC). Removed
> the second parameter (u8 *hwaddr), it's redundant since the also
> given net_device already contains net_device->dev_addr.
> Set it directly.
> 
> Adapt igbvf and ixgbevf to the changed function.
[...]
> --- a/drivers/net/ethernet/intel/igbvf/netdev.c
> +++ b/drivers/net/ethernet/intel/igbvf/netdev.c
> @@ -2695,18 +2695,19 @@ static int __devinit igbvf_probe(struct pci_dev *pdev,
>  		dev_info(&pdev->dev,
>  			 "PF still in reset state, assigning new address."
>  			 " Is the PF interface up?\n");
> -		dev_hw_addr_random(adapter->netdev, hw->mac.addr);
> +		eth_hw_addr_random(netdev);
> +		memcpy(adapter->hw.mac.addr, netdev->dev_addr,
> +			netdev->addr_len);
>  	} else {
>  		err = hw->mac.ops.read_mac_addr(hw);
>  		if (err) {
>  			dev_err(&pdev->dev, "Error reading MAC address\n");
>  			goto err_hw_init;
>  		}
> +		memcpy(netdev->dev_addr, adapter->hw.mac.addr,
> +			netdev->addr_len);
>  	}
>  
> -	memcpy(netdev->dev_addr, adapter->hw.mac.addr, netdev->addr_len);
> -	memcpy(netdev->perm_addr, adapter->hw.mac.addr, netdev->addr_len);
> -
>  	if (!is_valid_ether_addr(netdev->perm_addr)) {
>  		dev_err(&pdev->dev, "Invalid MAC Address: %pM\n",
>  		        netdev->dev_addr);
> @@ -2714,6 +2715,8 @@ static int __devinit igbvf_probe(struct pci_dev *pdev,
>  		goto err_hw_init;
>  	}
>  
> +	memcpy(netdev->perm_addr, adapter->hw.mac.addr, netdev->addr_len);
[...]

I wonder whether VF drivers should claim to have a permanent address at
all, let alone setting the 'permanent' address to a randomly generated
address.

Ben.

-- 
Ben Hutchings, Staff Engineer, Solarflare
Not speaking for my employer; that's the marketing department's job.
They asked us to note that Solarflare product names are trademarked.

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ