diff options
author | Thomas Pedersen <thomas@cozybit.com> | 2011-11-24 20:15:21 -0500 |
---|---|---|
committer | John W. Linville <linville@tuxdriver.com> | 2011-11-28 14:44:03 -0500 |
commit | 7e3c88660b5b90f437cf466b1805089ccb764ee3 (patch) | |
tree | 7b624ef198521b908750da24b0577175e2c71235 /net | |
parent | 4bb62344e4703414fd253ceb07c163ac37da80d4 (diff) |
mac80211: failed forwarded mesh frame addressing
Don't write the TA until next hop is actually known, since we might need
the original TA for sending a PERR. Previously we would send a PERR to
ourself if path resolution for a forwarded frame failed.
Signed-off-by: Thomas Pedersen <thomas@cozybit.com>
Signed-off-by: Javier Cardona <javier@cozybit.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'net')
-rw-r--r-- | net/mac80211/mesh_hwmp.c | 5 | ||||
-rw-r--r-- | net/mac80211/mesh_pathtbl.c | 6 | ||||
-rw-r--r-- | net/mac80211/rx.c | 8 |
3 files changed, 8 insertions, 11 deletions
diff --git a/net/mac80211/mesh_hwmp.c b/net/mac80211/mesh_hwmp.c index ce3db2735d7c..1b13135d7f35 100644 --- a/net/mac80211/mesh_hwmp.c +++ b/net/mac80211/mesh_hwmp.c | |||
@@ -1029,9 +1029,10 @@ int mesh_nexthop_lookup(struct sk_buff *skb, | |||
1029 | PREQ_Q_F_START | PREQ_Q_F_REFRESH); | 1029 | PREQ_Q_F_START | PREQ_Q_F_REFRESH); |
1030 | } | 1030 | } |
1031 | next_hop = rcu_dereference(mpath->next_hop); | 1031 | next_hop = rcu_dereference(mpath->next_hop); |
1032 | if (next_hop) | 1032 | if (next_hop) { |
1033 | memcpy(hdr->addr1, next_hop->sta.addr, ETH_ALEN); | 1033 | memcpy(hdr->addr1, next_hop->sta.addr, ETH_ALEN); |
1034 | else | 1034 | memcpy(hdr->addr2, sdata->vif.addr, ETH_ALEN); |
1035 | } else | ||
1035 | err = -ENOENT; | 1036 | err = -ENOENT; |
1036 | } else { | 1037 | } else { |
1037 | struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb); | 1038 | struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb); |
diff --git a/net/mac80211/mesh_pathtbl.c b/net/mac80211/mesh_pathtbl.c index 7bd2a76aef0e..4c50d8ade04f 100644 --- a/net/mac80211/mesh_pathtbl.c +++ b/net/mac80211/mesh_pathtbl.c | |||
@@ -221,6 +221,7 @@ void mesh_path_assign_nexthop(struct mesh_path *mpath, struct sta_info *sta) | |||
221 | while ((skb = __skb_dequeue(&mpath->frame_queue)) != NULL) { | 221 | while ((skb = __skb_dequeue(&mpath->frame_queue)) != NULL) { |
222 | hdr = (struct ieee80211_hdr *) skb->data; | 222 | hdr = (struct ieee80211_hdr *) skb->data; |
223 | memcpy(hdr->addr1, sta->sta.addr, ETH_ALEN); | 223 | memcpy(hdr->addr1, sta->sta.addr, ETH_ALEN); |
224 | memcpy(hdr->addr2, mpath->sdata->vif.addr, ETH_ALEN); | ||
224 | __skb_queue_tail(&tmpq, skb); | 225 | __skb_queue_tail(&tmpq, skb); |
225 | } | 226 | } |
226 | 227 | ||
@@ -264,6 +265,7 @@ static void prepare_for_gate(struct sk_buff *skb, char *dst_addr, | |||
264 | next_hop = rcu_dereference(gate_mpath->next_hop)->sta.addr; | 265 | next_hop = rcu_dereference(gate_mpath->next_hop)->sta.addr; |
265 | memcpy(hdr->addr1, next_hop, ETH_ALEN); | 266 | memcpy(hdr->addr1, next_hop, ETH_ALEN); |
266 | rcu_read_unlock(); | 267 | rcu_read_unlock(); |
268 | memcpy(hdr->addr2, gate_mpath->sdata->vif.addr, ETH_ALEN); | ||
267 | memcpy(hdr->addr3, dst_addr, ETH_ALEN); | 269 | memcpy(hdr->addr3, dst_addr, ETH_ALEN); |
268 | } | 270 | } |
269 | 271 | ||
@@ -990,7 +992,7 @@ void mesh_path_discard_frame(struct sk_buff *skb, | |||
990 | u8 *ra, *da; | 992 | u8 *ra, *da; |
991 | 993 | ||
992 | da = hdr->addr3; | 994 | da = hdr->addr3; |
993 | ra = hdr->addr1; | 995 | ra = hdr->addr2; |
994 | rcu_read_lock(); | 996 | rcu_read_lock(); |
995 | mpath = mesh_path_lookup(da, sdata); | 997 | mpath = mesh_path_lookup(da, sdata); |
996 | if (mpath) { | 998 | if (mpath) { |
@@ -999,7 +1001,7 @@ void mesh_path_discard_frame(struct sk_buff *skb, | |||
999 | spin_unlock_bh(&mpath->state_lock); | 1001 | spin_unlock_bh(&mpath->state_lock); |
1000 | } | 1002 | } |
1001 | rcu_read_unlock(); | 1003 | rcu_read_unlock(); |
1002 | mesh_path_error_tx(sdata->u.mesh.mshcfg.element_ttl, skb->data, | 1004 | mesh_path_error_tx(sdata->u.mesh.mshcfg.element_ttl, da, |
1003 | cpu_to_le32(sn), reason, ra, sdata); | 1005 | cpu_to_le32(sn), reason, ra, sdata); |
1004 | } | 1006 | } |
1005 | 1007 | ||
diff --git a/net/mac80211/rx.c b/net/mac80211/rx.c index 4eafbfd891d5..60798d6d53cf 100644 --- a/net/mac80211/rx.c +++ b/net/mac80211/rx.c | |||
@@ -1974,7 +1974,6 @@ ieee80211_rx_h_mesh_fwding(struct ieee80211_rx_data *rx) | |||
1974 | goto out; | 1974 | goto out; |
1975 | 1975 | ||
1976 | fwd_hdr = (struct ieee80211_hdr *) fwd_skb->data; | 1976 | fwd_hdr = (struct ieee80211_hdr *) fwd_skb->data; |
1977 | memcpy(fwd_hdr->addr2, sdata->vif.addr, ETH_ALEN); | ||
1978 | info = IEEE80211_SKB_CB(fwd_skb); | 1977 | info = IEEE80211_SKB_CB(fwd_skb); |
1979 | memset(info, 0, sizeof(*info)); | 1978 | memset(info, 0, sizeof(*info)); |
1980 | info->flags |= IEEE80211_TX_INTFL_NEED_TXPROCESSING; | 1979 | info->flags |= IEEE80211_TX_INTFL_NEED_TXPROCESSING; |
@@ -1983,14 +1982,9 @@ ieee80211_rx_h_mesh_fwding(struct ieee80211_rx_data *rx) | |||
1983 | if (is_multicast_ether_addr(fwd_hdr->addr1)) { | 1982 | if (is_multicast_ether_addr(fwd_hdr->addr1)) { |
1984 | IEEE80211_IFSTA_MESH_CTR_INC(&sdata->u.mesh, | 1983 | IEEE80211_IFSTA_MESH_CTR_INC(&sdata->u.mesh, |
1985 | fwded_mcast); | 1984 | fwded_mcast); |
1985 | memcpy(fwd_hdr->addr2, sdata->vif.addr, ETH_ALEN); | ||
1986 | } else { | 1986 | } else { |
1987 | int err; | 1987 | int err; |
1988 | /* | ||
1989 | * Save TA to addr1 to send TA a path error if a | ||
1990 | * suitable next hop is not found | ||
1991 | */ | ||
1992 | memcpy(fwd_hdr->addr1, fwd_hdr->addr2, | ||
1993 | ETH_ALEN); | ||
1994 | err = mesh_nexthop_lookup(fwd_skb, sdata); | 1988 | err = mesh_nexthop_lookup(fwd_skb, sdata); |
1995 | /* Failed to immediately resolve next hop: | 1989 | /* Failed to immediately resolve next hop: |
1996 | * fwded frame was dropped or will be added | 1990 | * fwded frame was dropped or will be added |