forked from mirrors/linux
		
	net: add check for current MAC address in dev_set_mac_address
In some cases it is possible for kernel to come with request to change primary MAC address to the address that is already set on the given interface. Add proper check to return fast from the function in these cases. An example of such case is adding an interface to bonding channel in balance-alb mode: modprobe bonding mode=balance-alb miimon=100 max_bonds=1 ip link set bond0 up ifenslave bond0 <eth> Signed-off-by: Piotr Gardocki <piotrx.gardocki@intel.com> Reviewed-by: Simon Horman <simon.horman@corigine.com> Signed-off-by: Jakub Kicinski <kuba@kernel.org>
This commit is contained in:
		
							parent
							
								
									8f72fb1578
								
							
						
					
					
						commit
						ad72c4a06a
					
				
					 1 changed files with 2 additions and 0 deletions
				
			
		|  | @ -8781,6 +8781,8 @@ int dev_set_mac_address(struct net_device *dev, struct sockaddr *sa, | ||||||
| 		return -EINVAL; | 		return -EINVAL; | ||||||
| 	if (!netif_device_present(dev)) | 	if (!netif_device_present(dev)) | ||||||
| 		return -ENODEV; | 		return -ENODEV; | ||||||
|  | 	if (!memcmp(dev->dev_addr, sa->sa_data, dev->addr_len)) | ||||||
|  | 		return 0; | ||||||
| 	err = dev_pre_changeaddr_notify(dev, sa->sa_data, extack); | 	err = dev_pre_changeaddr_notify(dev, sa->sa_data, extack); | ||||||
| 	if (err) | 	if (err) | ||||||
| 		return err; | 		return err; | ||||||
|  |  | ||||||
		Loading…
	
		Reference in a new issue
	
	 Piotr Gardocki
						Piotr Gardocki