aboutsummaryrefslogtreecommitdiffstats
path: root/net/batman-adv
diff options
context:
space:
mode:
authorAntonio Quartulli <antonio@open-mesh.com>2013-08-07 12:28:55 -0400
committerAntonio Quartulli <antonio@meshcoding.com>2013-10-19 17:25:37 -0400
commit95fb130d68656174a417ad19e7bc8e8ecf382dab (patch)
treea3088a8c8217330e4d9fc84413ff9fa24a4debaf /net/batman-adv
parent7ea7b4a142758deaf46c1af0ca9ceca6dd55138b (diff)
batman-adv: make the TT global purge routine VLAN specific
Instead of unconditionally removing all the TT entries served by a given originator, make tt_global_orig_del() remove only entries matching a given VLAN identifier provided as argument. If such argument is negative all the global entries served by the originator are removed. This change is used into the BLA code to purge entries served by a newly discovered Backbone node, but limiting the operation only to those connected to the VLAN where the backbone has been discovered. 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')
-rw-r--r--net/batman-adv/bridge_loop_avoidance.c4
-rw-r--r--net/batman-adv/originator.c2
-rw-r--r--net/batman-adv/routing.c2
-rw-r--r--net/batman-adv/translation-table.c17
-rw-r--r--net/batman-adv/translation-table.h2
5 files changed, 21 insertions, 6 deletions
diff --git a/net/batman-adv/bridge_loop_avoidance.c b/net/batman-adv/bridge_loop_avoidance.c
index e8a6458081e8..3b3867db88a7 100644
--- a/net/batman-adv/bridge_loop_avoidance.c
+++ b/net/batman-adv/bridge_loop_avoidance.c
@@ -411,10 +411,10 @@ batadv_bla_get_backbone_gw(struct batadv_priv *bat_priv, uint8_t *orig,
411 return NULL; 411 return NULL;
412 } 412 }
413 413
414 /* this is a gateway now, remove any tt entries */ 414 /* this is a gateway now, remove any TT entry on this VLAN */
415 orig_node = batadv_orig_hash_find(bat_priv, orig); 415 orig_node = batadv_orig_hash_find(bat_priv, orig);
416 if (orig_node) { 416 if (orig_node) {
417 batadv_tt_global_del_orig(bat_priv, orig_node, 417 batadv_tt_global_del_orig(bat_priv, orig_node, vid,
418 "became a backbone gateway"); 418 "became a backbone gateway");
419 batadv_orig_node_free_ref(orig_node); 419 batadv_orig_node_free_ref(orig_node);
420 } 420 }
diff --git a/net/batman-adv/originator.c b/net/batman-adv/originator.c
index 7a499dad53d3..ee1d84724205 100644
--- a/net/batman-adv/originator.c
+++ b/net/batman-adv/originator.c
@@ -230,7 +230,7 @@ static void batadv_orig_node_free_rcu(struct rcu_head *rcu)
230 230
231 batadv_frag_purge_orig(orig_node, NULL); 231 batadv_frag_purge_orig(orig_node, NULL);
232 232
233 batadv_tt_global_del_orig(orig_node->bat_priv, orig_node, 233 batadv_tt_global_del_orig(orig_node->bat_priv, orig_node, -1,
234 "originator timed out"); 234 "originator timed out");
235 235
236 kfree(orig_node->tt_buff); 236 kfree(orig_node->tt_buff);
diff --git a/net/batman-adv/routing.c b/net/batman-adv/routing.c
index 149ef57e78c3..4bcf22129ffe 100644
--- a/net/batman-adv/routing.c
+++ b/net/batman-adv/routing.c
@@ -47,7 +47,7 @@ static void _batadv_update_route(struct batadv_priv *bat_priv,
47 if ((curr_router) && (!neigh_node)) { 47 if ((curr_router) && (!neigh_node)) {
48 batadv_dbg(BATADV_DBG_ROUTES, bat_priv, 48 batadv_dbg(BATADV_DBG_ROUTES, bat_priv,
49 "Deleting route towards: %pM\n", orig_node->orig); 49 "Deleting route towards: %pM\n", orig_node->orig);
50 batadv_tt_global_del_orig(bat_priv, orig_node, 50 batadv_tt_global_del_orig(bat_priv, orig_node, -1,
51 "Deleted route towards originator"); 51 "Deleted route towards originator");
52 52
53 /* route added */ 53 /* route added */
diff --git a/net/batman-adv/translation-table.c b/net/batman-adv/translation-table.c
index 41a8387c5ef8..4c313ff8b12f 100644
--- a/net/batman-adv/translation-table.c
+++ b/net/batman-adv/translation-table.c
@@ -1581,8 +1581,18 @@ out:
1581 batadv_tt_local_entry_free_ref(local_entry); 1581 batadv_tt_local_entry_free_ref(local_entry);
1582} 1582}
1583 1583
1584/**
1585 * batadv_tt_global_del_orig - remove all the TT global entries belonging to the
1586 * given originator matching the provided vid
1587 * @bat_priv: the bat priv with all the soft interface information
1588 * @orig_node: the originator owning the entries to remove
1589 * @match_vid: the VLAN identifier to match. If negative all the entries will be
1590 * removed
1591 * @message: debug message to print as "reason"
1592 */
1584void batadv_tt_global_del_orig(struct batadv_priv *bat_priv, 1593void batadv_tt_global_del_orig(struct batadv_priv *bat_priv,
1585 struct batadv_orig_node *orig_node, 1594 struct batadv_orig_node *orig_node,
1595 int32_t match_vid,
1586 const char *message) 1596 const char *message)
1587{ 1597{
1588 struct batadv_tt_global_entry *tt_global; 1598 struct batadv_tt_global_entry *tt_global;
@@ -1604,6 +1614,10 @@ void batadv_tt_global_del_orig(struct batadv_priv *bat_priv,
1604 spin_lock_bh(list_lock); 1614 spin_lock_bh(list_lock);
1605 hlist_for_each_entry_safe(tt_common_entry, safe, 1615 hlist_for_each_entry_safe(tt_common_entry, safe,
1606 head, hash_entry) { 1616 head, hash_entry) {
1617 /* remove only matching entries */
1618 if (match_vid >= 0 && tt_common_entry->vid != match_vid)
1619 continue;
1620
1607 tt_global = container_of(tt_common_entry, 1621 tt_global = container_of(tt_common_entry,
1608 struct batadv_tt_global_entry, 1622 struct batadv_tt_global_entry,
1609 common); 1623 common);
@@ -2570,7 +2584,8 @@ static void batadv_tt_fill_gtable(struct batadv_priv *bat_priv,
2570 goto out; 2584 goto out;
2571 2585
2572 /* Purge the old table first.. */ 2586 /* Purge the old table first.. */
2573 batadv_tt_global_del_orig(bat_priv, orig_node, "Received full table"); 2587 batadv_tt_global_del_orig(bat_priv, orig_node, -1,
2588 "Received full table");
2574 2589
2575 _batadv_tt_update_changes(bat_priv, orig_node, tt_change, num_entries, 2590 _batadv_tt_update_changes(bat_priv, orig_node, tt_change, num_entries,
2576 ttvn); 2591 ttvn);
diff --git a/net/batman-adv/translation-table.h b/net/batman-adv/translation-table.h
index c6bf33c04855..dc6db4e00a43 100644
--- a/net/batman-adv/translation-table.h
+++ b/net/batman-adv/translation-table.h
@@ -30,7 +30,7 @@ int batadv_tt_local_seq_print_text(struct seq_file *seq, void *offset);
30int batadv_tt_global_seq_print_text(struct seq_file *seq, void *offset); 30int batadv_tt_global_seq_print_text(struct seq_file *seq, void *offset);
31void batadv_tt_global_del_orig(struct batadv_priv *bat_priv, 31void batadv_tt_global_del_orig(struct batadv_priv *bat_priv,
32 struct batadv_orig_node *orig_node, 32 struct batadv_orig_node *orig_node,
33 const char *message); 33 int32_t match_vid, const char *message);
34struct batadv_orig_node *batadv_transtable_search(struct batadv_priv *bat_priv, 34struct batadv_orig_node *batadv_transtable_search(struct batadv_priv *bat_priv,
35 const uint8_t *src, 35 const uint8_t *src,
36 const uint8_t *addr, 36 const uint8_t *addr,