public inbox for b.a.t.m.a.n@lists.open-mesh.org
 help / color / mirror / Atom feed
* [B.A.T.M.A.N.] [PATCH] batman-adv: Fix change mac address of soft iface.
@ 2012-09-18 14:41 Def
  2012-09-18 14:55 ` Sven Eckelmann
  0 siblings, 1 reply; 7+ messages in thread
From: Def @ 2012-09-18 14:41 UTC (permalink / raw)
  To: b.a.t.m.a.n

 Into function interface_set_mac_addr, the function tt_local_add
 was invoked before updating dev->dev_addr. The new MAC
 addresse was not tagged as NoPurge.

---
 soft-interface.c |    9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/soft-interface.c b/soft-interface.c
index cf26e41..1345b86
--- a/soft-interface.c
+++ b/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;
 }
-- 
1.7.10.4

^ permalink raw reply related	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2012-09-23  9:34 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-09-18 14:41 [B.A.T.M.A.N.] [PATCH] batman-adv: Fix change mac address of soft iface Def
2012-09-18 14:55 ` Sven Eckelmann
2012-09-20 11:42   ` Antonio Quartulli
2012-09-20 12:56     ` [B.A.T.M.A.N.] [PATCHv2] " Def
2012-09-20 18:10       ` Antonio Quartulli
2012-09-23  8:42       ` Sven Eckelmann
2012-09-23  9:34       ` Marek Lindner

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox