aboutsummaryrefslogtreecommitdiffstats
path: root/net/batman-adv/bridge_loop_avoidance.c
diff options
context:
space:
mode:
authorAntonio Quartulli <antonio@open-mesh.com>2013-08-07 12:28:56 -0400
committerAntonio Quartulli <antonio@meshcoding.com>2013-10-19 17:25:38 -0400
commitcfd4f75701b6b13b1ec74e6f65ad0d1969c19247 (patch)
tree63098d1077d69fd908a5f2916d72ba5f939e3389 /net/batman-adv/bridge_loop_avoidance.c
parent95fb130d68656174a417ad19e7bc8e8ecf382dab (diff)
batman-adv: make the backbone gw check VLAN specific
The backbone gw check has to be VLAN specific so that code using it can specify VID where the check has to be done. In the TT code, the check has been moved into the tt_global_add() function so that it can be performed on a per-entry basis instead of ignoring all the TT data received from another backbone node. Only TT global entries belonging to the VLAN where the backbone node is connected to are skipped. All the other spots where the TT code was checking whether a node is a backbone have been removed. Moreover, batadv_bla_is_backbone_gw_orig() now returns bool since it used to return only 1 or 0. Cc: Simon Wunderlich <siwu@hrz.tu-chemnitz.de> Signed-off-by: Antonio Quartulli <antonio@open-mesh.com> Signed-off-by: Marek Lindner <lindner_marek@yahoo.de>
Diffstat (limited to 'net/batman-adv/bridge_loop_avoidance.c')
-rw-r--r--net/batman-adv/bridge_loop_avoidance.c19
1 files changed, 11 insertions, 8 deletions
diff --git a/net/batman-adv/bridge_loop_avoidance.c b/net/batman-adv/bridge_loop_avoidance.c
index 3b3867db88a7..28eb5e6d0a02 100644
--- a/net/batman-adv/bridge_loop_avoidance.c
+++ b/net/batman-adv/bridge_loop_avoidance.c
@@ -1315,12 +1315,14 @@ out:
1315 1315
1316/* @bat_priv: the bat priv with all the soft interface information 1316/* @bat_priv: the bat priv with all the soft interface information
1317 * @orig: originator mac address 1317 * @orig: originator mac address
1318 * @vid: VLAN identifier
1318 * 1319 *
1319 * check if the originator is a gateway for any VLAN ID. 1320 * Check if the originator is a gateway for the VLAN identified by vid.
1320 * 1321 *
1321 * returns 1 if it is found, 0 otherwise 1322 * Returns true if orig is a backbone for this vid, false otherwise.
1322 */ 1323 */
1323int batadv_bla_is_backbone_gw_orig(struct batadv_priv *bat_priv, uint8_t *orig) 1324bool batadv_bla_is_backbone_gw_orig(struct batadv_priv *bat_priv, uint8_t *orig,
1325 unsigned short vid)
1324{ 1326{
1325 struct batadv_hashtable *hash = bat_priv->bla.backbone_hash; 1327 struct batadv_hashtable *hash = bat_priv->bla.backbone_hash;
1326 struct hlist_head *head; 1328 struct hlist_head *head;
@@ -1328,25 +1330,26 @@ int batadv_bla_is_backbone_gw_orig(struct batadv_priv *bat_priv, uint8_t *orig)
1328 int i; 1330 int i;
1329 1331
1330 if (!atomic_read(&bat_priv->bridge_loop_avoidance)) 1332 if (!atomic_read(&bat_priv->bridge_loop_avoidance))
1331 return 0; 1333 return false;
1332 1334
1333 if (!hash) 1335 if (!hash)
1334 return 0; 1336 return false;
1335 1337
1336 for (i = 0; i < hash->size; i++) { 1338 for (i = 0; i < hash->size; i++) {
1337 head = &hash->table[i]; 1339 head = &hash->table[i];
1338 1340
1339 rcu_read_lock(); 1341 rcu_read_lock();
1340 hlist_for_each_entry_rcu(backbone_gw, head, hash_entry) { 1342 hlist_for_each_entry_rcu(backbone_gw, head, hash_entry) {
1341 if (batadv_compare_eth(backbone_gw->orig, orig)) { 1343 if (batadv_compare_eth(backbone_gw->orig, orig) &&
1344 backbone_gw->vid == vid) {
1342 rcu_read_unlock(); 1345 rcu_read_unlock();
1343 return 1; 1346 return true;
1344 } 1347 }
1345 } 1348 }
1346 rcu_read_unlock(); 1349 rcu_read_unlock();
1347 } 1350 }
1348 1351
1349 return 0; 1352 return false;
1350} 1353}
1351 1354
1352 1355