From e2cbc11c0e1225bd5fe183a967fc80df3db10745 Mon Sep 17 00:00:00 2001 From: Antonio Quartulli Date: Sun, 8 May 2011 20:52:57 +0200 Subject: [PATCH] batman-adv: move neigh_node->if_incoming->if_status check in find_router() Every time that find_router() is invoked, if_status has to be compared with IF_ACTIVE. Moving this comparison inside find_router() will avoid to write it each time. Signed-off-by: Antonio Quartulli Signed-off-by: Sven Eckelmann --- net/batman-adv/routing.c | 3 +++ net/batman-adv/unicast.c | 3 --- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/net/batman-adv/routing.c b/net/batman-adv/routing.c index bb1c3ec7e3ff..8c403ce785d0 100644 --- a/net/batman-adv/routing.c +++ b/net/batman-adv/routing.c @@ -1240,6 +1240,9 @@ struct neigh_node *find_router(struct bat_priv *bat_priv, router = find_ifalter_router(primary_orig_node, recv_if); return_router: + if (router && router->if_incoming->if_status != IF_ACTIVE) + goto err_unlock; + rcu_read_unlock(); return router; err_unlock: diff --git a/net/batman-adv/unicast.c b/net/batman-adv/unicast.c index 19c3daf34ac6..bab6076c4334 100644 --- a/net/batman-adv/unicast.c +++ b/net/batman-adv/unicast.c @@ -314,9 +314,6 @@ find_router: if (!neigh_node) goto out; - if (neigh_node->if_incoming->if_status != IF_ACTIVE) - goto out; - if (my_skb_head_push(skb, sizeof(struct unicast_packet)) < 0) goto out; -- 2.20.1