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(-)

62cefb2dabe7ea740481200408a07a797b7281ab
diff --git a/net/d80211/ieee80211.c b/net/d80211/ieee80211.c
index 7ceef10..18d910d 100644
--- a/net/d80211/ieee80211.c
+++ b/net/d80211/ieee80211.c
@@ -3346,6 +3346,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;
 }
 
@@ -3537,6 +3543,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;
@@ -3579,11 +3588,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 ||
diff --git a/net/d80211/ieee80211_i.h b/net/d80211/ieee80211_i.h
index 0409c52..9e1fff2 100644
--- a/net/d80211/ieee80211_i.h
+++ b/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
-- 
1.3.0

-
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