aboutsummaryrefslogtreecommitdiffstats
path: root/net
diff options
context:
space:
mode:
Diffstat (limited to 'net')
-rw-r--r--net/batman-adv/translation-table.c23
1 files changed, 15 insertions, 8 deletions
diff --git a/net/batman-adv/translation-table.c b/net/batman-adv/translation-table.c
index 9e8748575845..d35b73904e04 100644
--- a/net/batman-adv/translation-table.c
+++ b/net/batman-adv/translation-table.c
@@ -163,10 +163,19 @@ batadv_tt_orig_list_entry_free_ref(struct batadv_tt_orig_list_entry *orig_entry)
163 call_rcu(&orig_entry->rcu, batadv_tt_orig_list_entry_free_rcu); 163 call_rcu(&orig_entry->rcu, batadv_tt_orig_list_entry_free_rcu);
164} 164}
165 165
166/**
167 * batadv_tt_local_event - store a local TT event (ADD/DEL)
168 * @bat_priv: the bat priv with all the soft interface information
169 * @tt_local_entry: the TT entry involved in the event
170 * @event_flags: flags to store in the event structure
171 */
166static void batadv_tt_local_event(struct batadv_priv *bat_priv, 172static void batadv_tt_local_event(struct batadv_priv *bat_priv,
167 const uint8_t *addr, uint8_t flags) 173 struct batadv_tt_local_entry *tt_local_entry,
174 uint8_t event_flags)
168{ 175{
169 struct batadv_tt_change_node *tt_change_node, *entry, *safe; 176 struct batadv_tt_change_node *tt_change_node, *entry, *safe;
177 struct batadv_tt_common_entry *common = &tt_local_entry->common;
178 uint8_t flags = common->flags | event_flags;
170 bool event_removed = false; 179 bool event_removed = false;
171 bool del_op_requested, del_op_entry; 180 bool del_op_requested, del_op_entry;
172 181
@@ -176,7 +185,7 @@ static void batadv_tt_local_event(struct batadv_priv *bat_priv,
176 return; 185 return;
177 186
178 tt_change_node->change.flags = flags; 187 tt_change_node->change.flags = flags;
179 memcpy(tt_change_node->change.addr, addr, ETH_ALEN); 188 memcpy(tt_change_node->change.addr, common->addr, ETH_ALEN);
180 189
181 del_op_requested = flags & BATADV_TT_CLIENT_DEL; 190 del_op_requested = flags & BATADV_TT_CLIENT_DEL;
182 191
@@ -184,7 +193,7 @@ static void batadv_tt_local_event(struct batadv_priv *bat_priv,
184 spin_lock_bh(&bat_priv->tt.changes_list_lock); 193 spin_lock_bh(&bat_priv->tt.changes_list_lock);
185 list_for_each_entry_safe(entry, safe, &bat_priv->tt.changes_list, 194 list_for_each_entry_safe(entry, safe, &bat_priv->tt.changes_list,
186 list) { 195 list) {
187 if (!batadv_compare_eth(entry->change.addr, addr)) 196 if (!batadv_compare_eth(entry->change.addr, common->addr))
188 continue; 197 continue;
189 198
190 /* DEL+ADD in the same orig interval have no effect and can be 199 /* DEL+ADD in the same orig interval have no effect and can be
@@ -332,7 +341,7 @@ void batadv_tt_local_add(struct net_device *soft_iface, const uint8_t *addr,
332 } 341 }
333 342
334add_event: 343add_event:
335 batadv_tt_local_event(bat_priv, addr, tt_local->common.flags); 344 batadv_tt_local_event(bat_priv, tt_local, BATADV_NO_FLAGS);
336 345
337check_roaming: 346check_roaming:
338 /* Check whether it is a roaming, but don't do anything if the roaming 347 /* Check whether it is a roaming, but don't do anything if the roaming
@@ -529,8 +538,7 @@ batadv_tt_local_set_pending(struct batadv_priv *bat_priv,
529 struct batadv_tt_local_entry *tt_local_entry, 538 struct batadv_tt_local_entry *tt_local_entry,
530 uint16_t flags, const char *message) 539 uint16_t flags, const char *message)
531{ 540{
532 batadv_tt_local_event(bat_priv, tt_local_entry->common.addr, 541 batadv_tt_local_event(bat_priv, tt_local_entry, flags);
533 tt_local_entry->common.flags | flags);
534 542
535 /* The local client has to be marked as "pending to be removed" but has 543 /* The local client has to be marked as "pending to be removed" but has
536 * to be kept in the table in order to send it in a full table 544 * to be kept in the table in order to send it in a full table
@@ -584,8 +592,7 @@ uint16_t batadv_tt_local_remove(struct batadv_priv *bat_priv,
584 /* if this client has been added right now, it is possible to 592 /* if this client has been added right now, it is possible to
585 * immediately purge it 593 * immediately purge it
586 */ 594 */
587 batadv_tt_local_event(bat_priv, tt_local_entry->common.addr, 595 batadv_tt_local_event(bat_priv, tt_local_entry, BATADV_TT_CLIENT_DEL);
588 curr_flags | BATADV_TT_CLIENT_DEL);
589 hlist_del_rcu(&tt_local_entry->common.hash_entry); 596 hlist_del_rcu(&tt_local_entry->common.hash_entry);
590 batadv_tt_local_entry_free_ref(tt_local_entry); 597 batadv_tt_local_entry_free_ref(tt_local_entry);
591 598