[commits] batman-adv; branch, master, updated. v2010.1.0-174-g16506a6

postmaster at open-mesh.org postmaster at open-mesh.org
Sat Sep 18 17:36:12 CEST 2010


The following commit has been merged in the master branch:
commit 16506a6d432984da48d69175687b28bdfb4ce542
Author: Marek Lindner <lindner_marek at yahoo.de>
Date:   Sat Sep 18 15:35:46 2010 +0000

    Introduce update_primary_addr to update mac address
    
    set_primary_if is currently misused to update the mac address in vis
    packets. This unneeded and introduces overhead due to other operations
    which must be done when updating the primary interface.
    
    Signed-off-by: Marek Lindner <lindner_marek at yahoo.de>
    Signed-off-by: Sven Eckelmann <sven.eckelmann at gmx.de>

diff --git a/hard-interface.c b/hard-interface.c
index 942a44a..def74cf 100644
--- a/hard-interface.c
+++ b/hard-interface.c
@@ -108,11 +108,22 @@ out:
 	return batman_if;
 }
 
+static void update_primary_addr(struct bat_priv *bat_priv)
+{
+	struct vis_packet *vis_packet;
+
+	vis_packet = (struct vis_packet *)
+				bat_priv->my_vis_info->skb_packet->data;
+	memcpy(vis_packet->vis_orig,
+	       bat_priv->primary_if->net_dev->dev_addr, ETH_ALEN);
+	memcpy(vis_packet->sender_orig,
+	       bat_priv->primary_if->net_dev->dev_addr, ETH_ALEN);
+}
+
 static void set_primary_if(struct bat_priv *bat_priv,
 			   struct batman_if *batman_if)
 {
 	struct batman_packet *batman_packet;
-	struct vis_packet *vis_packet;
 	struct batman_if *old_if;
 
 	if (batman_if)
@@ -131,12 +142,7 @@ static void set_primary_if(struct bat_priv *bat_priv,
 	batman_packet->flags = PRIMARIES_FIRST_HOP;
 	batman_packet->ttl = TTL;
 
-	vis_packet = (struct vis_packet *)
-				bat_priv->my_vis_info->skb_packet->data;
-	memcpy(vis_packet->vis_orig,
-	       bat_priv->primary_if->net_dev->dev_addr, ETH_ALEN);
-	memcpy(vis_packet->sender_orig,
-	       bat_priv->primary_if->net_dev->dev_addr, ETH_ALEN);
+	update_primary_addr(bat_priv);
 
 	/***
 	 * hacky trick to make sure that we send the HNA information via
@@ -518,7 +524,7 @@ static int hard_if_event(struct notifier_block *this,
 
 		bat_priv = netdev_priv(batman_if->soft_iface);
 		if (batman_if == bat_priv->primary_if)
-			set_primary_if(bat_priv, batman_if);
+			update_primary_addr(bat_priv);
 		break;
 	default:
 		break;

-- 
batman-adv


More information about the commits mailing list