diff options
-rw-r--r-- | net/batman-adv/translation-table.c | 31 | ||||
-rw-r--r-- | net/batman-adv/translation-table.h | 6 |
2 files changed, 28 insertions, 9 deletions
diff --git a/net/batman-adv/translation-table.c b/net/batman-adv/translation-table.c index c61209f764b1..a570d957a5a0 100644 --- a/net/batman-adv/translation-table.c +++ b/net/batman-adv/translation-table.c | |||
@@ -489,24 +489,39 @@ batadv_tt_local_set_pending(struct batadv_priv *bat_priv, | |||
489 | tt_local_entry->common.addr, message); | 489 | tt_local_entry->common.addr, message); |
490 | } | 490 | } |
491 | 491 | ||
492 | void batadv_tt_local_remove(struct batadv_priv *bat_priv, const uint8_t *addr, | 492 | /** |
493 | const char *message, bool roaming) | 493 | * batadv_tt_local_remove - logically remove an entry from the local table |
494 | * @bat_priv: the bat priv with all the soft interface information | ||
495 | * @addr: the MAC address of the client to remove | ||
496 | * @message: message to append to the log on deletion | ||
497 | * @roaming: true if the deletion is due to a roaming event | ||
498 | * | ||
499 | * Returns the flags assigned to the local entry before being deleted | ||
500 | */ | ||
501 | uint16_t batadv_tt_local_remove(struct batadv_priv *bat_priv, | ||
502 | const uint8_t *addr, const char *message, | ||
503 | bool roaming) | ||
494 | { | 504 | { |
495 | struct batadv_tt_local_entry *tt_local_entry = NULL; | 505 | struct batadv_tt_local_entry *tt_local_entry = NULL; |
496 | uint16_t flags; | 506 | uint16_t flags, curr_flags = BATADV_NO_FLAGS; |
497 | 507 | ||
498 | tt_local_entry = batadv_tt_local_hash_find(bat_priv, addr); | 508 | tt_local_entry = batadv_tt_local_hash_find(bat_priv, addr); |
499 | if (!tt_local_entry) | 509 | if (!tt_local_entry) |
500 | goto out; | 510 | goto out; |
501 | 511 | ||
512 | curr_flags = tt_local_entry->common.flags; | ||
513 | |||
502 | flags = BATADV_TT_CLIENT_DEL; | 514 | flags = BATADV_TT_CLIENT_DEL; |
503 | if (roaming) | 515 | if (roaming) |
504 | flags |= BATADV_TT_CLIENT_ROAM; | 516 | flags |= BATADV_TT_CLIENT_ROAM; |
505 | 517 | ||
506 | batadv_tt_local_set_pending(bat_priv, tt_local_entry, flags, message); | 518 | batadv_tt_local_set_pending(bat_priv, tt_local_entry, flags, message); |
519 | |||
507 | out: | 520 | out: |
508 | if (tt_local_entry) | 521 | if (tt_local_entry) |
509 | batadv_tt_local_entry_free_ref(tt_local_entry); | 522 | batadv_tt_local_entry_free_ref(tt_local_entry); |
523 | |||
524 | return curr_flags; | ||
510 | } | 525 | } |
511 | 526 | ||
512 | static void batadv_tt_local_purge_list(struct batadv_priv *bat_priv, | 527 | static void batadv_tt_local_purge_list(struct batadv_priv *bat_priv, |
@@ -713,6 +728,7 @@ int batadv_tt_global_add(struct batadv_priv *bat_priv, | |||
713 | int ret = 0; | 728 | int ret = 0; |
714 | int hash_added; | 729 | int hash_added; |
715 | struct batadv_tt_common_entry *common; | 730 | struct batadv_tt_common_entry *common; |
731 | uint16_t local_flags; | ||
716 | 732 | ||
717 | tt_global_entry = batadv_tt_global_hash_find(bat_priv, tt_addr); | 733 | tt_global_entry = batadv_tt_global_hash_find(bat_priv, tt_addr); |
718 | 734 | ||
@@ -785,10 +801,13 @@ int batadv_tt_global_add(struct batadv_priv *bat_priv, | |||
785 | ret = 1; | 801 | ret = 1; |
786 | 802 | ||
787 | out_remove: | 803 | out_remove: |
804 | |||
788 | /* remove address from local hash if present */ | 805 | /* remove address from local hash if present */ |
789 | batadv_tt_local_remove(bat_priv, tt_global_entry->common.addr, | 806 | local_flags = batadv_tt_local_remove(bat_priv, tt_addr, |
790 | "global tt received", | 807 | "global tt received", |
791 | flags & BATADV_TT_CLIENT_ROAM); | 808 | flags & BATADV_TT_CLIENT_ROAM); |
809 | tt_global_entry->common.flags |= local_flags & BATADV_TT_CLIENT_WIFI; | ||
810 | |||
792 | out: | 811 | out: |
793 | if (tt_global_entry) | 812 | if (tt_global_entry) |
794 | batadv_tt_global_entry_free_ref(tt_global_entry); | 813 | batadv_tt_global_entry_free_ref(tt_global_entry); |
diff --git a/net/batman-adv/translation-table.h b/net/batman-adv/translation-table.h index 811fffd4760c..9fa4fe41c868 100644 --- a/net/batman-adv/translation-table.h +++ b/net/batman-adv/translation-table.h | |||
@@ -24,9 +24,9 @@ int batadv_tt_len(int changes_num); | |||
24 | int batadv_tt_init(struct batadv_priv *bat_priv); | 24 | int batadv_tt_init(struct batadv_priv *bat_priv); |
25 | void batadv_tt_local_add(struct net_device *soft_iface, const uint8_t *addr, | 25 | void batadv_tt_local_add(struct net_device *soft_iface, const uint8_t *addr, |
26 | int ifindex); | 26 | int ifindex); |
27 | void batadv_tt_local_remove(struct batadv_priv *bat_priv, | 27 | uint16_t batadv_tt_local_remove(struct batadv_priv *bat_priv, |
28 | const uint8_t *addr, const char *message, | 28 | const uint8_t *addr, const char *message, |
29 | bool roaming); | 29 | bool roaming); |
30 | int batadv_tt_local_seq_print_text(struct seq_file *seq, void *offset); | 30 | int batadv_tt_local_seq_print_text(struct seq_file *seq, void *offset); |
31 | void batadv_tt_global_add_orig(struct batadv_priv *bat_priv, | 31 | void batadv_tt_global_add_orig(struct batadv_priv *bat_priv, |
32 | struct batadv_orig_node *orig_node, | 32 | struct batadv_orig_node *orig_node, |