[linux-next] LinuxNextTracking branch, master, updated. next-20120926

batman at open-mesh.org batman at open-mesh.org
Thu Sep 27 00:18:07 CEST 2012


The following commit has been merged in the master branch:
commit 40a3eb33e307616567f4b81792f405a7f3f0abee
Author: Def <def at laposte.net>
Date:   Thu Sep 20 14:56:13 2012 +0200

    batman-adv: Fix change mac address of soft iface.
    
    Into function interface_set_mac_addr, the function tt_local_add was
    invoked before updating dev->dev_addr. The new MAC address was not
    tagged as NoPurge.
    
    Signed-off-by: Def <def at laposte.net>

diff --git a/net/batman-adv/soft-interface.c b/net/batman-adv/soft-interface.c
index 109ea2a..21c5357 100644
--- a/net/batman-adv/soft-interface.c
+++ b/net/batman-adv/soft-interface.c
@@ -100,18 +100,21 @@ static int batadv_interface_set_mac_addr(struct net_device *dev, void *p)
 {
 	struct batadv_priv *bat_priv = netdev_priv(dev);
 	struct sockaddr *addr = p;
+	uint8_t old_addr[ETH_ALEN];
 
 	if (!is_valid_ether_addr(addr->sa_data))
 		return -EADDRNOTAVAIL;
 
+	memcpy(old_addr, dev->dev_addr, ETH_ALEN);
+	memcpy(dev->dev_addr, addr->sa_data, ETH_ALEN);
+
 	/* only modify transtable if it has been initialized before */
 	if (atomic_read(&bat_priv->mesh_state) == BATADV_MESH_ACTIVE) {
-		batadv_tt_local_remove(bat_priv, dev->dev_addr,
+		batadv_tt_local_remove(bat_priv, old_addr,
 				       "mac address changed", false);
 		batadv_tt_local_add(dev, addr->sa_data, BATADV_NULL_IFINDEX);
 	}
 
-	memcpy(dev->dev_addr, addr->sa_data, ETH_ALEN);
 	dev->addr_assign_type &= ~NET_ADDR_RANDOM;
 	return 0;
 }

-- 
LinuxNextTracking


More information about the linux-merge mailing list