aboutsummaryrefslogtreecommitdiffstats
path: root/net/batman-adv/translation-table.c
diff options
context:
space:
mode:
authorAntonio Quartulli <ordex@autistici.org>2012-08-27 05:44:43 -0400
committerAntonio Quartulli <ordex@autistici.org>2012-10-29 04:42:49 -0400
commit7f91d06c90204227e91a1332c8c8e527009ec778 (patch)
treef79be70eb05d80280aa523c3507298efd7bceb0e /net/batman-adv/translation-table.c
parent9f9ff08d26b2f6ecea7900a9c9543c627cd95e56 (diff)
batman-adv: pass the WIFI flag from the local to global entry
in case of client roaming a new global entry is added while a corresponding local one is still present. In this case the node can safely pass the WIFI flag from the local to the global entry. This change is required to let the AP-isolation correctly working in case of roaming: if a generic WIFI client C roams from node A to B, A adds a global entry for C without adding any WIFI flag. The latter will be set only later, once A has received C's advertisement from B. In this time period the AP-Isolation (if enabled) would not correctly work since C is not marked as WIFI, so allowing it to communicate with other WIFI clients. Signed-off-by: Antonio Quartulli <ordex@autistici.org>
Diffstat (limited to 'net/batman-adv/translation-table.c')
-rw-r--r--net/batman-adv/translation-table.c31
1 files changed, 25 insertions, 6 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
492void 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 */
501uint16_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
507out: 520out:
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
512static void batadv_tt_local_purge_list(struct batadv_priv *bat_priv, 527static 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
787out_remove: 803out_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
792out: 811out:
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);