aboutsummaryrefslogtreecommitdiffstats
path: root/net/mac80211/mesh_hwmp.c
diff options
context:
space:
mode:
Diffstat (limited to 'net/mac80211/mesh_hwmp.c')
-rw-r--r--net/mac80211/mesh_hwmp.c24
1 files changed, 13 insertions, 11 deletions
diff --git a/net/mac80211/mesh_hwmp.c b/net/mac80211/mesh_hwmp.c
index 5c67e7b8790f..9aecf0207afc 100644
--- a/net/mac80211/mesh_hwmp.c
+++ b/net/mac80211/mesh_hwmp.c
@@ -101,10 +101,12 @@ enum mpath_frame_type {
101 MPATH_RANN 101 MPATH_RANN
102}; 102};
103 103
104static const u8 broadcast_addr[ETH_ALEN] = {0xff, 0xff, 0xff, 0xff, 0xff, 0xff};
105
104static int mesh_path_sel_frame_tx(enum mpath_frame_type action, u8 flags, 106static int mesh_path_sel_frame_tx(enum mpath_frame_type action, u8 flags,
105 u8 *orig_addr, __le32 orig_sn, u8 target_flags, u8 *target, 107 u8 *orig_addr, __le32 orig_sn, u8 target_flags, u8 *target,
106 __le32 target_sn, u8 *da, u8 hop_count, u8 ttl,__le32 lifetime, 108 __le32 target_sn, const u8 *da, u8 hop_count, u8 ttl,
107 __le32 metric, __le32 preq_id, 109 __le32 lifetime, __le32 metric, __le32 preq_id,
108 struct ieee80211_sub_if_data *sdata) 110 struct ieee80211_sub_if_data *sdata)
109{ 111{
110 struct ieee80211_local *local = sdata->local; 112 struct ieee80211_local *local = sdata->local;
@@ -185,7 +187,7 @@ static int mesh_path_sel_frame_tx(enum mpath_frame_type action, u8 flags,
185 memcpy(pos, &target_sn, 4); 187 memcpy(pos, &target_sn, 4);
186 } 188 }
187 189
188 ieee80211_tx_skb(sdata, skb, 1); 190 ieee80211_tx_skb(sdata, skb);
189 return 0; 191 return 0;
190} 192}
191 193
@@ -198,8 +200,8 @@ static int mesh_path_sel_frame_tx(enum mpath_frame_type action, u8 flags,
198 * @ra: node this frame is addressed to 200 * @ra: node this frame is addressed to
199 */ 201 */
200int mesh_path_error_tx(u8 ttl, u8 *target, __le32 target_sn, 202int mesh_path_error_tx(u8 ttl, u8 *target, __le32 target_sn,
201 __le16 target_rcode, u8 *ra, 203 __le16 target_rcode, const u8 *ra,
202 struct ieee80211_sub_if_data *sdata) 204 struct ieee80211_sub_if_data *sdata)
203{ 205{
204 struct ieee80211_local *local = sdata->local; 206 struct ieee80211_local *local = sdata->local;
205 struct sk_buff *skb = dev_alloc_skb(local->hw.extra_tx_headroom + 400); 207 struct sk_buff *skb = dev_alloc_skb(local->hw.extra_tx_headroom + 400);
@@ -248,7 +250,7 @@ int mesh_path_error_tx(u8 ttl, u8 *target, __le32 target_sn,
248 pos += 4; 250 pos += 4;
249 memcpy(pos, &target_rcode, 2); 251 memcpy(pos, &target_rcode, 2);
250 252
251 ieee80211_tx_skb(sdata, skb, 1); 253 ieee80211_tx_skb(sdata, skb);
252 return 0; 254 return 0;
253} 255}
254 256
@@ -548,7 +550,7 @@ static void hwmp_preq_frame_process(struct ieee80211_sub_if_data *sdata,
548 hopcount = PREQ_IE_HOPCOUNT(preq_elem) + 1; 550 hopcount = PREQ_IE_HOPCOUNT(preq_elem) + 1;
549 mesh_path_sel_frame_tx(MPATH_PREQ, flags, orig_addr, 551 mesh_path_sel_frame_tx(MPATH_PREQ, flags, orig_addr,
550 cpu_to_le32(orig_sn), target_flags, target_addr, 552 cpu_to_le32(orig_sn), target_flags, target_addr,
551 cpu_to_le32(target_sn), sdata->dev->broadcast, 553 cpu_to_le32(target_sn), broadcast_addr,
552 hopcount, ttl, cpu_to_le32(lifetime), 554 hopcount, ttl, cpu_to_le32(lifetime),
553 cpu_to_le32(metric), cpu_to_le32(preq_id), 555 cpu_to_le32(metric), cpu_to_le32(preq_id),
554 sdata); 556 sdata);
@@ -660,7 +662,7 @@ static void hwmp_perr_frame_process(struct ieee80211_sub_if_data *sdata,
660 spin_unlock_bh(&mpath->state_lock); 662 spin_unlock_bh(&mpath->state_lock);
661 mesh_path_error_tx(ttl, target_addr, cpu_to_le32(target_sn), 663 mesh_path_error_tx(ttl, target_addr, cpu_to_le32(target_sn),
662 cpu_to_le16(target_rcode), 664 cpu_to_le16(target_rcode),
663 sdata->dev->broadcast, sdata); 665 broadcast_addr, sdata);
664 } else 666 } else
665 spin_unlock_bh(&mpath->state_lock); 667 spin_unlock_bh(&mpath->state_lock);
666 } 668 }
@@ -709,7 +711,7 @@ static void hwmp_rann_frame_process(struct ieee80211_sub_if_data *sdata,
709 if (mpath->sn < orig_sn) { 711 if (mpath->sn < orig_sn) {
710 mesh_path_sel_frame_tx(MPATH_RANN, flags, orig_addr, 712 mesh_path_sel_frame_tx(MPATH_RANN, flags, orig_addr,
711 cpu_to_le32(orig_sn), 713 cpu_to_le32(orig_sn),
712 0, NULL, 0, sdata->dev->broadcast, 714 0, NULL, 0, broadcast_addr,
713 hopcount, ttl, 0, 715 hopcount, ttl, 0,
714 cpu_to_le32(metric + mpath->metric), 716 cpu_to_le32(metric + mpath->metric),
715 0, sdata); 717 0, sdata);
@@ -890,7 +892,7 @@ void mesh_path_start_discovery(struct ieee80211_sub_if_data *sdata)
890 spin_unlock_bh(&mpath->state_lock); 892 spin_unlock_bh(&mpath->state_lock);
891 mesh_path_sel_frame_tx(MPATH_PREQ, 0, sdata->dev->dev_addr, 893 mesh_path_sel_frame_tx(MPATH_PREQ, 0, sdata->dev->dev_addr,
892 cpu_to_le32(ifmsh->sn), target_flags, mpath->dst, 894 cpu_to_le32(ifmsh->sn), target_flags, mpath->dst,
893 cpu_to_le32(mpath->sn), sdata->dev->broadcast, 0, 895 cpu_to_le32(mpath->sn), broadcast_addr, 0,
894 ttl, cpu_to_le32(lifetime), 0, 896 ttl, cpu_to_le32(lifetime), 0,
895 cpu_to_le32(ifmsh->preq_id++), sdata); 897 cpu_to_le32(ifmsh->preq_id++), sdata);
896 mod_timer(&mpath->timer, jiffies + mpath->discovery_timeout); 898 mod_timer(&mpath->timer, jiffies + mpath->discovery_timeout);
@@ -1011,6 +1013,6 @@ mesh_path_tx_root_frame(struct ieee80211_sub_if_data *sdata)
1011 1013
1012 mesh_path_sel_frame_tx(MPATH_RANN, 0, sdata->dev->dev_addr, 1014 mesh_path_sel_frame_tx(MPATH_RANN, 0, sdata->dev->dev_addr,
1013 cpu_to_le32(++ifmsh->sn), 1015 cpu_to_le32(++ifmsh->sn),
1014 0, NULL, 0, sdata->dev->broadcast, 1016 0, NULL, 0, broadcast_addr,
1015 0, MESH_TTL, 0, 0, 0, sdata); 1017 0, MESH_TTL, 0, 0, 0, sdata);
1016} 1018}