浏览代码

mac80211: fix the support of setting non-forwarding entity in Mesh

RANN, PREP and PERR propagation should happen only if the
dot11MeshForwarding is true.  Besides, data frame should not be
forwarded if dot11MeshForwarding is false. This redundant checking
is necessary to avoid the broadcasted ARP breaking the non-forwarding
rule.

Signed-off-by: Chun-Yeow Yeoh <yeohchunyeow@gmail.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
Chun-Yeow Yeoh 13 年之前
父节点
当前提交
d665508b98
共有 2 个文件被更改,包括 11 次插入1 次删除
  1. 8 1
      net/mac80211/mesh_hwmp.c
  2. 3 0
      net/mac80211/rx.c

+ 8 - 1
net/mac80211/mesh_hwmp.c

@@ -619,6 +619,7 @@ static void hwmp_prep_frame_process(struct ieee80211_sub_if_data *sdata,
 				    struct ieee80211_mgmt *mgmt,
 				    struct ieee80211_mgmt *mgmt,
 				    u8 *prep_elem, u32 metric)
 				    u8 *prep_elem, u32 metric)
 {
 {
+	struct ieee80211_if_mesh *ifmsh = &sdata->u.mesh;
 	struct mesh_path *mpath;
 	struct mesh_path *mpath;
 	u8 *target_addr, *orig_addr;
 	u8 *target_addr, *orig_addr;
 	u8 ttl, hopcount, flags;
 	u8 ttl, hopcount, flags;
@@ -632,6 +633,9 @@ static void hwmp_prep_frame_process(struct ieee80211_sub_if_data *sdata,
 		/* destination, no forwarding required */
 		/* destination, no forwarding required */
 		return;
 		return;
 
 
+	if (!ifmsh->mshcfg.dot11MeshForwarding)
+		return;
+
 	ttl = PREP_IE_TTL(prep_elem);
 	ttl = PREP_IE_TTL(prep_elem);
 	if (ttl <= 1) {
 	if (ttl <= 1) {
 		sdata->u.mesh.mshstats.dropped_frames_ttl++;
 		sdata->u.mesh.mshstats.dropped_frames_ttl++;
@@ -709,12 +713,15 @@ static void hwmp_perr_frame_process(struct ieee80211_sub_if_data *sdata,
 			mpath->flags &= ~MESH_PATH_ACTIVE;
 			mpath->flags &= ~MESH_PATH_ACTIVE;
 			mpath->sn = target_sn;
 			mpath->sn = target_sn;
 			spin_unlock_bh(&mpath->state_lock);
 			spin_unlock_bh(&mpath->state_lock);
+			if (!ifmsh->mshcfg.dot11MeshForwarding)
+				goto endperr;
 			mesh_path_error_tx(ttl, target_addr, cpu_to_le32(target_sn),
 			mesh_path_error_tx(ttl, target_addr, cpu_to_le32(target_sn),
 					   cpu_to_le16(target_rcode),
 					   cpu_to_le16(target_rcode),
 					   broadcast_addr, sdata);
 					   broadcast_addr, sdata);
 		} else
 		} else
 			spin_unlock_bh(&mpath->state_lock);
 			spin_unlock_bh(&mpath->state_lock);
 	}
 	}
+endperr:
 	rcu_read_unlock();
 	rcu_read_unlock();
 }
 }
 
 
@@ -771,7 +778,7 @@ static void hwmp_rann_frame_process(struct ieee80211_sub_if_data *sdata,
 		mesh_queue_preq(mpath, PREQ_Q_F_START | PREQ_Q_F_REFRESH);
 		mesh_queue_preq(mpath, PREQ_Q_F_START | PREQ_Q_F_REFRESH);
 	}
 	}
 
 
-	if (mpath->sn < orig_sn) {
+	if (mpath->sn < orig_sn && ifmsh->mshcfg.dot11MeshForwarding) {
 		mesh_path_sel_frame_tx(MPATH_RANN, flags, orig_addr,
 		mesh_path_sel_frame_tx(MPATH_RANN, flags, orig_addr,
 				       cpu_to_le32(orig_sn),
 				       cpu_to_le32(orig_sn),
 				       0, NULL, 0, broadcast_addr,
 				       0, NULL, 0, broadcast_addr,

+ 3 - 0
net/mac80211/rx.c

@@ -1960,6 +1960,9 @@ ieee80211_rx_h_mesh_fwding(struct ieee80211_rx_data *rx)
 		return RX_DROP_MONITOR;
 		return RX_DROP_MONITOR;
 	}
 	}
 
 
+	if (!ifmsh->mshcfg.dot11MeshForwarding)
+		goto out;
+
 	fwd_skb = skb_copy(skb, GFP_ATOMIC);
 	fwd_skb = skb_copy(skb, GFP_ATOMIC);
 	if (!fwd_skb) {
 	if (!fwd_skb) {
 		if (net_ratelimit())
 		if (net_ratelimit())