diff options
author | Chun-Yeow Yeoh <yeohchunyeow@gmail.com> | 2012-03-01 13:03:19 -0500 |
---|---|---|
committer | John W. Linville <linville@tuxdriver.com> | 2012-03-05 15:38:33 -0500 |
commit | d665508b98d3cdbeb476e7d6848a513184a81ed0 (patch) | |
tree | 00032469034dc31c007251d956396bcfbe2103c6 | |
parent | fe8431f89e25de722610ee5beb2892bd019d1fed (diff) |
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>
-rw-r--r-- | net/mac80211/mesh_hwmp.c | 9 | ||||
-rw-r--r-- | net/mac80211/rx.c | 3 |
2 files changed, 11 insertions, 1 deletions
diff --git a/net/mac80211/mesh_hwmp.c b/net/mac80211/mesh_hwmp.c index ae82ea75bc74..4a993f2d1ae1 100644 --- a/net/mac80211/mesh_hwmp.c +++ b/net/mac80211/mesh_hwmp.c | |||
@@ -619,6 +619,7 @@ static void hwmp_prep_frame_process(struct ieee80211_sub_if_data *sdata, | |||
619 | struct ieee80211_mgmt *mgmt, | 619 | struct ieee80211_mgmt *mgmt, |
620 | u8 *prep_elem, u32 metric) | 620 | u8 *prep_elem, u32 metric) |
621 | { | 621 | { |
622 | struct ieee80211_if_mesh *ifmsh = &sdata->u.mesh; | ||
622 | struct mesh_path *mpath; | 623 | struct mesh_path *mpath; |
623 | u8 *target_addr, *orig_addr; | 624 | u8 *target_addr, *orig_addr; |
624 | u8 ttl, hopcount, flags; | 625 | u8 ttl, hopcount, flags; |
@@ -632,6 +633,9 @@ static void hwmp_prep_frame_process(struct ieee80211_sub_if_data *sdata, | |||
632 | /* destination, no forwarding required */ | 633 | /* destination, no forwarding required */ |
633 | return; | 634 | return; |
634 | 635 | ||
636 | if (!ifmsh->mshcfg.dot11MeshForwarding) | ||
637 | return; | ||
638 | |||
635 | ttl = PREP_IE_TTL(prep_elem); | 639 | ttl = PREP_IE_TTL(prep_elem); |
636 | if (ttl <= 1) { | 640 | if (ttl <= 1) { |
637 | sdata->u.mesh.mshstats.dropped_frames_ttl++; | 641 | sdata->u.mesh.mshstats.dropped_frames_ttl++; |
@@ -709,12 +713,15 @@ static void hwmp_perr_frame_process(struct ieee80211_sub_if_data *sdata, | |||
709 | mpath->flags &= ~MESH_PATH_ACTIVE; | 713 | mpath->flags &= ~MESH_PATH_ACTIVE; |
710 | mpath->sn = target_sn; | 714 | mpath->sn = target_sn; |
711 | spin_unlock_bh(&mpath->state_lock); | 715 | spin_unlock_bh(&mpath->state_lock); |
716 | if (!ifmsh->mshcfg.dot11MeshForwarding) | ||
717 | goto endperr; | ||
712 | mesh_path_error_tx(ttl, target_addr, cpu_to_le32(target_sn), | 718 | mesh_path_error_tx(ttl, target_addr, cpu_to_le32(target_sn), |
713 | cpu_to_le16(target_rcode), | 719 | cpu_to_le16(target_rcode), |
714 | broadcast_addr, sdata); | 720 | broadcast_addr, sdata); |
715 | } else | 721 | } else |
716 | spin_unlock_bh(&mpath->state_lock); | 722 | spin_unlock_bh(&mpath->state_lock); |
717 | } | 723 | } |
724 | endperr: | ||
718 | rcu_read_unlock(); | 725 | rcu_read_unlock(); |
719 | } | 726 | } |
720 | 727 | ||
@@ -771,7 +778,7 @@ static void hwmp_rann_frame_process(struct ieee80211_sub_if_data *sdata, | |||
771 | mesh_queue_preq(mpath, PREQ_Q_F_START | PREQ_Q_F_REFRESH); | 778 | mesh_queue_preq(mpath, PREQ_Q_F_START | PREQ_Q_F_REFRESH); |
772 | } | 779 | } |
773 | 780 | ||
774 | if (mpath->sn < orig_sn) { | 781 | if (mpath->sn < orig_sn && ifmsh->mshcfg.dot11MeshForwarding) { |
775 | mesh_path_sel_frame_tx(MPATH_RANN, flags, orig_addr, | 782 | mesh_path_sel_frame_tx(MPATH_RANN, flags, orig_addr, |
776 | cpu_to_le32(orig_sn), | 783 | cpu_to_le32(orig_sn), |
777 | 0, NULL, 0, broadcast_addr, | 784 | 0, NULL, 0, broadcast_addr, |
diff --git a/net/mac80211/rx.c b/net/mac80211/rx.c index f3b515d16f24..c8166adcd600 100644 --- a/net/mac80211/rx.c +++ b/net/mac80211/rx.c | |||
@@ -1960,6 +1960,9 @@ ieee80211_rx_h_mesh_fwding(struct ieee80211_rx_data *rx) | |||
1960 | return RX_DROP_MONITOR; | 1960 | return RX_DROP_MONITOR; |
1961 | } | 1961 | } |
1962 | 1962 | ||
1963 | if (!ifmsh->mshcfg.dot11MeshForwarding) | ||
1964 | goto out; | ||
1965 | |||
1963 | fwd_skb = skb_copy(skb, GFP_ATOMIC); | 1966 | fwd_skb = skb_copy(skb, GFP_ATOMIC); |
1964 | if (!fwd_skb) { | 1967 | if (!fwd_skb) { |
1965 | if (net_ratelimit()) | 1968 | if (net_ratelimit()) |