This is a corrected version of the patch. I also updated the 'devel' branch
of my tree.

---

Arrived packets should not go into master interface except when scanning
- it leads to duplicate packets reception. This also fixes a race when
scanning is finished during invoking of rx handlers.

Signed-off-by: Jiri Benc <[EMAIL PROTECTED]>

---
 net/d80211/ieee80211.c   |   17 +++++++++++++++--
 net/d80211/ieee80211_i.h |    1 +
 2 files changed, 16 insertions(+), 2 deletions(-)

--- dscape.orig/net/d80211/ieee80211.c
+++ dscape/net/d80211/ieee80211.c
@@ -3348,6 +3348,12 @@ ieee80211_rx_h_passive_scan(struct ieee8
                 }
         }
 
+       if (unlikely(rx->u.rx.in_scan)) {
+               /* scanning finished during invoking of handlers */
+               I802_DEBUG_INC(local->rx_handlers_drop_passive_scan);
+               return TXRX_DROP;
+       }
+
         return TXRX_CONTINUE;
 }
 
@@ -3539,6 +3545,9 @@ void __ieee80211_rx(struct net_device *d
                goto end;
         }
 
+       if (unlikely(local->sta_scanning || local->scan.in_scan))
+               rx.u.rx.in_scan = 1;
+
        if (sta && !sta->assoc_ap && !(sta->flags & WLAN_STA_WDS) &&
            !local->iff_promiscs && !multicast) {
                rx.dev = sta->dev;
@@ -3581,11 +3590,15 @@ void __ieee80211_rx(struct net_device *d
                                        if (memcmp(sdata->dev->dev_addr,
                                                   hdr->addr1, ETH_ALEN) != 0)
                                                continue;
-                               } else if (!local->sta_scanning &&
-                                          !local->scan.in_scan &&
+                               } else if (!rx.u.rx.in_scan &&
                                           !ieee80211_bssid_match(bssid,
                                                        sdata->dev->dev_addr))
                                        continue;
+                               if (sdata->dev == sdata->master &&
+                                   !rx.u.rx.in_scan)
+                                       /* do not receive anything via
+                                        * master device when not scanning */
+                                       continue;
                                break;
                        case IEEE80211_IF_TYPE_WDS:
                                if (bssid ||
--- dscape.orig/net/d80211/ieee80211_i.h
+++ dscape/net/d80211/ieee80211_i.h
@@ -137,6 +137,7 @@ struct ieee80211_txrx_data {
                        struct ieee80211_rx_status *status;
                        int sent_ps_buffered;
                        int queue;
+                       int in_scan:1;
                } rx;
        } u;
 #ifdef CONFIG_HOSTAPD_WPA_TESTING
-
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to