batman-adv: move neigh_node->if_incoming->if_status check in find_router()
authorAntonio Quartulli <ordex@autistici.org>
Sun, 8 May 2011 18:52:57 +0000 (20:52 +0200)
committerSven Eckelmann <sven@narfation.org>
Mon, 30 May 2011 05:39:27 +0000 (07:39 +0200)
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 <ordex@autistici.org>
Signed-off-by: Sven Eckelmann <sven@narfation.org>
net/batman-adv/routing.c
net/batman-adv/unicast.c

index bb1c3ec7e3ff2ce2f54654b56c07d238622a1469..8c403ce785d0885c76e8c24ae3d45e7e50768cbf 100644 (file)
@@ -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:
index 19c3daf34ac638043bd9f1818b405d26e79b494c..bab6076c43344b8a32e44512c04d12c3300bb7da 100644 (file)
@@ -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;