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

batman at open-mesh.org batman at open-mesh.org
Tue Nov 27 00:21:20 CET 2012


The following commit has been merged in the master branch:
commit c76d15253aeaf8ee3beee932d1950296431bec96
Author: Simon Wunderlich <simon.wunderlich at s2003.tu-chemnitz.de>
Date:   Mon Oct 15 22:38:04 2012 +0200

    batman-adv: fix bla compare function
    
    The address and the VLAN VID may not be packed in the respective
    structs. Fix this by comparing the elements individually.
    
    Reported-by: Marek Lindner <lindner_marek at yahoo.de>
    Reported-by: Sven Eckelmann <sven at narfation.org>
    Signed-off-by: Simon Wunderlich <siwu at hrz.tu-chemnitz.de>
    Signed-off-by: Marek Lindner <lindner_marek at yahoo.de>
    Signed-off-by: Antonio Quartulli <ordex at autistici.org>

diff --git a/net/batman-adv/bridge_loop_avoidance.c b/net/batman-adv/bridge_loop_avoidance.c
index bda8b17..7ffef8b 100644
--- a/net/batman-adv/bridge_loop_avoidance.c
+++ b/net/batman-adv/bridge_loop_avoidance.c
@@ -77,8 +77,15 @@ static int batadv_compare_backbone_gw(const struct hlist_node *node,
 {
 	const void *data1 = container_of(node, struct batadv_backbone_gw,
 					 hash_entry);
+	const struct batadv_backbone_gw *gw1 = data1, *gw2 = data2;
 
-	return (memcmp(data1, data2, ETH_ALEN + sizeof(short)) == 0 ? 1 : 0);
+	if (!batadv_compare_eth(gw1->orig, gw2->orig))
+		return 0;
+
+	if (gw1->vid != gw2->vid)
+		return 0;
+
+	return 1;
 }
 
 /* compares address and vid of two claims */
@@ -87,8 +94,15 @@ static int batadv_compare_claim(const struct hlist_node *node,
 {
 	const void *data1 = container_of(node, struct batadv_claim,
 					 hash_entry);
+	const struct batadv_claim *cl1 = data1, *cl2 = data2;
 
-	return (memcmp(data1, data2, ETH_ALEN + sizeof(short)) == 0 ? 1 : 0);
+	if (!batadv_compare_eth(cl1->addr, cl2->addr))
+		return 0;
+
+	if (cl1->vid != cl2->vid)
+		return 0;
+
+	return 1;
 }
 
 /* free a backbone gw */

-- 
LinuxNextTracking


More information about the linux-merge mailing list