Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit e26f43fa authored by Vlad Yasevich's avatar Vlad Yasevich Committed by David S. Miller
Browse files

macvlan: Do not return error when setting the same mac address



The user currently gets an EBUSY error when attempting to set
the mac address on a macvlan device to the same value.

This should really be a no-op as nothing changes.  Catch
the condition and return early.

Signed-off-by: default avatarVladislav Yasevich <vyasevic@redhat.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent dfa523ae
Loading
Loading
Loading
Loading
+4 −0
Original line number Diff line number Diff line
@@ -703,6 +703,10 @@ static int macvlan_set_mac_address(struct net_device *dev, void *p)
	if (!is_valid_ether_addr(addr->sa_data))
		return -EADDRNOTAVAIL;

	/* If the addresses are the same, this is a no-op */
	if (ether_addr_equal(dev->dev_addr, addr->sa_data))
		return 0;

	if (vlan->mode == MACVLAN_MODE_PASSTHRU) {
		dev_set_mac_address(vlan->lowerdev, addr);
		return 0;