327-mac80211-Remove-MPP-table-entries-with-MPath.patch 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. From: Henning Rogge <hrogge@gmail.com>
  2. Date: Wed, 3 Feb 2016 13:58:36 +0100
  3. Subject: [PATCH] mac80211: Remove MPP table entries with MPath
  4. Make the mesh_path_del() function remove all mpp table entries
  5. that are proxied by the removed mesh path.
  6. Acked-by: Bob Copeland <me@bobcopeland.com>
  7. Signed-off-by: Henning Rogge <henning.rogge@fkie.fraunhofer.de>
  8. Signed-off-by: Johannes Berg <johannes.berg@intel.com>
  9. ---
  10. --- a/net/mac80211/mesh_pathtbl.c
  11. +++ b/net/mac80211/mesh_pathtbl.c
  12. @@ -835,6 +835,29 @@ void mesh_path_flush_by_nexthop(struct s
  13. rcu_read_unlock();
  14. }
  15. +static void mpp_flush_by_proxy(struct ieee80211_sub_if_data *sdata,
  16. + const u8 *proxy)
  17. +{
  18. + struct mesh_table *tbl;
  19. + struct mesh_path *mpp;
  20. + struct mpath_node *node;
  21. + int i;
  22. +
  23. + rcu_read_lock();
  24. + read_lock_bh(&pathtbl_resize_lock);
  25. + tbl = resize_dereference_mpp_paths();
  26. + for_each_mesh_entry(tbl, node, i) {
  27. + mpp = node->mpath;
  28. + if (ether_addr_equal(mpp->mpp, proxy)) {
  29. + spin_lock(&tbl->hashwlock[i]);
  30. + __mesh_path_del(tbl, node);
  31. + spin_unlock(&tbl->hashwlock[i]);
  32. + }
  33. + }
  34. + read_unlock_bh(&pathtbl_resize_lock);
  35. + rcu_read_unlock();
  36. +}
  37. +
  38. static void table_flush_by_iface(struct mesh_table *tbl,
  39. struct ieee80211_sub_if_data *sdata)
  40. {
  41. @@ -892,6 +915,9 @@ int mesh_path_del(struct ieee80211_sub_i
  42. int hash_idx;
  43. int err = 0;
  44. + /* flush relevant mpp entries first */
  45. + mpp_flush_by_proxy(sdata, addr);
  46. +
  47. read_lock_bh(&pathtbl_resize_lock);
  48. tbl = resize_dereference_mesh_paths();
  49. hash_idx = mesh_table_hash(addr, sdata, tbl);