Skip to contentSkip to conversation

batman-adv: fix and simplify condition when bonding should be used

PATCH Applied Simon Wunderlich 2 participants 2 messages Aug 13, 2014 – Nov 9, 2014

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 batman-adv: fix and simplify condition when bonding should be used

The current condition actually does NOT consider bonding when the interface the packet came in from is the soft interface, which is the opposite of what it should do (and the comment describes). Fix that and slightly simplify the condition.

---
 routing.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
routing.c +4 -2
index 35f76f2..6648f32 100644
@@ -443,11 +443,13 @@ batadv_find_router(struct batadv_priv *bat_priv,
 
 	router = batadv_orig_router_get(orig_node, recv_if);
 
+	if (!router)
+		return router;
+
 	/* only consider bonding for recv_if == BATADV_IF_DEFAULT (first hop)
 	 * and if activated.
 	 */
-	if (recv_if == BATADV_IF_DEFAULT || !atomic_read(&bat_priv->bonding) ||
-	    !router)
+	if (!(recv_if == BATADV_IF_DEFAULT && atomic_read(&bat_priv->bonding)))
 		return router;
 
 	/* bonding: loop through the list of possible routers found
Signature · 1 line
2.1.0.rc1
#1 lore raw
Quoted 10 lines · On Wednesday 13 August 2014 14:26:56 Simon Wunderlich wrote:

The current condition actually does NOT consider bonding when the interface the packet came in from is the soft interface, which is the opposite of what it should do (and the comment describes). Fix that and slightly simplify the condition.

---
 routing.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

Applied in revision 47dc789.

Thanks,
Marek