diff options
author | Antonio Quartulli <ordex@autistici.org> | 2011-12-04 16:38:27 -0500 |
---|---|---|
committer | Marek Lindner <lindner_marek@yahoo.de> | 2011-12-06 14:12:59 -0500 |
commit | 797399b415b78dacdbcaffdb89e46e369ec88b98 (patch) | |
tree | 1c140c512317ae78ddb3687270c7fee597586e77 /net/batman-adv/translation-table.c | |
parent | 03fc3070457dc0e6a717a2e732af93ef1cb2ae51 (diff) |
batman-adv: delete global entry in case of roaming
When receiving a DEL change for a client due to a roaming event (change is
marked with TT_CLIENT_ROAM), each node has to check if the client roamed
to itself or somewhere else.
In the latter case the global entry is kept to avoid having no route at all
otherwise we can safely delete the global entry
Signed-off-by: Antonio Quartulli <ordex@autistici.org>
Diffstat (limited to 'net/batman-adv/translation-table.c')
-rw-r--r-- | net/batman-adv/translation-table.c | 21 |
1 files changed, 18 insertions, 3 deletions
diff --git a/net/batman-adv/translation-table.c b/net/batman-adv/translation-table.c index c46b1407c885..5f09a578d49d 100644 --- a/net/batman-adv/translation-table.c +++ b/net/batman-adv/translation-table.c | |||
@@ -696,6 +696,7 @@ void tt_global_del(struct bat_priv *bat_priv, | |||
696 | const char *message, bool roaming) | 696 | const char *message, bool roaming) |
697 | { | 697 | { |
698 | struct tt_global_entry *tt_global_entry = NULL; | 698 | struct tt_global_entry *tt_global_entry = NULL; |
699 | struct tt_local_entry *tt_local_entry = NULL; | ||
699 | 700 | ||
700 | tt_global_entry = tt_global_hash_find(bat_priv, addr); | 701 | tt_global_entry = tt_global_hash_find(bat_priv, addr); |
701 | if (!tt_global_entry) | 702 | if (!tt_global_entry) |
@@ -703,15 +704,29 @@ void tt_global_del(struct bat_priv *bat_priv, | |||
703 | 704 | ||
704 | if (tt_global_entry->orig_node == orig_node) { | 705 | if (tt_global_entry->orig_node == orig_node) { |
705 | if (roaming) { | 706 | if (roaming) { |
706 | tt_global_entry->flags |= TT_CLIENT_ROAM; | 707 | /* if we are deleting a global entry due to a roam |
707 | tt_global_entry->roam_at = jiffies; | 708 | * event, there are two possibilities: |
708 | goto out; | 709 | * 1) the client roamed from node A to node B => we mark |
710 | * it with TT_CLIENT_ROAM, we start a timer and we | ||
711 | * wait for node B to claim it. In case of timeout | ||
712 | * the entry is purged. | ||
713 | * 2) the client roamed to us => we can directly delete | ||
714 | * the global entry, since it is useless now. */ | ||
715 | tt_local_entry = tt_local_hash_find(bat_priv, | ||
716 | tt_global_entry->addr); | ||
717 | if (!tt_local_entry) { | ||
718 | tt_global_entry->flags |= TT_CLIENT_ROAM; | ||
719 | tt_global_entry->roam_at = jiffies; | ||
720 | goto out; | ||
721 | } | ||
709 | } | 722 | } |
710 | _tt_global_del(bat_priv, tt_global_entry, message); | 723 | _tt_global_del(bat_priv, tt_global_entry, message); |
711 | } | 724 | } |
712 | out: | 725 | out: |
713 | if (tt_global_entry) | 726 | if (tt_global_entry) |
714 | tt_global_entry_free_ref(tt_global_entry); | 727 | tt_global_entry_free_ref(tt_global_entry); |
728 | if (tt_local_entry) | ||
729 | tt_local_entry_free_ref(tt_local_entry); | ||
715 | } | 730 | } |
716 | 731 | ||
717 | void tt_global_del_orig(struct bat_priv *bat_priv, | 732 | void tt_global_del_orig(struct bat_priv *bat_priv, |