[commits] r1571 - trunk/batman-adv-kernelland

postmaster at open-mesh.net postmaster at open-mesh.net
Sun Feb 14 16:05:45 CET 2010


Author: simon
Date: 2010-02-14 16:05:18 +0100 (Sun, 14 Feb 2010)
New Revision: 1571

Modified:
   trunk/batman-adv-kernelland/routing.c
Log:
batman-adv: bonding: don't ask hash when already found primary router

The probability is very high that we are already dealing with the primary
router when searching for a bonding candidate, so check if we are already found
it before searching with hash_find().

Signed-off-by: Simon Wunderlich <siwu at hrz.tu-chemnitz.de>


Modified: trunk/batman-adv-kernelland/routing.c
===================================================================
--- trunk/batman-adv-kernelland/routing.c	2010-02-13 14:55:59 UTC (rev 1570)
+++ trunk/batman-adv-kernelland/routing.c	2010-02-14 15:05:18 UTC (rev 1571)
@@ -937,11 +937,17 @@
 		return orig_node->router;
 
 	/* find the orig_node which has the primary interface. might
-	 * even be the same as our orig_node in many cases */
+	 * even be the same as our router_orig in many cases */
 
-	primary_orig_node = hash_find(orig_hash, router_orig->primary_addr);
-	if (!primary_orig_node)
-		return orig_node->router;
+	if (memcmp(router_orig->primary_addr,
+				router_orig->orig, ETH_ALEN) == 0) {
+		primary_orig_node = router_orig;
+	} else {
+		primary_orig_node = hash_find(orig_hash,
+						router_orig->primary_addr);
+		if (!primary_orig_node)
+			return orig_node->router;
+	}
 
 	/* with less than 2 candidates, we can't do any
 	 * bonding and prefer the original router. */



More information about the commits mailing list