aboutsummaryrefslogtreecommitdiffstats
path: root/net/batman-adv/translation-table.c
diff options
context:
space:
mode:
Diffstat (limited to 'net/batman-adv/translation-table.c')
-rw-r--r--net/batman-adv/translation-table.c21
1 files changed, 10 insertions, 11 deletions
diff --git a/net/batman-adv/translation-table.c b/net/batman-adv/translation-table.c
index 4208dc71257b..06d361d4ac4b 100644
--- a/net/batman-adv/translation-table.c
+++ b/net/batman-adv/translation-table.c
@@ -143,8 +143,8 @@ static void tt_global_entry_free_ref(struct tt_global_entry *tt_global_entry)
143 kfree_rcu(tt_global_entry, rcu); 143 kfree_rcu(tt_global_entry, rcu);
144} 144}
145 145
146static void tt_local_event(struct bat_priv *bat_priv, uint8_t op, 146static void tt_local_event(struct bat_priv *bat_priv, const uint8_t *addr,
147 const uint8_t *addr, bool roaming) 147 uint8_t flags)
148{ 148{
149 struct tt_change_node *tt_change_node; 149 struct tt_change_node *tt_change_node;
150 150
@@ -153,10 +153,7 @@ static void tt_local_event(struct bat_priv *bat_priv, uint8_t op,
153 if (!tt_change_node) 153 if (!tt_change_node)
154 return; 154 return;
155 155
156 tt_change_node->change.flags = op; 156 tt_change_node->change.flags = flags;
157 if (roaming)
158 tt_change_node->change.flags |= TT_CLIENT_ROAM;
159
160 memcpy(tt_change_node->change.addr, addr, ETH_ALEN); 157 memcpy(tt_change_node->change.addr, addr, ETH_ALEN);
161 158
162 spin_lock_bh(&bat_priv->tt_changes_list_lock); 159 spin_lock_bh(&bat_priv->tt_changes_list_lock);
@@ -203,8 +200,6 @@ void tt_local_add(struct net_device *soft_iface, const uint8_t *addr)
203 if (!tt_local_entry) 200 if (!tt_local_entry)
204 goto out; 201 goto out;
205 202
206 tt_local_event(bat_priv, NO_FLAGS, addr, false);
207
208 bat_dbg(DBG_TT, bat_priv, 203 bat_dbg(DBG_TT, bat_priv,
209 "Creating new local tt entry: %pM (ttvn: %d)\n", addr, 204 "Creating new local tt entry: %pM (ttvn: %d)\n", addr,
210 (uint8_t)atomic_read(&bat_priv->ttvn)); 205 (uint8_t)atomic_read(&bat_priv->ttvn));
@@ -218,6 +213,8 @@ void tt_local_add(struct net_device *soft_iface, const uint8_t *addr)
218 if (compare_eth(addr, soft_iface->dev_addr)) 213 if (compare_eth(addr, soft_iface->dev_addr))
219 tt_local_entry->flags |= TT_CLIENT_NOPURGE; 214 tt_local_entry->flags |= TT_CLIENT_NOPURGE;
220 215
216 tt_local_event(bat_priv, addr, tt_local_entry->flags);
217
221 hash_add(bat_priv->tt_local_hash, compare_ltt, choose_orig, 218 hash_add(bat_priv->tt_local_hash, compare_ltt, choose_orig,
222 tt_local_entry, &tt_local_entry->hash_entry); 219 tt_local_entry, &tt_local_entry->hash_entry);
223 220
@@ -386,7 +383,9 @@ void tt_local_remove(struct bat_priv *bat_priv, const uint8_t *addr,
386 if (!tt_local_entry) 383 if (!tt_local_entry)
387 goto out; 384 goto out;
388 385
389 tt_local_event(bat_priv, TT_CLIENT_DEL, tt_local_entry->addr, roaming); 386 tt_local_event(bat_priv, tt_local_entry->addr,
387 tt_local_entry->flags | TT_CLIENT_DEL |
388 (roaming ? TT_CLIENT_ROAM : NO_FLAGS));
390 tt_local_del(bat_priv, tt_local_entry, message); 389 tt_local_del(bat_priv, tt_local_entry, message);
391out: 390out:
392 if (tt_local_entry) 391 if (tt_local_entry)
@@ -416,8 +415,8 @@ static void tt_local_purge(struct bat_priv *bat_priv)
416 TT_LOCAL_TIMEOUT * 1000)) 415 TT_LOCAL_TIMEOUT * 1000))
417 continue; 416 continue;
418 417
419 tt_local_event(bat_priv, TT_CLIENT_DEL, 418 tt_local_event(bat_priv, tt_local_entry->addr,
420 tt_local_entry->addr, false); 419 tt_local_entry->flags | TT_CLIENT_DEL);
421 atomic_dec(&bat_priv->num_local_tt); 420 atomic_dec(&bat_priv->num_local_tt);
422 bat_dbg(DBG_TT, bat_priv, "Deleting local " 421 bat_dbg(DBG_TT, bat_priv, "Deleting local "
423 "tt entry (%pM): timed out\n", 422 "tt entry (%pM): timed out\n",