Subject: Re: [PATCH net-next] net: add check for current MAC address in dev_set_mac_address

From: Maciej Fijalkowski <[email-masked]>
Date: Mon, 12 Jun 2023 17:37:47 +0200

On Mon, Jun 12, 2023 at 04:49:47PM +0200, Piotr Gardocki wrote:
> On 10.06.2023 08:44, Jakub Kicinski wrote:
> > On Fri,  9 Jun 2023 18:52:41 +0200 Piotr Gardocki wrote:
> >> +	if (ether_addr_equal(dev->dev_addr, sa->sa_data))
> >> +		return 0;
> > 
> > not every device is ethernet, you need to use dev->addr_len for
> > the comparison.
> 
> Before re-sending I just want to double check.
> Did you mean checking if sa->sa_family == AF_LOCAL ?
> There's no length in sockaddr.
> 
> It would like this:
> 	if (sa->sa_family == AF_LOCAL &&
> 	    ether_addr_equal(dev->dev_addr, sa->sa_data))
> 		return 0;

I believe Jakub just wanted this:

	if (dev->addr_len)
		if (ether_addr_equal(dev->dev_addr, sa->sa_data))
			return 0;

so no clue why you want anything from sockaddr?