aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJouni Malinen <jouni.malinen@atheros.com>2011-05-16 12:40:15 -0400
committerJohn W. Linville <linville@tuxdriver.com>2011-05-19 10:37:18 -0400
commited9d01026f156db2d638cbb045231c7a8fde877d (patch)
tree0c99c25b87973112db1b8464e5ad429cd943786f
parent79d2b1570bcc31b846ccb2114a34e98ca87bf1d9 (diff)
cfg80211: Use consistent BSS matching between scan and sme
cfg80211 scan code adds separate BSS entries if the same BSS shows up on multiple channels. However, sme implementation does not use the frequency when fetching the BSS entry. Fix this by adding channel information to cfg80211_roamed() and include it in cfg80211_get_bss() calls. Please note that drivers using cfg80211_roamed() need to be modified to fully implement this fix. This commit includes only minimal changes to avoid compilation issues; it maintains the old (broken) behavior for most drivers. ath6kl was the only one that I could test, so I updated it to provide the operating frequency in the roamed event. Signed-off-by: Jouni Malinen <jouni.malinen@atheros.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
-rw-r--r--drivers/net/wireless/iwmc3200wifi/rx.c4
-rw-r--r--drivers/net/wireless/rndis_wlan.c3
-rw-r--r--drivers/staging/ath6kl/os/linux/cfg80211.c2
-rw-r--r--drivers/staging/brcm80211/brcmfmac/wl_cfg80211.c4
-rw-r--r--drivers/staging/wlan-ng/cfg80211.c2
-rw-r--r--include/net/cfg80211.h5
-rw-r--r--net/wireless/core.h5
-rw-r--r--net/wireless/sme.c19
-rw-r--r--net/wireless/util.c2
9 files changed, 31 insertions, 15 deletions
diff --git a/drivers/net/wireless/iwmc3200wifi/rx.c b/drivers/net/wireless/iwmc3200wifi/rx.c
index 5665a1a9b99e..a414768f40f1 100644
--- a/drivers/net/wireless/iwmc3200wifi/rx.c
+++ b/drivers/net/wireless/iwmc3200wifi/rx.c
@@ -565,7 +565,7 @@ static int iwm_mlme_assoc_complete(struct iwm_priv *iwm, u8 *buf,
565 if (!test_and_clear_bit(IWM_STATUS_SME_CONNECTING, &iwm->status) 565 if (!test_and_clear_bit(IWM_STATUS_SME_CONNECTING, &iwm->status)
566 && iwm->conf.mode == UMAC_MODE_BSS) { 566 && iwm->conf.mode == UMAC_MODE_BSS) {
567 cancel_delayed_work(&iwm->disconnect); 567 cancel_delayed_work(&iwm->disconnect);
568 cfg80211_roamed(iwm_to_ndev(iwm), 568 cfg80211_roamed(iwm_to_ndev(iwm), NULL,
569 complete->bssid, 569 complete->bssid,
570 iwm->req_ie, iwm->req_ie_len, 570 iwm->req_ie, iwm->req_ie_len,
571 iwm->resp_ie, iwm->resp_ie_len, 571 iwm->resp_ie, iwm->resp_ie_len,
@@ -586,7 +586,7 @@ static int iwm_mlme_assoc_complete(struct iwm_priv *iwm, u8 *buf,
586 WLAN_STATUS_SUCCESS, 586 WLAN_STATUS_SUCCESS,
587 GFP_KERNEL); 587 GFP_KERNEL);
588 else 588 else
589 cfg80211_roamed(iwm_to_ndev(iwm), 589 cfg80211_roamed(iwm_to_ndev(iwm), NULL,
590 complete->bssid, 590 complete->bssid,
591 iwm->req_ie, iwm->req_ie_len, 591 iwm->req_ie, iwm->req_ie_len,
592 iwm->resp_ie, iwm->resp_ie_len, 592 iwm->resp_ie, iwm->resp_ie_len,
diff --git a/drivers/net/wireless/rndis_wlan.c b/drivers/net/wireless/rndis_wlan.c
index 518542b4bf9e..29f938930667 100644
--- a/drivers/net/wireless/rndis_wlan.c
+++ b/drivers/net/wireless/rndis_wlan.c
@@ -2830,7 +2830,8 @@ static void rndis_wlan_do_link_up_work(struct usbnet *usbdev)
2830 req_ie_len, resp_ie, 2830 req_ie_len, resp_ie,
2831 resp_ie_len, 0, GFP_KERNEL); 2831 resp_ie_len, 0, GFP_KERNEL);
2832 else 2832 else
2833 cfg80211_roamed(usbdev->net, bssid, req_ie, req_ie_len, 2833 cfg80211_roamed(usbdev->net, NULL, bssid,
2834 req_ie, req_ie_len,
2834 resp_ie, resp_ie_len, GFP_KERNEL); 2835 resp_ie, resp_ie_len, GFP_KERNEL);
2835 } else if (priv->infra_mode == NDIS_80211_INFRA_ADHOC) 2836 } else if (priv->infra_mode == NDIS_80211_INFRA_ADHOC)
2836 cfg80211_ibss_joined(usbdev->net, bssid, GFP_KERNEL); 2837 cfg80211_ibss_joined(usbdev->net, bssid, GFP_KERNEL);
diff --git a/drivers/staging/ath6kl/os/linux/cfg80211.c b/drivers/staging/ath6kl/os/linux/cfg80211.c
index bcca39418f90..5bda24e26c0e 100644
--- a/drivers/staging/ath6kl/os/linux/cfg80211.c
+++ b/drivers/staging/ath6kl/os/linux/cfg80211.c
@@ -570,7 +570,7 @@ ar6k_cfg80211_connect_event(struct ar6_softc *ar, u16 channel,
570 WLAN_STATUS_SUCCESS, GFP_KERNEL); 570 WLAN_STATUS_SUCCESS, GFP_KERNEL);
571 } else { 571 } else {
572 /* inform roam event to cfg80211 */ 572 /* inform roam event to cfg80211 */
573 cfg80211_roamed(ar->arNetDev, bssid, 573 cfg80211_roamed(ar->arNetDev, ibss_channel, bssid,
574 assocReqIe, assocReqLen, 574 assocReqIe, assocReqLen,
575 assocRespIe, assocRespLen, 575 assocRespIe, assocRespLen,
576 GFP_KERNEL); 576 GFP_KERNEL);
diff --git a/drivers/staging/brcm80211/brcmfmac/wl_cfg80211.c b/drivers/staging/brcm80211/brcmfmac/wl_cfg80211.c
index 555b056b49b1..7aaf99cc3a7b 100644
--- a/drivers/staging/brcm80211/brcmfmac/wl_cfg80211.c
+++ b/drivers/staging/brcm80211/brcmfmac/wl_cfg80211.c
@@ -2630,7 +2630,7 @@ wl_bss_roaming_done(struct wl_priv *wl, struct net_device *ndev,
2630 wl_get_assoc_ies(wl); 2630 wl_get_assoc_ies(wl);
2631 memcpy(&wl->bssid, &e->addr, ETH_ALEN); 2631 memcpy(&wl->bssid, &e->addr, ETH_ALEN);
2632 wl_update_bss_info(wl); 2632 wl_update_bss_info(wl);
2633 cfg80211_roamed(ndev, 2633 cfg80211_roamed(ndev, NULL,
2634 (u8 *)&wl->bssid, 2634 (u8 *)&wl->bssid,
2635 conn_info->req_ie, conn_info->req_ie_len, 2635 conn_info->req_ie, conn_info->req_ie_len,
2636 conn_info->resp_ie, conn_info->resp_ie_len, GFP_KERNEL); 2636 conn_info->resp_ie, conn_info->resp_ie_len, GFP_KERNEL);
@@ -2663,7 +2663,7 @@ wl_bss_connect_done(struct wl_priv *wl, struct net_device *ndev,
2663 WL_DBG("Report connect result - connection %s\n", 2663 WL_DBG("Report connect result - connection %s\n",
2664 completed ? "succeeded" : "failed"); 2664 completed ? "succeeded" : "failed");
2665 } else { 2665 } else {
2666 cfg80211_roamed(ndev, 2666 cfg80211_roamed(ndev, NULL,
2667 (u8 *)&wl->bssid, 2667 (u8 *)&wl->bssid,
2668 conn_info->req_ie, conn_info->req_ie_len, 2668 conn_info->req_ie, conn_info->req_ie_len,
2669 conn_info->resp_ie, conn_info->resp_ie_len, 2669 conn_info->resp_ie, conn_info->resp_ie_len,
diff --git a/drivers/staging/wlan-ng/cfg80211.c b/drivers/staging/wlan-ng/cfg80211.c
index 6a71f52c59b1..473438893a11 100644
--- a/drivers/staging/wlan-ng/cfg80211.c
+++ b/drivers/staging/wlan-ng/cfg80211.c
@@ -695,7 +695,7 @@ void prism2_disconnected(wlandevice_t *wlandev)
695 695
696void prism2_roamed(wlandevice_t *wlandev) 696void prism2_roamed(wlandevice_t *wlandev)
697{ 697{
698 cfg80211_roamed(wlandev->netdev, wlandev->bssid, 698 cfg80211_roamed(wlandev->netdev, NULL, wlandev->bssid,
699 NULL, 0, NULL, 0, GFP_KERNEL); 699 NULL, 0, NULL, 0, GFP_KERNEL);
700} 700}
701 701
diff --git a/include/net/cfg80211.h b/include/net/cfg80211.h
index bfd6557946be..727131b67421 100644
--- a/include/net/cfg80211.h
+++ b/include/net/cfg80211.h
@@ -2878,6 +2878,7 @@ void cfg80211_connect_result(struct net_device *dev, const u8 *bssid,
2878 * cfg80211_roamed - notify cfg80211 of roaming 2878 * cfg80211_roamed - notify cfg80211 of roaming
2879 * 2879 *
2880 * @dev: network device 2880 * @dev: network device
2881 * @channel: the channel of the new AP
2881 * @bssid: the BSSID of the new AP 2882 * @bssid: the BSSID of the new AP
2882 * @req_ie: association request IEs (maybe be %NULL) 2883 * @req_ie: association request IEs (maybe be %NULL)
2883 * @req_ie_len: association request IEs length 2884 * @req_ie_len: association request IEs length
@@ -2888,7 +2889,9 @@ void cfg80211_connect_result(struct net_device *dev, const u8 *bssid,
2888 * It should be called by the underlying driver whenever it roamed 2889 * It should be called by the underlying driver whenever it roamed
2889 * from one AP to another while connected. 2890 * from one AP to another while connected.
2890 */ 2891 */
2891void cfg80211_roamed(struct net_device *dev, const u8 *bssid, 2892void cfg80211_roamed(struct net_device *dev,
2893 struct ieee80211_channel *channel,
2894 const u8 *bssid,
2892 const u8 *req_ie, size_t req_ie_len, 2895 const u8 *req_ie, size_t req_ie_len,
2893 const u8 *resp_ie, size_t resp_ie_len, gfp_t gfp); 2896 const u8 *resp_ie, size_t resp_ie_len, gfp_t gfp);
2894 2897
diff --git a/net/wireless/core.h b/net/wireless/core.h
index bf0fb40e3c8b..3dce1f167eba 100644
--- a/net/wireless/core.h
+++ b/net/wireless/core.h
@@ -245,6 +245,7 @@ struct cfg80211_event {
245 u16 status; 245 u16 status;
246 } cr; 246 } cr;
247 struct { 247 struct {
248 struct ieee80211_channel *channel;
248 u8 bssid[ETH_ALEN]; 249 u8 bssid[ETH_ALEN];
249 const u8 *req_ie; 250 const u8 *req_ie;
250 const u8 *resp_ie; 251 const u8 *resp_ie;
@@ -392,7 +393,9 @@ int __cfg80211_disconnect(struct cfg80211_registered_device *rdev,
392int cfg80211_disconnect(struct cfg80211_registered_device *rdev, 393int cfg80211_disconnect(struct cfg80211_registered_device *rdev,
393 struct net_device *dev, u16 reason, 394 struct net_device *dev, u16 reason,
394 bool wextev); 395 bool wextev);
395void __cfg80211_roamed(struct wireless_dev *wdev, const u8 *bssid, 396void __cfg80211_roamed(struct wireless_dev *wdev,
397 struct ieee80211_channel *channel,
398 const u8 *bssid,
396 const u8 *req_ie, size_t req_ie_len, 399 const u8 *req_ie, size_t req_ie_len,
397 const u8 *resp_ie, size_t resp_ie_len); 400 const u8 *resp_ie, size_t resp_ie_len);
398int cfg80211_mgd_wext_connect(struct cfg80211_registered_device *rdev, 401int cfg80211_mgd_wext_connect(struct cfg80211_registered_device *rdev,
diff --git a/net/wireless/sme.c b/net/wireless/sme.c
index e17b0bee6bdc..b7b6ff8be553 100644
--- a/net/wireless/sme.c
+++ b/net/wireless/sme.c
@@ -250,7 +250,8 @@ static struct cfg80211_bss *cfg80211_get_conn_bss(struct wireless_dev *wdev)
250 if (wdev->conn->params.privacy) 250 if (wdev->conn->params.privacy)
251 capa |= WLAN_CAPABILITY_PRIVACY; 251 capa |= WLAN_CAPABILITY_PRIVACY;
252 252
253 bss = cfg80211_get_bss(wdev->wiphy, NULL, wdev->conn->params.bssid, 253 bss = cfg80211_get_bss(wdev->wiphy, wdev->conn->params.channel,
254 wdev->conn->params.bssid,
254 wdev->conn->params.ssid, 255 wdev->conn->params.ssid,
255 wdev->conn->params.ssid_len, 256 wdev->conn->params.ssid_len,
256 WLAN_CAPABILITY_ESS | WLAN_CAPABILITY_PRIVACY, 257 WLAN_CAPABILITY_ESS | WLAN_CAPABILITY_PRIVACY,
@@ -470,7 +471,10 @@ void __cfg80211_connect_result(struct net_device *dev, const u8 *bssid,
470 } 471 }
471 472
472 if (!bss) 473 if (!bss)
473 bss = cfg80211_get_bss(wdev->wiphy, NULL, bssid, 474 bss = cfg80211_get_bss(wdev->wiphy,
475 wdev->conn ? wdev->conn->params.channel :
476 NULL,
477 bssid,
474 wdev->ssid, wdev->ssid_len, 478 wdev->ssid, wdev->ssid_len,
475 WLAN_CAPABILITY_ESS, 479 WLAN_CAPABILITY_ESS,
476 WLAN_CAPABILITY_ESS); 480 WLAN_CAPABILITY_ESS);
@@ -538,7 +542,9 @@ void cfg80211_connect_result(struct net_device *dev, const u8 *bssid,
538} 542}
539EXPORT_SYMBOL(cfg80211_connect_result); 543EXPORT_SYMBOL(cfg80211_connect_result);
540 544
541void __cfg80211_roamed(struct wireless_dev *wdev, const u8 *bssid, 545void __cfg80211_roamed(struct wireless_dev *wdev,
546 struct ieee80211_channel *channel,
547 const u8 *bssid,
542 const u8 *req_ie, size_t req_ie_len, 548 const u8 *req_ie, size_t req_ie_len,
543 const u8 *resp_ie, size_t resp_ie_len) 549 const u8 *resp_ie, size_t resp_ie_len)
544{ 550{
@@ -565,7 +571,7 @@ void __cfg80211_roamed(struct wireless_dev *wdev, const u8 *bssid,
565 cfg80211_put_bss(&wdev->current_bss->pub); 571 cfg80211_put_bss(&wdev->current_bss->pub);
566 wdev->current_bss = NULL; 572 wdev->current_bss = NULL;
567 573
568 bss = cfg80211_get_bss(wdev->wiphy, NULL, bssid, 574 bss = cfg80211_get_bss(wdev->wiphy, channel, bssid,
569 wdev->ssid, wdev->ssid_len, 575 wdev->ssid, wdev->ssid_len,
570 WLAN_CAPABILITY_ESS, WLAN_CAPABILITY_ESS); 576 WLAN_CAPABILITY_ESS, WLAN_CAPABILITY_ESS);
571 577
@@ -603,7 +609,9 @@ void __cfg80211_roamed(struct wireless_dev *wdev, const u8 *bssid,
603#endif 609#endif
604} 610}
605 611
606void cfg80211_roamed(struct net_device *dev, const u8 *bssid, 612void cfg80211_roamed(struct net_device *dev,
613 struct ieee80211_channel *channel,
614 const u8 *bssid,
607 const u8 *req_ie, size_t req_ie_len, 615 const u8 *req_ie, size_t req_ie_len,
608 const u8 *resp_ie, size_t resp_ie_len, gfp_t gfp) 616 const u8 *resp_ie, size_t resp_ie_len, gfp_t gfp)
609{ 617{
@@ -619,6 +627,7 @@ void cfg80211_roamed(struct net_device *dev, const u8 *bssid,
619 return; 627 return;
620 628
621 ev->type = EVENT_ROAMED; 629 ev->type = EVENT_ROAMED;
630 ev->rm.channel = channel;
622 memcpy(ev->rm.bssid, bssid, ETH_ALEN); 631 memcpy(ev->rm.bssid, bssid, ETH_ALEN);
623 ev->rm.req_ie = ((u8 *)ev) + sizeof(*ev); 632 ev->rm.req_ie = ((u8 *)ev) + sizeof(*ev);
624 ev->rm.req_ie_len = req_ie_len; 633 ev->rm.req_ie_len = req_ie_len;
diff --git a/net/wireless/util.c b/net/wireless/util.c
index f0536d44d43c..4d7b83fbc32f 100644
--- a/net/wireless/util.c
+++ b/net/wireless/util.c
@@ -746,7 +746,7 @@ static void cfg80211_process_wdev_events(struct wireless_dev *wdev)
746 NULL); 746 NULL);
747 break; 747 break;
748 case EVENT_ROAMED: 748 case EVENT_ROAMED:
749 __cfg80211_roamed(wdev, ev->rm.bssid, 749 __cfg80211_roamed(wdev, ev->rm.channel, ev->rm.bssid,
750 ev->rm.req_ie, ev->rm.req_ie_len, 750 ev->rm.req_ie, ev->rm.req_ie_len,
751 ev->rm.resp_ie, ev->rm.resp_ie_len); 751 ev->rm.resp_ie, ev->rm.resp_ie_len);
752 break; 752 break;