diff options
author | Sven Eckelmann <sven@narfation.org> | 2011-12-22 07:31:12 -0500 |
---|---|---|
committer | Marek Lindner <lindner_marek@yahoo.de> | 2012-02-16 13:50:20 -0500 |
commit | 92f90f56caa30dfcb6c5755776d73df23ef2ae1a (patch) | |
tree | 456aa249735742039e5bca0b9d832eda99899e71 /net/batman-adv | |
parent | 032b7969f8874d5ddc65691cd3d008beffd2a09e (diff) |
batman-adv: refactor tt_global_del() to avoid misalignment
Signed-off-by: Sven Eckelmann <sven@narfation.org>
Acked-by: Antonio Quartulli <ordex@autistici.org>
Signed-off-by: Marek Lindner <lindner_marek@yahoo.de>
Diffstat (limited to 'net/batman-adv')
-rw-r--r-- | net/batman-adv/translation-table.c | 42 |
1 files changed, 22 insertions, 20 deletions
diff --git a/net/batman-adv/translation-table.c b/net/batman-adv/translation-table.c index ff9a1b33c136..30c2d1b7de49 100644 --- a/net/batman-adv/translation-table.c +++ b/net/batman-adv/translation-table.c | |||
@@ -657,29 +657,31 @@ void tt_global_del(struct bat_priv *bat_priv, | |||
657 | struct tt_local_entry *tt_local_entry = NULL; | 657 | struct tt_local_entry *tt_local_entry = NULL; |
658 | 658 | ||
659 | tt_global_entry = tt_global_hash_find(bat_priv, addr); | 659 | tt_global_entry = tt_global_hash_find(bat_priv, addr); |
660 | if (!tt_global_entry) | 660 | if (!tt_global_entry || tt_global_entry->orig_node != orig_node) |
661 | goto out; | 661 | goto out; |
662 | 662 | ||
663 | if (tt_global_entry->orig_node == orig_node) { | 663 | if (!roaming) |
664 | if (roaming) { | 664 | goto out_del; |
665 | /* if we are deleting a global entry due to a roam | 665 | |
666 | * event, there are two possibilities: | 666 | /* if we are deleting a global entry due to a roam |
667 | * 1) the client roamed from node A to node B => we mark | 667 | * event, there are two possibilities: |
668 | * it with TT_CLIENT_ROAM, we start a timer and we | 668 | * 1) the client roamed from node A to node B => we mark |
669 | * wait for node B to claim it. In case of timeout | 669 | * it with TT_CLIENT_ROAM, we start a timer and we |
670 | * the entry is purged. | 670 | * wait for node B to claim it. In case of timeout |
671 | * 2) the client roamed to us => we can directly delete | 671 | * the entry is purged. |
672 | * the global entry, since it is useless now. */ | 672 | * 2) the client roamed to us => we can directly delete |
673 | tt_local_entry = tt_local_hash_find(bat_priv, | 673 | * the global entry, since it is useless now. */ |
674 | tt_global_entry->common.addr); | 674 | tt_local_entry = tt_local_hash_find(bat_priv, |
675 | if (!tt_local_entry) { | 675 | tt_global_entry->common.addr); |
676 | tt_global_entry->common.flags |= TT_CLIENT_ROAM; | 676 | if (!tt_local_entry) { |
677 | tt_global_entry->roam_at = jiffies; | 677 | tt_global_entry->common.flags |= TT_CLIENT_ROAM; |
678 | goto out; | 678 | tt_global_entry->roam_at = jiffies; |
679 | } | 679 | goto out; |
680 | } | ||
681 | _tt_global_del(bat_priv, tt_global_entry, message); | ||
682 | } | 680 | } |
681 | |||
682 | out_del: | ||
683 | _tt_global_del(bat_priv, tt_global_entry, message); | ||
684 | |||
683 | out: | 685 | out: |
684 | if (tt_global_entry) | 686 | if (tt_global_entry) |
685 | tt_global_entry_free_ref(tt_global_entry); | 687 | tt_global_entry_free_ref(tt_global_entry); |