aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChun-Yeow Yeoh <yeohchunyeow@gmail.com>2017-11-14 10:20:05 -0500
committerJohannes Berg <johannes.berg@intel.com>2017-11-27 05:24:26 -0500
commitfbbdad5edf0bb59786a51b94a9d006bc8c2da9a2 (patch)
tree9d77930d7af81e4d47e73bd5269186fb859f9a92
parent7b6ddeaf27eca72795ceeae2f0f347db1b5f9a30 (diff)
mac80211: fix the update of path metric for RANN frame
The previous path metric update from RANN frame has not considered the own link metric toward the transmitting mesh STA. Fix this. Reported-by: Michael65535 Signed-off-by: Chun-Yeow Yeoh <yeohchunyeow@gmail.com> Signed-off-by: Johannes Berg <johannes.berg@intel.com>
-rw-r--r--net/mac80211/mesh_hwmp.c15
1 files changed, 9 insertions, 6 deletions
diff --git a/net/mac80211/mesh_hwmp.c b/net/mac80211/mesh_hwmp.c
index 4f7826d7b47c..4394463a0c2e 100644
--- a/net/mac80211/mesh_hwmp.c
+++ b/net/mac80211/mesh_hwmp.c
@@ -797,7 +797,7 @@ static void hwmp_rann_frame_process(struct ieee80211_sub_if_data *sdata,
797 struct mesh_path *mpath; 797 struct mesh_path *mpath;
798 u8 ttl, flags, hopcount; 798 u8 ttl, flags, hopcount;
799 const u8 *orig_addr; 799 const u8 *orig_addr;
800 u32 orig_sn, metric, metric_txsta, interval; 800 u32 orig_sn, new_metric, orig_metric, last_hop_metric, interval;
801 bool root_is_gate; 801 bool root_is_gate;
802 802
803 ttl = rann->rann_ttl; 803 ttl = rann->rann_ttl;
@@ -808,7 +808,7 @@ static void hwmp_rann_frame_process(struct ieee80211_sub_if_data *sdata,
808 interval = le32_to_cpu(rann->rann_interval); 808 interval = le32_to_cpu(rann->rann_interval);
809 hopcount = rann->rann_hopcount; 809 hopcount = rann->rann_hopcount;
810 hopcount++; 810 hopcount++;
811 metric = le32_to_cpu(rann->rann_metric); 811 orig_metric = le32_to_cpu(rann->rann_metric);
812 812
813 /* Ignore our own RANNs */ 813 /* Ignore our own RANNs */
814 if (ether_addr_equal(orig_addr, sdata->vif.addr)) 814 if (ether_addr_equal(orig_addr, sdata->vif.addr))
@@ -825,7 +825,10 @@ static void hwmp_rann_frame_process(struct ieee80211_sub_if_data *sdata,
825 return; 825 return;
826 } 826 }
827 827
828 metric_txsta = airtime_link_metric_get(local, sta); 828 last_hop_metric = airtime_link_metric_get(local, sta);
829 new_metric = orig_metric + last_hop_metric;
830 if (new_metric < orig_metric)
831 new_metric = MAX_METRIC;
829 832
830 mpath = mesh_path_lookup(sdata, orig_addr); 833 mpath = mesh_path_lookup(sdata, orig_addr);
831 if (!mpath) { 834 if (!mpath) {
@@ -838,7 +841,7 @@ static void hwmp_rann_frame_process(struct ieee80211_sub_if_data *sdata,
838 } 841 }
839 842
840 if (!(SN_LT(mpath->sn, orig_sn)) && 843 if (!(SN_LT(mpath->sn, orig_sn)) &&
841 !(mpath->sn == orig_sn && metric < mpath->rann_metric)) { 844 !(mpath->sn == orig_sn && new_metric < mpath->rann_metric)) {
842 rcu_read_unlock(); 845 rcu_read_unlock();
843 return; 846 return;
844 } 847 }
@@ -856,7 +859,7 @@ static void hwmp_rann_frame_process(struct ieee80211_sub_if_data *sdata,
856 } 859 }
857 860
858 mpath->sn = orig_sn; 861 mpath->sn = orig_sn;
859 mpath->rann_metric = metric + metric_txsta; 862 mpath->rann_metric = new_metric;
860 mpath->is_root = true; 863 mpath->is_root = true;
861 /* Recording RANNs sender address to send individually 864 /* Recording RANNs sender address to send individually
862 * addressed PREQs destined for root mesh STA */ 865 * addressed PREQs destined for root mesh STA */
@@ -876,7 +879,7 @@ static void hwmp_rann_frame_process(struct ieee80211_sub_if_data *sdata,
876 mesh_path_sel_frame_tx(MPATH_RANN, flags, orig_addr, 879 mesh_path_sel_frame_tx(MPATH_RANN, flags, orig_addr,
877 orig_sn, 0, NULL, 0, broadcast_addr, 880 orig_sn, 0, NULL, 0, broadcast_addr,
878 hopcount, ttl, interval, 881 hopcount, ttl, interval,
879 metric + metric_txsta, 0, sdata); 882 new_metric, 0, sdata);
880 } 883 }
881 884
882 rcu_read_unlock(); 885 rcu_read_unlock();