aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJohannes Berg <johannes.berg@intel.com>2014-06-12 16:24:31 -0400
committerJohannes Berg <johannes.berg@intel.com>2014-11-19 12:46:09 -0500
commita344d6778a98e4c19ac871f369e399e6356edcb3 (patch)
tree57680bfd10fc013c7a996fbea7212be900f089db
parent6ea0a69ca21bbddab5b3979c2190013b0263e749 (diff)
mac80211: allow drivers to support NL80211_SCAN_FLAG_RANDOM_ADDR
Allow drivers to support NL80211_SCAN_FLAG_RANDOM_ADDR with software based scanning and generate a random MAC address for them for every scan request with the flag. Signed-off-by: Johannes Berg <johannes.berg@intel.com>
-rw-r--r--drivers/net/wireless/ath/ath5k/mac80211-ops.c6
-rw-r--r--drivers/net/wireless/ath/ath9k/channel.c2
-rw-r--r--drivers/net/wireless/ath/ath9k/htc_drv_main.c7
-rw-r--r--drivers/net/wireless/ath/ath9k/main.c7
-rw-r--r--drivers/net/wireless/ath/wcn36xx/main.c7
-rw-r--r--drivers/net/wireless/b43/main.c7
-rw-r--r--drivers/net/wireless/brcm80211/brcmsmac/mac80211_if.c7
-rw-r--r--drivers/net/wireless/cw1200/scan.c2
-rw-r--r--drivers/net/wireless/mac80211_hwsim.c9
-rw-r--r--drivers/net/wireless/mwl8k.c7
-rw-r--r--drivers/net/wireless/rt2x00/rt2x00.h7
-rw-r--r--drivers/net/wireless/rt2x00/rt2x00mac.c7
-rw-r--r--drivers/net/wireless/rtlwifi/core.c7
-rw-r--r--drivers/net/wireless/ti/wl1251/main.c2
-rw-r--r--drivers/net/wireless/ti/wlcore/cmd.c2
-rw-r--r--drivers/staging/vt6656/main_usb.c7
-rw-r--r--include/net/mac80211.h15
-rw-r--r--net/mac80211/driver-ops.h15
-rw-r--r--net/mac80211/ieee80211_i.h7
-rw-r--r--net/mac80211/mlme.c8
-rw-r--r--net/mac80211/scan.c48
-rw-r--r--net/mac80211/trace.h31
-rw-r--r--net/mac80211/tx.c9
-rw-r--r--net/mac80211/util.c12
24 files changed, 166 insertions, 72 deletions
diff --git a/drivers/net/wireless/ath/ath5k/mac80211-ops.c b/drivers/net/wireless/ath/ath5k/mac80211-ops.c
index ab2709a43768..19eab2a69ad5 100644
--- a/drivers/net/wireless/ath/ath5k/mac80211-ops.c
+++ b/drivers/net/wireless/ath/ath5k/mac80211-ops.c
@@ -547,7 +547,9 @@ ath5k_set_key(struct ieee80211_hw *hw, enum set_key_cmd cmd,
547 547
548 548
549static void 549static void
550ath5k_sw_scan_start(struct ieee80211_hw *hw) 550ath5k_sw_scan_start(struct ieee80211_hw *hw,
551 struct ieee80211_vif *vif,
552 const u8 *mac_addr)
551{ 553{
552 struct ath5k_hw *ah = hw->priv; 554 struct ath5k_hw *ah = hw->priv;
553 if (!ah->assoc) 555 if (!ah->assoc)
@@ -556,7 +558,7 @@ ath5k_sw_scan_start(struct ieee80211_hw *hw)
556 558
557 559
558static void 560static void
559ath5k_sw_scan_complete(struct ieee80211_hw *hw) 561ath5k_sw_scan_complete(struct ieee80211_hw *hw, struct ieee80211_vif *vif)
560{ 562{
561 struct ath5k_hw *ah = hw->priv; 563 struct ath5k_hw *ah = hw->priv;
562 ath5k_hw_set_ledstate(ah, ah->assoc ? 564 ath5k_hw_set_ledstate(ah, ah->assoc ?
diff --git a/drivers/net/wireless/ath/ath9k/channel.c b/drivers/net/wireless/ath/ath9k/channel.c
index 794d52016437..206665059d66 100644
--- a/drivers/net/wireless/ath/ath9k/channel.c
+++ b/drivers/net/wireless/ath/ath9k/channel.c
@@ -963,7 +963,7 @@ static void ath_scan_send_probe(struct ath_softc *sc,
963 struct ieee80211_tx_info *info; 963 struct ieee80211_tx_info *info;
964 int band = sc->offchannel.chan.chandef.chan->band; 964 int band = sc->offchannel.chan.chandef.chan->band;
965 965
966 skb = ieee80211_probereq_get(sc->hw, vif, 966 skb = ieee80211_probereq_get(sc->hw, vif->addr,
967 ssid->ssid, ssid->ssid_len, req->ie_len); 967 ssid->ssid, ssid->ssid_len, req->ie_len);
968 if (!skb) 968 if (!skb)
969 return; 969 return;
diff --git a/drivers/net/wireless/ath/ath9k/htc_drv_main.c b/drivers/net/wireless/ath/ath9k/htc_drv_main.c
index c7d12efaa86a..92d5a6c5a225 100644
--- a/drivers/net/wireless/ath/ath9k/htc_drv_main.c
+++ b/drivers/net/wireless/ath/ath9k/htc_drv_main.c
@@ -1691,7 +1691,9 @@ static int ath9k_htc_ampdu_action(struct ieee80211_hw *hw,
1691 return ret; 1691 return ret;
1692} 1692}
1693 1693
1694static void ath9k_htc_sw_scan_start(struct ieee80211_hw *hw) 1694static void ath9k_htc_sw_scan_start(struct ieee80211_hw *hw,
1695 struct ieee80211_vif *vif,
1696 const u8 *mac_addr)
1695{ 1697{
1696 struct ath9k_htc_priv *priv = hw->priv; 1698 struct ath9k_htc_priv *priv = hw->priv;
1697 struct ath_common *common = ath9k_hw_common(priv->ah); 1699 struct ath_common *common = ath9k_hw_common(priv->ah);
@@ -1705,7 +1707,8 @@ static void ath9k_htc_sw_scan_start(struct ieee80211_hw *hw)
1705 mutex_unlock(&priv->mutex); 1707 mutex_unlock(&priv->mutex);
1706} 1708}
1707 1709
1708static void ath9k_htc_sw_scan_complete(struct ieee80211_hw *hw) 1710static void ath9k_htc_sw_scan_complete(struct ieee80211_hw *hw,
1711 struct ieee80211_vif *vif)
1709{ 1712{
1710 struct ath9k_htc_priv *priv = hw->priv; 1713 struct ath9k_htc_priv *priv = hw->priv;
1711 struct ath_common *common = ath9k_hw_common(priv->ah); 1714 struct ath_common *common = ath9k_hw_common(priv->ah);
diff --git a/drivers/net/wireless/ath/ath9k/main.c b/drivers/net/wireless/ath/ath9k/main.c
index 5f16630f26ce..027ad715ffb2 100644
--- a/drivers/net/wireless/ath/ath9k/main.c
+++ b/drivers/net/wireless/ath/ath9k/main.c
@@ -2180,14 +2180,17 @@ static int ath9k_get_antenna(struct ieee80211_hw *hw, u32 *tx_ant, u32 *rx_ant)
2180 return 0; 2180 return 0;
2181} 2181}
2182 2182
2183static void ath9k_sw_scan_start(struct ieee80211_hw *hw) 2183static void ath9k_sw_scan_start(struct ieee80211_hw *hw,
2184 struct ieee80211_vif *vif,
2185 const u8 *mac_addr)
2184{ 2186{
2185 struct ath_softc *sc = hw->priv; 2187 struct ath_softc *sc = hw->priv;
2186 struct ath_common *common = ath9k_hw_common(sc->sc_ah); 2188 struct ath_common *common = ath9k_hw_common(sc->sc_ah);
2187 set_bit(ATH_OP_SCANNING, &common->op_flags); 2189 set_bit(ATH_OP_SCANNING, &common->op_flags);
2188} 2190}
2189 2191
2190static void ath9k_sw_scan_complete(struct ieee80211_hw *hw) 2192static void ath9k_sw_scan_complete(struct ieee80211_hw *hw,
2193 struct ieee80211_vif *vif)
2191{ 2194{
2192 struct ath_softc *sc = hw->priv; 2195 struct ath_softc *sc = hw->priv;
2193 struct ath_common *common = ath9k_hw_common(sc->sc_ah); 2196 struct ath_common *common = ath9k_hw_common(sc->sc_ah);
diff --git a/drivers/net/wireless/ath/wcn36xx/main.c b/drivers/net/wireless/ath/wcn36xx/main.c
index b71d2b33532d..267c35d1f699 100644
--- a/drivers/net/wireless/ath/wcn36xx/main.c
+++ b/drivers/net/wireless/ath/wcn36xx/main.c
@@ -494,7 +494,9 @@ out:
494 return ret; 494 return ret;
495} 495}
496 496
497static void wcn36xx_sw_scan_start(struct ieee80211_hw *hw) 497static void wcn36xx_sw_scan_start(struct ieee80211_hw *hw,
498 struct ieee80211_vif *vif,
499 const u8 *mac_addr)
498{ 500{
499 struct wcn36xx *wcn = hw->priv; 501 struct wcn36xx *wcn = hw->priv;
500 502
@@ -502,7 +504,8 @@ static void wcn36xx_sw_scan_start(struct ieee80211_hw *hw)
502 wcn36xx_smd_start_scan(wcn); 504 wcn36xx_smd_start_scan(wcn);
503} 505}
504 506
505static void wcn36xx_sw_scan_complete(struct ieee80211_hw *hw) 507static void wcn36xx_sw_scan_complete(struct ieee80211_hw *hw,
508 struct ieee80211_vif *vif)
506{ 509{
507 struct wcn36xx *wcn = hw->priv; 510 struct wcn36xx *wcn = hw->priv;
508 511
diff --git a/drivers/net/wireless/b43/main.c b/drivers/net/wireless/b43/main.c
index 5d4173ee55bc..47731cb0d815 100644
--- a/drivers/net/wireless/b43/main.c
+++ b/drivers/net/wireless/b43/main.c
@@ -5110,7 +5110,9 @@ static void b43_op_sta_notify(struct ieee80211_hw *hw,
5110 B43_WARN_ON(!vif || wl->vif != vif); 5110 B43_WARN_ON(!vif || wl->vif != vif);
5111} 5111}
5112 5112
5113static void b43_op_sw_scan_start_notifier(struct ieee80211_hw *hw) 5113static void b43_op_sw_scan_start_notifier(struct ieee80211_hw *hw,
5114 struct ieee80211_vif *vif,
5115 const u8 *mac_addr)
5114{ 5116{
5115 struct b43_wl *wl = hw_to_b43_wl(hw); 5117 struct b43_wl *wl = hw_to_b43_wl(hw);
5116 struct b43_wldev *dev; 5118 struct b43_wldev *dev;
@@ -5124,7 +5126,8 @@ static void b43_op_sw_scan_start_notifier(struct ieee80211_hw *hw)
5124 mutex_unlock(&wl->mutex); 5126 mutex_unlock(&wl->mutex);
5125} 5127}
5126 5128
5127static void b43_op_sw_scan_complete_notifier(struct ieee80211_hw *hw) 5129static void b43_op_sw_scan_complete_notifier(struct ieee80211_hw *hw,
5130 struct ieee80211_vif *vif)
5128{ 5131{
5129 struct b43_wl *wl = hw_to_b43_wl(hw); 5132 struct b43_wl *wl = hw_to_b43_wl(hw);
5130 struct b43_wldev *dev; 5133 struct b43_wldev *dev;
diff --git a/drivers/net/wireless/brcm80211/brcmsmac/mac80211_if.c b/drivers/net/wireless/brcm80211/brcmsmac/mac80211_if.c
index 43c71bfaa474..f95b52442281 100644
--- a/drivers/net/wireless/brcm80211/brcmsmac/mac80211_if.c
+++ b/drivers/net/wireless/brcm80211/brcmsmac/mac80211_if.c
@@ -764,7 +764,9 @@ brcms_ops_configure_filter(struct ieee80211_hw *hw,
764 return; 764 return;
765} 765}
766 766
767static void brcms_ops_sw_scan_start(struct ieee80211_hw *hw) 767static void brcms_ops_sw_scan_start(struct ieee80211_hw *hw,
768 struct ieee80211_vif *vif,
769 const u8 *mac_addr)
768{ 770{
769 struct brcms_info *wl = hw->priv; 771 struct brcms_info *wl = hw->priv;
770 spin_lock_bh(&wl->lock); 772 spin_lock_bh(&wl->lock);
@@ -773,7 +775,8 @@ static void brcms_ops_sw_scan_start(struct ieee80211_hw *hw)
773 return; 775 return;
774} 776}
775 777
776static void brcms_ops_sw_scan_complete(struct ieee80211_hw *hw) 778static void brcms_ops_sw_scan_complete(struct ieee80211_hw *hw,
779 struct ieee80211_vif *vif)
777{ 780{
778 struct brcms_info *wl = hw->priv; 781 struct brcms_info *wl = hw->priv;
779 spin_lock_bh(&wl->lock); 782 spin_lock_bh(&wl->lock);
diff --git a/drivers/net/wireless/cw1200/scan.c b/drivers/net/wireless/cw1200/scan.c
index b2fb6c632092..f2e276faca70 100644
--- a/drivers/net/wireless/cw1200/scan.c
+++ b/drivers/net/wireless/cw1200/scan.c
@@ -78,7 +78,7 @@ int cw1200_hw_scan(struct ieee80211_hw *hw,
78 if (req->n_ssids > WSM_SCAN_MAX_NUM_OF_SSIDS) 78 if (req->n_ssids > WSM_SCAN_MAX_NUM_OF_SSIDS)
79 return -EINVAL; 79 return -EINVAL;
80 80
81 frame.skb = ieee80211_probereq_get(hw, priv->vif, NULL, 0, 81 frame.skb = ieee80211_probereq_get(hw, priv->vif->addr, NULL, 0,
82 req->ie_len); 82 req->ie_len);
83 if (!frame.skb) 83 if (!frame.skb)
84 return -ENOMEM; 84 return -ENOMEM;
diff --git a/drivers/net/wireless/mac80211_hwsim.c b/drivers/net/wireless/mac80211_hwsim.c
index 58f11bb0896f..6daaad595ea4 100644
--- a/drivers/net/wireless/mac80211_hwsim.c
+++ b/drivers/net/wireless/mac80211_hwsim.c
@@ -1802,7 +1802,7 @@ static void hw_scan_work(struct work_struct *work)
1802 struct sk_buff *probe; 1802 struct sk_buff *probe;
1803 1803
1804 probe = ieee80211_probereq_get(hwsim->hw, 1804 probe = ieee80211_probereq_get(hwsim->hw,
1805 hwsim->hw_scan_vif, 1805 hwsim->hw_scan_vif->addr,
1806 req->ssids[i].ssid, 1806 req->ssids[i].ssid,
1807 req->ssids[i].ssid_len, 1807 req->ssids[i].ssid_len,
1808 req->ie_len); 1808 req->ie_len);
@@ -1866,7 +1866,9 @@ static void mac80211_hwsim_cancel_hw_scan(struct ieee80211_hw *hw,
1866 mutex_unlock(&hwsim->mutex); 1866 mutex_unlock(&hwsim->mutex);
1867} 1867}
1868 1868
1869static void mac80211_hwsim_sw_scan(struct ieee80211_hw *hw) 1869static void mac80211_hwsim_sw_scan(struct ieee80211_hw *hw,
1870 struct ieee80211_vif *vif,
1871 const u8 *mac_addr)
1870{ 1872{
1871 struct mac80211_hwsim_data *hwsim = hw->priv; 1873 struct mac80211_hwsim_data *hwsim = hw->priv;
1872 1874
@@ -1884,7 +1886,8 @@ out:
1884 mutex_unlock(&hwsim->mutex); 1886 mutex_unlock(&hwsim->mutex);
1885} 1887}
1886 1888
1887static void mac80211_hwsim_sw_scan_complete(struct ieee80211_hw *hw) 1889static void mac80211_hwsim_sw_scan_complete(struct ieee80211_hw *hw,
1890 struct ieee80211_vif *vif)
1888{ 1891{
1889 struct mac80211_hwsim_data *hwsim = hw->priv; 1892 struct mac80211_hwsim_data *hwsim = hw->priv;
1890 1893
diff --git a/drivers/net/wireless/mwl8k.c b/drivers/net/wireless/mwl8k.c
index ef1104476bd8..b8d1e04aa9b9 100644
--- a/drivers/net/wireless/mwl8k.c
+++ b/drivers/net/wireless/mwl8k.c
@@ -5548,7 +5548,9 @@ mwl8k_ampdu_action(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
5548 return rc; 5548 return rc;
5549} 5549}
5550 5550
5551static void mwl8k_sw_scan_start(struct ieee80211_hw *hw) 5551static void mwl8k_sw_scan_start(struct ieee80211_hw *hw,
5552 struct ieee80211_vif *vif,
5553 const u8 *mac_addr)
5552{ 5554{
5553 struct mwl8k_priv *priv = hw->priv; 5555 struct mwl8k_priv *priv = hw->priv;
5554 u8 tmp; 5556 u8 tmp;
@@ -5565,7 +5567,8 @@ static void mwl8k_sw_scan_start(struct ieee80211_hw *hw)
5565 priv->sw_scan_start = true; 5567 priv->sw_scan_start = true;
5566} 5568}
5567 5569
5568static void mwl8k_sw_scan_complete(struct ieee80211_hw *hw) 5570static void mwl8k_sw_scan_complete(struct ieee80211_hw *hw,
5571 struct ieee80211_vif *vif)
5569{ 5572{
5570 struct mwl8k_priv *priv = hw->priv; 5573 struct mwl8k_priv *priv = hw->priv;
5571 u8 tmp; 5574 u8 tmp;
diff --git a/drivers/net/wireless/rt2x00/rt2x00.h b/drivers/net/wireless/rt2x00/rt2x00.h
index d13f25cd70d5..1ff81afb672c 100644
--- a/drivers/net/wireless/rt2x00/rt2x00.h
+++ b/drivers/net/wireless/rt2x00/rt2x00.h
@@ -1437,8 +1437,11 @@ int rt2x00mac_sta_add(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
1437 struct ieee80211_sta *sta); 1437 struct ieee80211_sta *sta);
1438int rt2x00mac_sta_remove(struct ieee80211_hw *hw, struct ieee80211_vif *vif, 1438int rt2x00mac_sta_remove(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
1439 struct ieee80211_sta *sta); 1439 struct ieee80211_sta *sta);
1440void rt2x00mac_sw_scan_start(struct ieee80211_hw *hw); 1440void rt2x00mac_sw_scan_start(struct ieee80211_hw *hw,
1441void rt2x00mac_sw_scan_complete(struct ieee80211_hw *hw); 1441 struct ieee80211_vif *vif,
1442 const u8 *mac_addr);
1443void rt2x00mac_sw_scan_complete(struct ieee80211_hw *hw,
1444 struct ieee80211_vif *vif);
1442int rt2x00mac_get_stats(struct ieee80211_hw *hw, 1445int rt2x00mac_get_stats(struct ieee80211_hw *hw,
1443 struct ieee80211_low_level_stats *stats); 1446 struct ieee80211_low_level_stats *stats);
1444void rt2x00mac_bss_info_changed(struct ieee80211_hw *hw, 1447void rt2x00mac_bss_info_changed(struct ieee80211_hw *hw,
diff --git a/drivers/net/wireless/rt2x00/rt2x00mac.c b/drivers/net/wireless/rt2x00/rt2x00mac.c
index ad6e5a8d1e10..cb40245a0695 100644
--- a/drivers/net/wireless/rt2x00/rt2x00mac.c
+++ b/drivers/net/wireless/rt2x00/rt2x00mac.c
@@ -568,7 +568,9 @@ int rt2x00mac_sta_remove(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
568} 568}
569EXPORT_SYMBOL_GPL(rt2x00mac_sta_remove); 569EXPORT_SYMBOL_GPL(rt2x00mac_sta_remove);
570 570
571void rt2x00mac_sw_scan_start(struct ieee80211_hw *hw) 571void rt2x00mac_sw_scan_start(struct ieee80211_hw *hw,
572 struct ieee80211_vif *vif,
573 const u8 *mac_addr)
572{ 574{
573 struct rt2x00_dev *rt2x00dev = hw->priv; 575 struct rt2x00_dev *rt2x00dev = hw->priv;
574 set_bit(DEVICE_STATE_SCANNING, &rt2x00dev->flags); 576 set_bit(DEVICE_STATE_SCANNING, &rt2x00dev->flags);
@@ -576,7 +578,8 @@ void rt2x00mac_sw_scan_start(struct ieee80211_hw *hw)
576} 578}
577EXPORT_SYMBOL_GPL(rt2x00mac_sw_scan_start); 579EXPORT_SYMBOL_GPL(rt2x00mac_sw_scan_start);
578 580
579void rt2x00mac_sw_scan_complete(struct ieee80211_hw *hw) 581void rt2x00mac_sw_scan_complete(struct ieee80211_hw *hw,
582 struct ieee80211_vif *vif)
580{ 583{
581 struct rt2x00_dev *rt2x00dev = hw->priv; 584 struct rt2x00_dev *rt2x00dev = hw->priv;
582 clear_bit(DEVICE_STATE_SCANNING, &rt2x00dev->flags); 585 clear_bit(DEVICE_STATE_SCANNING, &rt2x00dev->flags);
diff --git a/drivers/net/wireless/rtlwifi/core.c b/drivers/net/wireless/rtlwifi/core.c
index f6179bc06086..884d90526f9e 100644
--- a/drivers/net/wireless/rtlwifi/core.c
+++ b/drivers/net/wireless/rtlwifi/core.c
@@ -1361,7 +1361,9 @@ static int rtl_op_ampdu_action(struct ieee80211_hw *hw,
1361 return 0; 1361 return 0;
1362} 1362}
1363 1363
1364static void rtl_op_sw_scan_start(struct ieee80211_hw *hw) 1364static void rtl_op_sw_scan_start(struct ieee80211_hw *hw,
1365 struct ieee80211_vif *vif,
1366 const u8 *mac_addr)
1365{ 1367{
1366 struct rtl_priv *rtlpriv = rtl_priv(hw); 1368 struct rtl_priv *rtlpriv = rtl_priv(hw);
1367 struct rtl_mac *mac = rtl_mac(rtl_priv(hw)); 1369 struct rtl_mac *mac = rtl_mac(rtl_priv(hw));
@@ -1396,7 +1398,8 @@ static void rtl_op_sw_scan_start(struct ieee80211_hw *hw)
1396 rtlpriv->cfg->ops->scan_operation_backup(hw, SCAN_OPT_BACKUP_BAND0); 1398 rtlpriv->cfg->ops->scan_operation_backup(hw, SCAN_OPT_BACKUP_BAND0);
1397} 1399}
1398 1400
1399static void rtl_op_sw_scan_complete(struct ieee80211_hw *hw) 1401static void rtl_op_sw_scan_complete(struct ieee80211_hw *hw,
1402 struct ieee80211_vif *vif)
1400{ 1403{
1401 struct rtl_priv *rtlpriv = rtl_priv(hw); 1404 struct rtl_priv *rtlpriv = rtl_priv(hw);
1402 struct rtl_mac *mac = rtl_mac(rtl_priv(hw)); 1405 struct rtl_mac *mac = rtl_mac(rtl_priv(hw));
diff --git a/drivers/net/wireless/ti/wl1251/main.c b/drivers/net/wireless/ti/wl1251/main.c
index 38234851457e..0b30a7b4d663 100644
--- a/drivers/net/wireless/ti/wl1251/main.c
+++ b/drivers/net/wireless/ti/wl1251/main.c
@@ -1029,7 +1029,7 @@ static int wl1251_op_hw_scan(struct ieee80211_hw *hw,
1029 goto out_sleep; 1029 goto out_sleep;
1030 } 1030 }
1031 1031
1032 skb = ieee80211_probereq_get(wl->hw, wl->vif, ssid, ssid_len, 1032 skb = ieee80211_probereq_get(wl->hw, wl->vif->addr, ssid, ssid_len,
1033 req->ie_len); 1033 req->ie_len);
1034 if (!skb) { 1034 if (!skb) {
1035 ret = -ENOMEM; 1035 ret = -ENOMEM;
diff --git a/drivers/net/wireless/ti/wlcore/cmd.c b/drivers/net/wireless/ti/wlcore/cmd.c
index dd2e448c3e2b..b82661962d33 100644
--- a/drivers/net/wireless/ti/wlcore/cmd.c
+++ b/drivers/net/wireless/ti/wlcore/cmd.c
@@ -1145,7 +1145,7 @@ int wl12xx_cmd_build_probe_req(struct wl1271 *wl, struct wl12xx_vif *wlvif,
1145 1145
1146 wl1271_debug(DEBUG_SCAN, "build probe request band %d", band); 1146 wl1271_debug(DEBUG_SCAN, "build probe request band %d", band);
1147 1147
1148 skb = ieee80211_probereq_get(wl->hw, vif, ssid, ssid_len, 1148 skb = ieee80211_probereq_get(wl->hw, vif->addr, ssid, ssid_len,
1149 ie0_len + ie1_len); 1149 ie0_len + ie1_len);
1150 if (!skb) { 1150 if (!skb) {
1151 ret = -ENOMEM; 1151 ret = -ENOMEM;
diff --git a/drivers/staging/vt6656/main_usb.c b/drivers/staging/vt6656/main_usb.c
index 2fbff907ce8a..dbc311c3dc37 100644
--- a/drivers/staging/vt6656/main_usb.c
+++ b/drivers/staging/vt6656/main_usb.c
@@ -856,7 +856,9 @@ static int vnt_set_key(struct ieee80211_hw *hw, enum set_key_cmd cmd,
856 return 0; 856 return 0;
857} 857}
858 858
859static void vnt_sw_scan_start(struct ieee80211_hw *hw) 859static void vnt_sw_scan_start(struct ieee80211_hw *hw,
860 struct ieee80211_vif *vif,
861 const u8 *addr)
860{ 862{
861 struct vnt_private *priv = hw->priv; 863 struct vnt_private *priv = hw->priv;
862 864
@@ -865,7 +867,8 @@ static void vnt_sw_scan_start(struct ieee80211_hw *hw)
865 vnt_update_pre_ed_threshold(priv, true); 867 vnt_update_pre_ed_threshold(priv, true);
866} 868}
867 869
868static void vnt_sw_scan_complete(struct ieee80211_hw *hw) 870static void vnt_sw_scan_complete(struct ieee80211_hw *hw,
871 struct ieee80211_vif *vif)
869{ 872{
870 struct vnt_private *priv = hw->priv; 873 struct vnt_private *priv = hw->priv;
871 874
diff --git a/include/net/mac80211.h b/include/net/mac80211.h
index 59166a115aff..7b889e3a2647 100644
--- a/include/net/mac80211.h
+++ b/include/net/mac80211.h
@@ -2622,7 +2622,9 @@ enum ieee80211_reconfig_type {
2622 * 2622 *
2623 * @sw_scan_start: Notifier function that is called just before a software scan 2623 * @sw_scan_start: Notifier function that is called just before a software scan
2624 * is started. Can be NULL, if the driver doesn't need this notification. 2624 * is started. Can be NULL, if the driver doesn't need this notification.
2625 * The callback can sleep. 2625 * The mac_addr parameter allows supporting NL80211_SCAN_FLAG_RANDOM_ADDR,
2626 * the driver may set the NL80211_FEATURE_SCAN_RANDOM_MAC_ADDR flag if it
2627 * can use this parameter. The callback can sleep.
2626 * 2628 *
2627 * @sw_scan_complete: Notifier function that is called just after a 2629 * @sw_scan_complete: Notifier function that is called just after a
2628 * software scan finished. Can be NULL, if the driver doesn't need 2630 * software scan finished. Can be NULL, if the driver doesn't need
@@ -3016,8 +3018,11 @@ struct ieee80211_ops {
3016 struct ieee80211_scan_ies *ies); 3018 struct ieee80211_scan_ies *ies);
3017 int (*sched_scan_stop)(struct ieee80211_hw *hw, 3019 int (*sched_scan_stop)(struct ieee80211_hw *hw,
3018 struct ieee80211_vif *vif); 3020 struct ieee80211_vif *vif);
3019 void (*sw_scan_start)(struct ieee80211_hw *hw); 3021 void (*sw_scan_start)(struct ieee80211_hw *hw,
3020 void (*sw_scan_complete)(struct ieee80211_hw *hw); 3022 struct ieee80211_vif *vif,
3023 const u8 *mac_addr);
3024 void (*sw_scan_complete)(struct ieee80211_hw *hw,
3025 struct ieee80211_vif *vif);
3021 int (*get_stats)(struct ieee80211_hw *hw, 3026 int (*get_stats)(struct ieee80211_hw *hw,
3022 struct ieee80211_low_level_stats *stats); 3027 struct ieee80211_low_level_stats *stats);
3023 void (*get_tkip_seq)(struct ieee80211_hw *hw, u8 hw_key_idx, 3028 void (*get_tkip_seq)(struct ieee80211_hw *hw, u8 hw_key_idx,
@@ -3820,7 +3825,7 @@ struct sk_buff *ieee80211_nullfunc_get(struct ieee80211_hw *hw,
3820/** 3825/**
3821 * ieee80211_probereq_get - retrieve a Probe Request template 3826 * ieee80211_probereq_get - retrieve a Probe Request template
3822 * @hw: pointer obtained from ieee80211_alloc_hw(). 3827 * @hw: pointer obtained from ieee80211_alloc_hw().
3823 * @vif: &struct ieee80211_vif pointer from the add_interface callback. 3828 * @src_addr: source MAC address
3824 * @ssid: SSID buffer 3829 * @ssid: SSID buffer
3825 * @ssid_len: length of SSID 3830 * @ssid_len: length of SSID
3826 * @tailroom: tailroom to reserve at end of SKB for IEs 3831 * @tailroom: tailroom to reserve at end of SKB for IEs
@@ -3831,7 +3836,7 @@ struct sk_buff *ieee80211_nullfunc_get(struct ieee80211_hw *hw,
3831 * Return: The Probe Request template. %NULL on error. 3836 * Return: The Probe Request template. %NULL on error.
3832 */ 3837 */
3833struct sk_buff *ieee80211_probereq_get(struct ieee80211_hw *hw, 3838struct sk_buff *ieee80211_probereq_get(struct ieee80211_hw *hw,
3834 struct ieee80211_vif *vif, 3839 const u8 *src_addr,
3835 const u8 *ssid, size_t ssid_len, 3840 const u8 *ssid, size_t ssid_len,
3836 size_t tailroom); 3841 size_t tailroom);
3837 3842
diff --git a/net/mac80211/driver-ops.h b/net/mac80211/driver-ops.h
index ba0d2cb5df12..5f5fc3f3ee7c 100644
--- a/net/mac80211/driver-ops.h
+++ b/net/mac80211/driver-ops.h
@@ -380,23 +380,26 @@ static inline int drv_sched_scan_stop(struct ieee80211_local *local,
380 return ret; 380 return ret;
381} 381}
382 382
383static inline void drv_sw_scan_start(struct ieee80211_local *local) 383static inline void drv_sw_scan_start(struct ieee80211_local *local,
384 struct ieee80211_sub_if_data *sdata,
385 const u8 *mac_addr)
384{ 386{
385 might_sleep(); 387 might_sleep();
386 388
387 trace_drv_sw_scan_start(local); 389 trace_drv_sw_scan_start(local, sdata, mac_addr);
388 if (local->ops->sw_scan_start) 390 if (local->ops->sw_scan_start)
389 local->ops->sw_scan_start(&local->hw); 391 local->ops->sw_scan_start(&local->hw, &sdata->vif, mac_addr);
390 trace_drv_return_void(local); 392 trace_drv_return_void(local);
391} 393}
392 394
393static inline void drv_sw_scan_complete(struct ieee80211_local *local) 395static inline void drv_sw_scan_complete(struct ieee80211_local *local,
396 struct ieee80211_sub_if_data *sdata)
394{ 397{
395 might_sleep(); 398 might_sleep();
396 399
397 trace_drv_sw_scan_complete(local); 400 trace_drv_sw_scan_complete(local, sdata);
398 if (local->ops->sw_scan_complete) 401 if (local->ops->sw_scan_complete)
399 local->ops->sw_scan_complete(&local->hw); 402 local->ops->sw_scan_complete(&local->hw, &sdata->vif);
400 trace_drv_return_void(local); 403 trace_drv_return_void(local);
401} 404}
402 405
diff --git a/net/mac80211/ieee80211_i.h b/net/mac80211/ieee80211_i.h
index dd27180060b9..cf95d033bcbf 100644
--- a/net/mac80211/ieee80211_i.h
+++ b/net/mac80211/ieee80211_i.h
@@ -1249,6 +1249,7 @@ struct ieee80211_local {
1249 struct work_struct sched_scan_stopped_work; 1249 struct work_struct sched_scan_stopped_work;
1250 struct ieee80211_sub_if_data __rcu *sched_scan_sdata; 1250 struct ieee80211_sub_if_data __rcu *sched_scan_sdata;
1251 struct cfg80211_sched_scan_request __rcu *sched_scan_req; 1251 struct cfg80211_sched_scan_request __rcu *sched_scan_req;
1252 u8 scan_addr[ETH_ALEN];
1252 1253
1253 unsigned long leave_oper_channel_time; 1254 unsigned long leave_oper_channel_time;
1254 enum mac80211_scan_state next_scan_state; 1255 enum mac80211_scan_state next_scan_state;
@@ -1901,12 +1902,14 @@ int ieee80211_build_preq_ies(struct ieee80211_local *local, u8 *buffer,
1901 u8 bands_used, u32 *rate_masks, 1902 u8 bands_used, u32 *rate_masks,
1902 struct cfg80211_chan_def *chandef); 1903 struct cfg80211_chan_def *chandef);
1903struct sk_buff *ieee80211_build_probe_req(struct ieee80211_sub_if_data *sdata, 1904struct sk_buff *ieee80211_build_probe_req(struct ieee80211_sub_if_data *sdata,
1904 u8 *dst, u32 ratemask, 1905 const u8 *src, const u8 *dst,
1906 u32 ratemask,
1905 struct ieee80211_channel *chan, 1907 struct ieee80211_channel *chan,
1906 const u8 *ssid, size_t ssid_len, 1908 const u8 *ssid, size_t ssid_len,
1907 const u8 *ie, size_t ie_len, 1909 const u8 *ie, size_t ie_len,
1908 bool directed); 1910 bool directed);
1909void ieee80211_send_probe_req(struct ieee80211_sub_if_data *sdata, u8 *dst, 1911void ieee80211_send_probe_req(struct ieee80211_sub_if_data *sdata,
1912 const u8 *src, const u8 *dst,
1910 const u8 *ssid, size_t ssid_len, 1913 const u8 *ssid, size_t ssid_len,
1911 const u8 *ie, size_t ie_len, 1914 const u8 *ie, size_t ie_len,
1912 u32 ratemask, bool directed, u32 tx_flags, 1915 u32 ratemask, bool directed, u32 tx_flags,
diff --git a/net/mac80211/mlme.c b/net/mac80211/mlme.c
index 45490a202d9c..d29589a09065 100644
--- a/net/mac80211/mlme.c
+++ b/net/mac80211/mlme.c
@@ -2225,7 +2225,8 @@ static void ieee80211_mgd_probe_ap_send(struct ieee80211_sub_if_data *sdata)
2225 else 2225 else
2226 ssid_len = ssid[1]; 2226 ssid_len = ssid[1];
2227 2227
2228 ieee80211_send_probe_req(sdata, dst, ssid + 2, ssid_len, NULL, 2228 ieee80211_send_probe_req(sdata, sdata->vif.addr, NULL,
2229 ssid + 2, ssid_len, NULL,
2229 0, (u32) -1, true, 0, 2230 0, (u32) -1, true, 0,
2230 ifmgd->associated->channel, false); 2231 ifmgd->associated->channel, false);
2231 rcu_read_unlock(); 2232 rcu_read_unlock();
@@ -2328,7 +2329,7 @@ struct sk_buff *ieee80211_ap_probereq_get(struct ieee80211_hw *hw,
2328 else 2329 else
2329 ssid_len = ssid[1]; 2330 ssid_len = ssid[1];
2330 2331
2331 skb = ieee80211_build_probe_req(sdata, cbss->bssid, 2332 skb = ieee80211_build_probe_req(sdata, sdata->vif.addr, cbss->bssid,
2332 (u32) -1, cbss->channel, 2333 (u32) -1, cbss->channel,
2333 ssid + 2, ssid_len, 2334 ssid + 2, ssid_len,
2334 NULL, 0, true); 2335 NULL, 0, true);
@@ -3649,7 +3650,8 @@ static int ieee80211_probe_auth(struct ieee80211_sub_if_data *sdata)
3649 * Direct probe is sent to broadcast address as some APs 3650 * Direct probe is sent to broadcast address as some APs
3650 * will not answer to direct packet in unassociated state. 3651 * will not answer to direct packet in unassociated state.
3651 */ 3652 */
3652 ieee80211_send_probe_req(sdata, NULL, ssidie + 2, ssidie[1], 3653 ieee80211_send_probe_req(sdata, sdata->vif.addr, NULL,
3654 ssidie + 2, ssidie[1],
3653 NULL, 0, (u32) -1, true, 0, 3655 NULL, 0, (u32) -1, true, 0,
3654 auth_data->bss->channel, false); 3656 auth_data->bss->channel, false);
3655 rcu_read_unlock(); 3657 rcu_read_unlock();
diff --git a/net/mac80211/scan.c b/net/mac80211/scan.c
index e75e64b8042c..ae842678b629 100644
--- a/net/mac80211/scan.c
+++ b/net/mac80211/scan.c
@@ -184,9 +184,21 @@ void ieee80211_scan_rx(struct ieee80211_local *local, struct sk_buff *skb)
184 return; 184 return;
185 185
186 if (ieee80211_is_probe_resp(mgmt->frame_control)) { 186 if (ieee80211_is_probe_resp(mgmt->frame_control)) {
187 /* ignore ProbeResp to foreign address */ 187 struct cfg80211_scan_request *scan_req;
188 if ((!sdata1 || !ether_addr_equal(mgmt->da, sdata1->vif.addr)) && 188 struct cfg80211_sched_scan_request *sched_scan_req;
189 (!sdata2 || !ether_addr_equal(mgmt->da, sdata2->vif.addr))) 189
190 scan_req = rcu_dereference(local->scan_req);
191 sched_scan_req = rcu_dereference(local->sched_scan_req);
192
193 /* ignore ProbeResp to foreign address unless scanning
194 * with randomised address
195 */
196 if (!(sdata1 &&
197 (ether_addr_equal(mgmt->da, sdata1->vif.addr) ||
198 scan_req->flags & NL80211_SCAN_FLAG_RANDOM_ADDR)) &&
199 !(sdata2 &&
200 (ether_addr_equal(mgmt->da, sdata2->vif.addr) ||
201 sched_scan_req->flags & NL80211_SCAN_FLAG_RANDOM_ADDR)))
190 return; 202 return;
191 203
192 elements = mgmt->u.probe_resp.variable; 204 elements = mgmt->u.probe_resp.variable;
@@ -284,6 +296,9 @@ static bool ieee80211_prep_hw_scan(struct ieee80211_local *local)
284 bands_used, req->rates, &chandef); 296 bands_used, req->rates, &chandef);
285 local->hw_scan_req->req.ie_len = ielen; 297 local->hw_scan_req->req.ie_len = ielen;
286 local->hw_scan_req->req.no_cck = req->no_cck; 298 local->hw_scan_req->req.no_cck = req->no_cck;
299 ether_addr_copy(local->hw_scan_req->req.mac_addr, req->mac_addr);
300 ether_addr_copy(local->hw_scan_req->req.mac_addr_mask,
301 req->mac_addr_mask);
287 302
288 return true; 303 return true;
289} 304}
@@ -294,6 +309,7 @@ static void __ieee80211_scan_completed(struct ieee80211_hw *hw, bool aborted)
294 bool hw_scan = local->ops->hw_scan; 309 bool hw_scan = local->ops->hw_scan;
295 bool was_scanning = local->scanning; 310 bool was_scanning = local->scanning;
296 struct cfg80211_scan_request *scan_req; 311 struct cfg80211_scan_request *scan_req;
312 struct ieee80211_sub_if_data *scan_sdata;
297 313
298 lockdep_assert_held(&local->mtx); 314 lockdep_assert_held(&local->mtx);
299 315
@@ -332,6 +348,9 @@ static void __ieee80211_scan_completed(struct ieee80211_hw *hw, bool aborted)
332 if (scan_req != local->int_scan_req) 348 if (scan_req != local->int_scan_req)
333 cfg80211_scan_done(scan_req, aborted); 349 cfg80211_scan_done(scan_req, aborted);
334 RCU_INIT_POINTER(local->scan_req, NULL); 350 RCU_INIT_POINTER(local->scan_req, NULL);
351
352 scan_sdata = rcu_dereference_protected(local->scan_sdata,
353 lockdep_is_held(&local->mtx));
335 RCU_INIT_POINTER(local->scan_sdata, NULL); 354 RCU_INIT_POINTER(local->scan_sdata, NULL);
336 355
337 local->scanning = 0; 356 local->scanning = 0;
@@ -342,7 +361,7 @@ static void __ieee80211_scan_completed(struct ieee80211_hw *hw, bool aborted)
342 361
343 if (!hw_scan) { 362 if (!hw_scan) {
344 ieee80211_configure_filter(local); 363 ieee80211_configure_filter(local);
345 drv_sw_scan_complete(local); 364 drv_sw_scan_complete(local, scan_sdata);
346 ieee80211_offchannel_return(local); 365 ieee80211_offchannel_return(local);
347 } 366 }
348 367
@@ -368,7 +387,8 @@ void ieee80211_scan_completed(struct ieee80211_hw *hw, bool aborted)
368} 387}
369EXPORT_SYMBOL(ieee80211_scan_completed); 388EXPORT_SYMBOL(ieee80211_scan_completed);
370 389
371static int ieee80211_start_sw_scan(struct ieee80211_local *local) 390static int ieee80211_start_sw_scan(struct ieee80211_local *local,
391 struct ieee80211_sub_if_data *sdata)
372{ 392{
373 /* Software scan is not supported in multi-channel cases */ 393 /* Software scan is not supported in multi-channel cases */
374 if (local->use_chanctx) 394 if (local->use_chanctx)
@@ -387,7 +407,7 @@ static int ieee80211_start_sw_scan(struct ieee80211_local *local)
387 * nullfunc frames and probe requests will be dropped in 407 * nullfunc frames and probe requests will be dropped in
388 * ieee80211_tx_h_check_assoc(). 408 * ieee80211_tx_h_check_assoc().
389 */ 409 */
390 drv_sw_scan_start(local); 410 drv_sw_scan_start(local, sdata, local->scan_addr);
391 411
392 local->leave_oper_channel_time = jiffies; 412 local->leave_oper_channel_time = jiffies;
393 local->next_scan_state = SCAN_DECISION; 413 local->next_scan_state = SCAN_DECISION;
@@ -463,7 +483,7 @@ static void ieee80211_scan_state_send_probe(struct ieee80211_local *local,
463 483
464 for (i = 0; i < scan_req->n_ssids; i++) 484 for (i = 0; i < scan_req->n_ssids; i++)
465 ieee80211_send_probe_req( 485 ieee80211_send_probe_req(
466 sdata, NULL, 486 sdata, local->scan_addr, NULL,
467 scan_req->ssids[i].ssid, scan_req->ssids[i].ssid_len, 487 scan_req->ssids[i].ssid, scan_req->ssids[i].ssid_len,
468 scan_req->ie, scan_req->ie_len, 488 scan_req->ie, scan_req->ie_len,
469 scan_req->rates[band], false, 489 scan_req->rates[band], false,
@@ -543,6 +563,13 @@ static int __ieee80211_start_scan(struct ieee80211_sub_if_data *sdata,
543 rcu_assign_pointer(local->scan_req, req); 563 rcu_assign_pointer(local->scan_req, req);
544 rcu_assign_pointer(local->scan_sdata, sdata); 564 rcu_assign_pointer(local->scan_sdata, sdata);
545 565
566 if (req->flags & NL80211_SCAN_FLAG_RANDOM_ADDR)
567 get_random_mask_addr(local->scan_addr,
568 req->mac_addr,
569 req->mac_addr_mask);
570 else
571 memcpy(local->scan_addr, sdata->vif.addr, ETH_ALEN);
572
546 if (local->ops->hw_scan) { 573 if (local->ops->hw_scan) {
547 __set_bit(SCAN_HW_SCANNING, &local->scanning); 574 __set_bit(SCAN_HW_SCANNING, &local->scanning);
548 } else if ((req->n_channels == 1) && 575 } else if ((req->n_channels == 1) &&
@@ -559,7 +586,7 @@ static int __ieee80211_start_scan(struct ieee80211_sub_if_data *sdata,
559 586
560 /* Notify driver scan is starting, keep order of operations 587 /* Notify driver scan is starting, keep order of operations
561 * same as normal software scan, in case that matters. */ 588 * same as normal software scan, in case that matters. */
562 drv_sw_scan_start(local); 589 drv_sw_scan_start(local, sdata, local->scan_addr);
563 590
564 ieee80211_configure_filter(local); /* accept probe-responses */ 591 ieee80211_configure_filter(local); /* accept probe-responses */
565 592
@@ -589,8 +616,9 @@ static int __ieee80211_start_scan(struct ieee80211_sub_if_data *sdata,
589 if (local->ops->hw_scan) { 616 if (local->ops->hw_scan) {
590 WARN_ON(!ieee80211_prep_hw_scan(local)); 617 WARN_ON(!ieee80211_prep_hw_scan(local));
591 rc = drv_hw_scan(local, sdata, local->hw_scan_req); 618 rc = drv_hw_scan(local, sdata, local->hw_scan_req);
592 } else 619 } else {
593 rc = ieee80211_start_sw_scan(local); 620 rc = ieee80211_start_sw_scan(local, sdata);
621 }
594 622
595 if (rc) { 623 if (rc) {
596 kfree(local->hw_scan_req); 624 kfree(local->hw_scan_req);
diff --git a/net/mac80211/trace.h b/net/mac80211/trace.h
index 7f76e2f25744..eb91505eb43e 100644
--- a/net/mac80211/trace.h
+++ b/net/mac80211/trace.h
@@ -596,14 +596,33 @@ DEFINE_EVENT(local_sdata_evt, drv_sched_scan_stop,
596 TP_ARGS(local, sdata) 596 TP_ARGS(local, sdata)
597); 597);
598 598
599DEFINE_EVENT(local_only_evt, drv_sw_scan_start, 599TRACE_EVENT(drv_sw_scan_start,
600 TP_PROTO(struct ieee80211_local *local), 600 TP_PROTO(struct ieee80211_local *local,
601 TP_ARGS(local) 601 struct ieee80211_sub_if_data *sdata,
602 const u8 *mac_addr),
603
604 TP_ARGS(local, sdata, mac_addr),
605
606 TP_STRUCT__entry(
607 LOCAL_ENTRY
608 VIF_ENTRY
609 __array(char, mac_addr, ETH_ALEN)
610 ),
611
612 TP_fast_assign(
613 LOCAL_ASSIGN;
614 VIF_ASSIGN;
615 memcpy(__entry->mac_addr, mac_addr, ETH_ALEN);
616 ),
617
618 TP_printk(LOCAL_PR_FMT ", " VIF_PR_FMT ", addr:%pM",
619 LOCAL_PR_ARG, VIF_PR_ARG, __entry->mac_addr)
602); 620);
603 621
604DEFINE_EVENT(local_only_evt, drv_sw_scan_complete, 622DEFINE_EVENT(local_sdata_evt, drv_sw_scan_complete,
605 TP_PROTO(struct ieee80211_local *local), 623 TP_PROTO(struct ieee80211_local *local,
606 TP_ARGS(local) 624 struct ieee80211_sub_if_data *sdata),
625 TP_ARGS(local, sdata)
607); 626);
608 627
609TRACE_EVENT(drv_get_stats, 628TRACE_EVENT(drv_get_stats,
diff --git a/net/mac80211/tx.c b/net/mac80211/tx.c
index 0cb41d1a1f20..66ddbbeccd20 100644
--- a/net/mac80211/tx.c
+++ b/net/mac80211/tx.c
@@ -2961,19 +2961,16 @@ struct sk_buff *ieee80211_nullfunc_get(struct ieee80211_hw *hw,
2961EXPORT_SYMBOL(ieee80211_nullfunc_get); 2961EXPORT_SYMBOL(ieee80211_nullfunc_get);
2962 2962
2963struct sk_buff *ieee80211_probereq_get(struct ieee80211_hw *hw, 2963struct sk_buff *ieee80211_probereq_get(struct ieee80211_hw *hw,
2964 struct ieee80211_vif *vif, 2964 const u8 *src_addr,
2965 const u8 *ssid, size_t ssid_len, 2965 const u8 *ssid, size_t ssid_len,
2966 size_t tailroom) 2966 size_t tailroom)
2967{ 2967{
2968 struct ieee80211_sub_if_data *sdata; 2968 struct ieee80211_local *local = hw_to_local(hw);
2969 struct ieee80211_local *local;
2970 struct ieee80211_hdr_3addr *hdr; 2969 struct ieee80211_hdr_3addr *hdr;
2971 struct sk_buff *skb; 2970 struct sk_buff *skb;
2972 size_t ie_ssid_len; 2971 size_t ie_ssid_len;
2973 u8 *pos; 2972 u8 *pos;
2974 2973
2975 sdata = vif_to_sdata(vif);
2976 local = sdata->local;
2977 ie_ssid_len = 2 + ssid_len; 2974 ie_ssid_len = 2 + ssid_len;
2978 2975
2979 skb = dev_alloc_skb(local->hw.extra_tx_headroom + sizeof(*hdr) + 2976 skb = dev_alloc_skb(local->hw.extra_tx_headroom + sizeof(*hdr) +
@@ -2988,7 +2985,7 @@ struct sk_buff *ieee80211_probereq_get(struct ieee80211_hw *hw,
2988 hdr->frame_control = cpu_to_le16(IEEE80211_FTYPE_MGMT | 2985 hdr->frame_control = cpu_to_le16(IEEE80211_FTYPE_MGMT |
2989 IEEE80211_STYPE_PROBE_REQ); 2986 IEEE80211_STYPE_PROBE_REQ);
2990 eth_broadcast_addr(hdr->addr1); 2987 eth_broadcast_addr(hdr->addr1);
2991 memcpy(hdr->addr2, vif->addr, ETH_ALEN); 2988 memcpy(hdr->addr2, src_addr, ETH_ALEN);
2992 eth_broadcast_addr(hdr->addr3); 2989 eth_broadcast_addr(hdr->addr3);
2993 2990
2994 pos = skb_put(skb, ie_ssid_len); 2991 pos = skb_put(skb, ie_ssid_len);
diff --git a/net/mac80211/util.c b/net/mac80211/util.c
index 0ad534abc008..bb9664cb8831 100644
--- a/net/mac80211/util.c
+++ b/net/mac80211/util.c
@@ -1523,7 +1523,8 @@ int ieee80211_build_preq_ies(struct ieee80211_local *local, u8 *buffer,
1523}; 1523};
1524 1524
1525struct sk_buff *ieee80211_build_probe_req(struct ieee80211_sub_if_data *sdata, 1525struct sk_buff *ieee80211_build_probe_req(struct ieee80211_sub_if_data *sdata,
1526 u8 *dst, u32 ratemask, 1526 const u8 *src, const u8 *dst,
1527 u32 ratemask,
1527 struct ieee80211_channel *chan, 1528 struct ieee80211_channel *chan,
1528 const u8 *ssid, size_t ssid_len, 1529 const u8 *ssid, size_t ssid_len,
1529 const u8 *ie, size_t ie_len, 1530 const u8 *ie, size_t ie_len,
@@ -1548,8 +1549,8 @@ struct sk_buff *ieee80211_build_probe_req(struct ieee80211_sub_if_data *sdata,
1548 else 1549 else
1549 chandef.chan = chan; 1550 chandef.chan = chan;
1550 1551
1551 skb = ieee80211_probereq_get(&local->hw, &sdata->vif, 1552 skb = ieee80211_probereq_get(&local->hw, src, ssid, ssid_len,
1552 ssid, ssid_len, 100 + ie_len); 1553 100 + ie_len);
1553 if (!skb) 1554 if (!skb)
1554 return NULL; 1555 return NULL;
1555 1556
@@ -1571,7 +1572,8 @@ struct sk_buff *ieee80211_build_probe_req(struct ieee80211_sub_if_data *sdata,
1571 return skb; 1572 return skb;
1572} 1573}
1573 1574
1574void ieee80211_send_probe_req(struct ieee80211_sub_if_data *sdata, u8 *dst, 1575void ieee80211_send_probe_req(struct ieee80211_sub_if_data *sdata,
1576 const u8 *src, const u8 *dst,
1575 const u8 *ssid, size_t ssid_len, 1577 const u8 *ssid, size_t ssid_len,
1576 const u8 *ie, size_t ie_len, 1578 const u8 *ie, size_t ie_len,
1577 u32 ratemask, bool directed, u32 tx_flags, 1579 u32 ratemask, bool directed, u32 tx_flags,
@@ -1579,7 +1581,7 @@ void ieee80211_send_probe_req(struct ieee80211_sub_if_data *sdata, u8 *dst,
1579{ 1581{
1580 struct sk_buff *skb; 1582 struct sk_buff *skb;
1581 1583
1582 skb = ieee80211_build_probe_req(sdata, dst, ratemask, channel, 1584 skb = ieee80211_build_probe_req(sdata, src, dst, ratemask, channel,
1583 ssid, ssid_len, 1585 ssid, ssid_len,
1584 ie, ie_len, directed); 1586 ie, ie_len, directed);
1585 if (skb) { 1587 if (skb) {