aboutsummaryrefslogtreecommitdiffstats
path: root/net/mac80211/mesh_hwmp.c
diff options
context:
space:
mode:
authorChun-Yeow Yeoh <yeohchunyeow@gmail.com>2012-02-28 09:00:06 -0500
committerJohn W. Linville <linville@tuxdriver.com>2012-03-05 15:23:14 -0500
commit3d045a54488b69b0024309b18da5024c036c3152 (patch)
tree1841e677d70cb64df237c7e78c585ad15142f61c /net/mac80211/mesh_hwmp.c
parentbe0b281e8f7afd56d2250a568b85dafc850bc9ae (diff)
mac80211: Fix the generation of PREQs in proactive RANN mechanism of HWMP
According to Section Y.7.4 Actions on receipt of proactive RANN, an individually addressed PREQ should be generated towards the neighbor peer mesh STA indicated in the RANN Sender Address field in the forwarding information. Signed-off-by: Chun-Yeow Yeoh <yeohchunyeow@gmail.com> Signed-off-by: Javier Cardona <javier@cozybit.com> Signed-off-by: Thomas Pedersen <thomas@cozybit.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'net/mac80211/mesh_hwmp.c')
-rw-r--r--net/mac80211/mesh_hwmp.c20
1 files changed, 15 insertions, 5 deletions
diff --git a/net/mac80211/mesh_hwmp.c b/net/mac80211/mesh_hwmp.c
index 31bc762f209d..639db14f43d2 100644
--- a/net/mac80211/mesh_hwmp.c
+++ b/net/mac80211/mesh_hwmp.c
@@ -513,8 +513,9 @@ static void hwmp_preq_frame_process(struct ieee80211_sub_if_data *sdata,
513 u8 *preq_elem, u32 metric) 513 u8 *preq_elem, u32 metric)
514{ 514{
515 struct ieee80211_if_mesh *ifmsh = &sdata->u.mesh; 515 struct ieee80211_if_mesh *ifmsh = &sdata->u.mesh;
516 struct mesh_path *mpath; 516 struct mesh_path *mpath = NULL;
517 u8 *target_addr, *orig_addr; 517 u8 *target_addr, *orig_addr;
518 const u8 *da;
518 u8 target_flags, ttl; 519 u8 target_flags, ttl;
519 u32 orig_sn, target_sn, lifetime; 520 u32 orig_sn, target_sn, lifetime;
520 bool reply = false; 521 bool reply = false;
@@ -591,9 +592,11 @@ static void hwmp_preq_frame_process(struct ieee80211_sub_if_data *sdata,
591 flags = PREQ_IE_FLAGS(preq_elem); 592 flags = PREQ_IE_FLAGS(preq_elem);
592 preq_id = PREQ_IE_PREQ_ID(preq_elem); 593 preq_id = PREQ_IE_PREQ_ID(preq_elem);
593 hopcount = PREQ_IE_HOPCOUNT(preq_elem) + 1; 594 hopcount = PREQ_IE_HOPCOUNT(preq_elem) + 1;
595 da = (mpath && mpath->is_root) ?
596 mpath->rann_snd_addr : broadcast_addr;
594 mesh_path_sel_frame_tx(MPATH_PREQ, flags, orig_addr, 597 mesh_path_sel_frame_tx(MPATH_PREQ, flags, orig_addr,
595 cpu_to_le32(orig_sn), target_flags, target_addr, 598 cpu_to_le32(orig_sn), target_flags, target_addr,
596 cpu_to_le32(target_sn), broadcast_addr, 599 cpu_to_le32(target_sn), da,
597 hopcount, ttl, cpu_to_le32(lifetime), 600 hopcount, ttl, cpu_to_le32(lifetime),
598 cpu_to_le32(metric), cpu_to_le32(preq_id), 601 cpu_to_le32(metric), cpu_to_le32(preq_id),
599 sdata); 602 sdata);
@@ -742,8 +745,8 @@ static void hwmp_rann_frame_process(struct ieee80211_sub_if_data *sdata,
742 if (memcmp(orig_addr, sdata->vif.addr, ETH_ALEN) == 0) 745 if (memcmp(orig_addr, sdata->vif.addr, ETH_ALEN) == 0)
743 return; 746 return;
744 747
745 mhwmp_dbg("received RANN from %pM (is_gate=%d)", orig_addr, 748 mhwmp_dbg("received RANN from %pM via neighbour %pM (is_gate=%d)",
746 root_is_gate); 749 orig_addr, mgmt->sa, root_is_gate);
747 750
748 rcu_read_lock(); 751 rcu_read_lock();
749 mpath = mesh_path_lookup(orig_addr, sdata); 752 mpath = mesh_path_lookup(orig_addr, sdata);
@@ -774,6 +777,11 @@ static void hwmp_rann_frame_process(struct ieee80211_sub_if_data *sdata,
774 0, sdata); 777 0, sdata);
775 mpath->sn = orig_sn; 778 mpath->sn = orig_sn;
776 } 779 }
780
781 /* Using individually addressed PREQ for root node */
782 memcpy(mpath->rann_snd_addr, mgmt->sa, ETH_ALEN);
783 mpath->is_root = true;
784
777 if (root_is_gate) 785 if (root_is_gate)
778 mesh_path_add_gate(mpath); 786 mesh_path_add_gate(mpath);
779 787
@@ -909,6 +917,7 @@ void mesh_path_start_discovery(struct ieee80211_sub_if_data *sdata)
909 struct mesh_preq_queue *preq_node; 917 struct mesh_preq_queue *preq_node;
910 struct mesh_path *mpath; 918 struct mesh_path *mpath;
911 u8 ttl, target_flags; 919 u8 ttl, target_flags;
920 const u8 *da;
912 u32 lifetime; 921 u32 lifetime;
913 922
914 spin_lock_bh(&ifmsh->mesh_preq_queue_lock); 923 spin_lock_bh(&ifmsh->mesh_preq_queue_lock);
@@ -971,9 +980,10 @@ void mesh_path_start_discovery(struct ieee80211_sub_if_data *sdata)
971 target_flags = MP_F_RF; 980 target_flags = MP_F_RF;
972 981
973 spin_unlock_bh(&mpath->state_lock); 982 spin_unlock_bh(&mpath->state_lock);
983 da = (mpath->is_root) ? mpath->rann_snd_addr : broadcast_addr;
974 mesh_path_sel_frame_tx(MPATH_PREQ, 0, sdata->vif.addr, 984 mesh_path_sel_frame_tx(MPATH_PREQ, 0, sdata->vif.addr,
975 cpu_to_le32(ifmsh->sn), target_flags, mpath->dst, 985 cpu_to_le32(ifmsh->sn), target_flags, mpath->dst,
976 cpu_to_le32(mpath->sn), broadcast_addr, 0, 986 cpu_to_le32(mpath->sn), da, 0,
977 ttl, cpu_to_le32(lifetime), 0, 987 ttl, cpu_to_le32(lifetime), 0,
978 cpu_to_le32(ifmsh->preq_id++), sdata); 988 cpu_to_le32(ifmsh->preq_id++), sdata);
979 mod_timer(&mpath->timer, jiffies + mpath->discovery_timeout); 989 mod_timer(&mpath->timer, jiffies + mpath->discovery_timeout);