mac80211: Assign next hop address to pending mesh frames
authorJavier Cardona <javier@cozybit.com>
Thu, 9 Jul 2009 21:42:16 +0000 (14:42 -0700)
committerJohn W. Linville <linville@tuxdriver.com>
Fri, 24 Jul 2009 19:05:07 +0000 (15:05 -0400)
Assign next hop address to pending mesh frames once the path is resolved.

Regression.  Frames transmitted when a mesh path was wating to be resolved were
being transmitted with an invalid Receiver Address.

[Changes since v1]

Suggested by Johannes:
 - Improved frame_queue traversal
 - Narower RCU scope

Signed-off-by: Javier Cardona <javier@cozybit.com>
Signed-off-by: Andrey Yurovsky <andrey@cozybit.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
net/mac80211/mesh_pathtbl.c

index 479597e885832d539f4774e157e48deff8d22da2..f0304bfdcdffdec8bff5d1e90e9e1d38328e5e1d 100644 (file)
@@ -55,7 +55,25 @@ static DEFINE_RWLOCK(pathtbl_resize_lock);
  */
 void mesh_path_assign_nexthop(struct mesh_path *mpath, struct sta_info *sta)
 {
+       struct sk_buff *skb;
+       struct ieee80211_hdr *hdr;
+       struct sk_buff_head tmpq;
+       unsigned long flags;
+
        rcu_assign_pointer(mpath->next_hop, sta);
+
+       __skb_queue_head_init(&tmpq);
+
+       spin_lock_irqsave(&mpath->frame_queue.lock, flags);
+
+       while ((skb = __skb_dequeue(&mpath->frame_queue)) != NULL) {
+               hdr = (struct ieee80211_hdr *) skb->data;
+               memcpy(hdr->addr1, sta->sta.addr, ETH_ALEN);
+               __skb_queue_tail(&tmpq, skb);
+       }
+
+       skb_queue_splice(&tmpq, &mpath->frame_queue);
+       spin_unlock_irqrestore(&mpath->frame_queue.lock, flags);
 }