Merge branch 'batman-adv/maint' of git://git.open-mesh.org/linux-merge

+22 -5
+22 -5
net/batman-adv/translation-table.c
··· 245 245 if (tt_global_entry) { 246 246 /* This node is probably going to update its tt table */ 247 247 tt_global_entry->orig_node->tt_poss_change = true; 248 - /* The global entry has to be marked as PENDING and has to be 248 + /* The global entry has to be marked as ROAMING and has to be 249 249 * kept for consistency purpose */ 250 - tt_global_entry->flags |= TT_CLIENT_PENDING; 250 + tt_global_entry->flags |= TT_CLIENT_ROAM; 251 + tt_global_entry->roam_at = jiffies; 252 + 251 253 send_roam_adv(bat_priv, tt_global_entry->addr, 252 254 tt_global_entry->orig_node); 253 255 } ··· 696 694 const char *message, bool roaming) 697 695 { 698 696 struct tt_global_entry *tt_global_entry = NULL; 697 + struct tt_local_entry *tt_local_entry = NULL; 699 698 700 699 tt_global_entry = tt_global_hash_find(bat_priv, addr); 701 700 if (!tt_global_entry) ··· 704 701 705 702 if (tt_global_entry->orig_node == orig_node) { 706 703 if (roaming) { 707 - tt_global_entry->flags |= TT_CLIENT_ROAM; 708 - tt_global_entry->roam_at = jiffies; 709 - goto out; 704 + /* if we are deleting a global entry due to a roam 705 + * event, there are two possibilities: 706 + * 1) the client roamed from node A to node B => we mark 707 + * it with TT_CLIENT_ROAM, we start a timer and we 708 + * wait for node B to claim it. In case of timeout 709 + * the entry is purged. 710 + * 2) the client roamed to us => we can directly delete 711 + * the global entry, since it is useless now. */ 712 + tt_local_entry = tt_local_hash_find(bat_priv, 713 + tt_global_entry->addr); 714 + if (!tt_local_entry) { 715 + tt_global_entry->flags |= TT_CLIENT_ROAM; 716 + tt_global_entry->roam_at = jiffies; 717 + goto out; 718 + } 710 719 } 711 720 _tt_global_del(bat_priv, tt_global_entry, message); 712 721 } 713 722 out: 714 723 if (tt_global_entry) 715 724 tt_global_entry_free_ref(tt_global_entry); 725 + if (tt_local_entry) 726 + tt_local_entry_free_ref(tt_local_entry); 716 727 } 717 728 718 729 void tt_global_del_orig(struct bat_priv *bat_priv,