Commit 92f90f56 authored by Sven Eckelmann's avatar Sven Eckelmann Committed by Marek Lindner

batman-adv: refactor tt_global_del() to avoid misalignment

Signed-off-by: default avatarSven Eckelmann <sven@narfation.org>
Acked-by: default avatarAntonio Quartulli <ordex@autistici.org>
Signed-off-by: default avatarMarek Lindner <lindner_marek@yahoo.de>
parent 032b7969
...@@ -657,29 +657,31 @@ void tt_global_del(struct bat_priv *bat_priv, ...@@ -657,29 +657,31 @@ void tt_global_del(struct bat_priv *bat_priv,
struct tt_local_entry *tt_local_entry = NULL; struct tt_local_entry *tt_local_entry = NULL;
tt_global_entry = tt_global_hash_find(bat_priv, addr); tt_global_entry = tt_global_hash_find(bat_priv, addr);
if (!tt_global_entry) if (!tt_global_entry || tt_global_entry->orig_node != orig_node)
goto out; goto out;
if (tt_global_entry->orig_node == orig_node) { if (!roaming)
if (roaming) { goto out_del;
/* if we are deleting a global entry due to a roam
* event, there are two possibilities: /* if we are deleting a global entry due to a roam
* 1) the client roamed from node A to node B => we mark * event, there are two possibilities:
* it with TT_CLIENT_ROAM, we start a timer and we * 1) the client roamed from node A to node B => we mark
* wait for node B to claim it. In case of timeout * it with TT_CLIENT_ROAM, we start a timer and we
* the entry is purged. * wait for node B to claim it. In case of timeout
* 2) the client roamed to us => we can directly delete * the entry is purged.
* the global entry, since it is useless now. */ * 2) the client roamed to us => we can directly delete
tt_local_entry = tt_local_hash_find(bat_priv, * the global entry, since it is useless now. */
tt_global_entry->common.addr); tt_local_entry = tt_local_hash_find(bat_priv,
if (!tt_local_entry) { tt_global_entry->common.addr);
tt_global_entry->common.flags |= TT_CLIENT_ROAM; if (!tt_local_entry) {
tt_global_entry->roam_at = jiffies; tt_global_entry->common.flags |= TT_CLIENT_ROAM;
goto out; tt_global_entry->roam_at = jiffies;
} goto out;
}
_tt_global_del(bat_priv, tt_global_entry, message);
} }
out_del:
_tt_global_del(bat_priv, tt_global_entry, message);
out: out:
if (tt_global_entry) if (tt_global_entry)
tt_global_entry_free_ref(tt_global_entry); tt_global_entry_free_ref(tt_global_entry);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment