Changeset 1571

Show
Ignore:
Timestamp:
02/14/10 16:05:18 (7 months ago)
Author:
simon
Message:

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@…>

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • trunk/batman-adv-kernelland/routing.c

    r1564 r1571  
    938938 
    939939        /* find the orig_node which has the primary interface. might 
    940          * even be the same as our orig_node in many cases */ 
    941  
    942         primary_orig_node = hash_find(orig_hash, router_orig->primary_addr); 
    943         if (!primary_orig_node) 
    944                 return orig_node->router; 
     940         * even be the same as our router_orig in many cases */ 
     941 
     942        if (memcmp(router_orig->primary_addr, 
     943                                router_orig->orig, ETH_ALEN) == 0) { 
     944                primary_orig_node = router_orig; 
     945        } else { 
     946                primary_orig_node = hash_find(orig_hash, 
     947                                                router_orig->primary_addr); 
     948                if (!primary_orig_node) 
     949                        return orig_node->router; 
     950        } 
    945951 
    946952        /* with less than 2 candidates, we can't do any