Skip to content

Commit ed9d010

Browse files
Jouni Malinenlinvjw
authored andcommitted
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 <[email protected]> Signed-off-by: John W. Linville <[email protected]>
1 parent 79d2b15 commit ed9d010

File tree

9 files changed

+31
-15
lines changed

9 files changed

+31
-15
lines changed

drivers/net/wireless/iwmc3200wifi/rx.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -565,7 +565,7 @@ static int iwm_mlme_assoc_complete(struct iwm_priv *iwm, u8 *buf,
565565
if (!test_and_clear_bit(IWM_STATUS_SME_CONNECTING, &iwm->status)
566566
&& iwm->conf.mode == UMAC_MODE_BSS) {
567567
cancel_delayed_work(&iwm->disconnect);
568-
cfg80211_roamed(iwm_to_ndev(iwm),
568+
cfg80211_roamed(iwm_to_ndev(iwm), NULL,
569569
complete->bssid,
570570
iwm->req_ie, iwm->req_ie_len,
571571
iwm->resp_ie, iwm->resp_ie_len,
@@ -586,7 +586,7 @@ static int iwm_mlme_assoc_complete(struct iwm_priv *iwm, u8 *buf,
586586
WLAN_STATUS_SUCCESS,
587587
GFP_KERNEL);
588588
else
589-
cfg80211_roamed(iwm_to_ndev(iwm),
589+
cfg80211_roamed(iwm_to_ndev(iwm), NULL,
590590
complete->bssid,
591591
iwm->req_ie, iwm->req_ie_len,
592592
iwm->resp_ie, iwm->resp_ie_len,

drivers/net/wireless/rndis_wlan.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2830,7 +2830,8 @@ static void rndis_wlan_do_link_up_work(struct usbnet *usbdev)
28302830
req_ie_len, resp_ie,
28312831
resp_ie_len, 0, GFP_KERNEL);
28322832
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,
28342835
resp_ie, resp_ie_len, GFP_KERNEL);
28352836
} else if (priv->infra_mode == NDIS_80211_INFRA_ADHOC)
28362837
cfg80211_ibss_joined(usbdev->net, bssid, GFP_KERNEL);

drivers/staging/ath6kl/os/linux/cfg80211.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -570,7 +570,7 @@ ar6k_cfg80211_connect_event(struct ar6_softc *ar, u16 channel,
570570
WLAN_STATUS_SUCCESS, GFP_KERNEL);
571571
} else {
572572
/* inform roam event to cfg80211 */
573-
cfg80211_roamed(ar->arNetDev, bssid,
573+
cfg80211_roamed(ar->arNetDev, ibss_channel, bssid,
574574
assocReqIe, assocReqLen,
575575
assocRespIe, assocRespLen,
576576
GFP_KERNEL);

drivers/staging/brcm80211/brcmfmac/wl_cfg80211.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2630,7 +2630,7 @@ wl_bss_roaming_done(struct wl_priv *wl, struct net_device *ndev,
26302630
wl_get_assoc_ies(wl);
26312631
memcpy(&wl->bssid, &e->addr, ETH_ALEN);
26322632
wl_update_bss_info(wl);
2633-
cfg80211_roamed(ndev,
2633+
cfg80211_roamed(ndev, NULL,
26342634
(u8 *)&wl->bssid,
26352635
conn_info->req_ie, conn_info->req_ie_len,
26362636
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,
26632663
WL_DBG("Report connect result - connection %s\n",
26642664
completed ? "succeeded" : "failed");
26652665
} else {
2666-
cfg80211_roamed(ndev,
2666+
cfg80211_roamed(ndev, NULL,
26672667
(u8 *)&wl->bssid,
26682668
conn_info->req_ie, conn_info->req_ie_len,
26692669
conn_info->resp_ie, conn_info->resp_ie_len,

drivers/staging/wlan-ng/cfg80211.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -695,7 +695,7 @@ void prism2_disconnected(wlandevice_t *wlandev)
695695

696696
void prism2_roamed(wlandevice_t *wlandev)
697697
{
698-
cfg80211_roamed(wlandev->netdev, wlandev->bssid,
698+
cfg80211_roamed(wlandev->netdev, NULL, wlandev->bssid,
699699
NULL, 0, NULL, 0, GFP_KERNEL);
700700
}
701701

include/net/cfg80211.h

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2878,6 +2878,7 @@ void cfg80211_connect_result(struct net_device *dev, const u8 *bssid,
28782878
* cfg80211_roamed - notify cfg80211 of roaming
28792879
*
28802880
* @dev: network device
2881+
* @channel: the channel of the new AP
28812882
* @bssid: the BSSID of the new AP
28822883
* @req_ie: association request IEs (maybe be %NULL)
28832884
* @req_ie_len: association request IEs length
@@ -2888,7 +2889,9 @@ void cfg80211_connect_result(struct net_device *dev, const u8 *bssid,
28882889
* It should be called by the underlying driver whenever it roamed
28892890
* from one AP to another while connected.
28902891
*/
2891-
void cfg80211_roamed(struct net_device *dev, const u8 *bssid,
2892+
void cfg80211_roamed(struct net_device *dev,
2893+
struct ieee80211_channel *channel,
2894+
const u8 *bssid,
28922895
const u8 *req_ie, size_t req_ie_len,
28932896
const u8 *resp_ie, size_t resp_ie_len, gfp_t gfp);
28942897

net/wireless/core.h

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -245,6 +245,7 @@ struct cfg80211_event {
245245
u16 status;
246246
} cr;
247247
struct {
248+
struct ieee80211_channel *channel;
248249
u8 bssid[ETH_ALEN];
249250
const u8 *req_ie;
250251
const u8 *resp_ie;
@@ -392,7 +393,9 @@ int __cfg80211_disconnect(struct cfg80211_registered_device *rdev,
392393
int cfg80211_disconnect(struct cfg80211_registered_device *rdev,
393394
struct net_device *dev, u16 reason,
394395
bool wextev);
395-
void __cfg80211_roamed(struct wireless_dev *wdev, const u8 *bssid,
396+
void __cfg80211_roamed(struct wireless_dev *wdev,
397+
struct ieee80211_channel *channel,
398+
const u8 *bssid,
396399
const u8 *req_ie, size_t req_ie_len,
397400
const u8 *resp_ie, size_t resp_ie_len);
398401
int cfg80211_mgd_wext_connect(struct cfg80211_registered_device *rdev,

net/wireless/sme.c

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -250,7 +250,8 @@ static struct cfg80211_bss *cfg80211_get_conn_bss(struct wireless_dev *wdev)
250250
if (wdev->conn->params.privacy)
251251
capa |= WLAN_CAPABILITY_PRIVACY;
252252

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,
254255
wdev->conn->params.ssid,
255256
wdev->conn->params.ssid_len,
256257
WLAN_CAPABILITY_ESS | WLAN_CAPABILITY_PRIVACY,
@@ -470,7 +471,10 @@ void __cfg80211_connect_result(struct net_device *dev, const u8 *bssid,
470471
}
471472

472473
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,
474478
wdev->ssid, wdev->ssid_len,
475479
WLAN_CAPABILITY_ESS,
476480
WLAN_CAPABILITY_ESS);
@@ -538,7 +542,9 @@ void cfg80211_connect_result(struct net_device *dev, const u8 *bssid,
538542
}
539543
EXPORT_SYMBOL(cfg80211_connect_result);
540544

541-
void __cfg80211_roamed(struct wireless_dev *wdev, const u8 *bssid,
545+
void __cfg80211_roamed(struct wireless_dev *wdev,
546+
struct ieee80211_channel *channel,
547+
const u8 *bssid,
542548
const u8 *req_ie, size_t req_ie_len,
543549
const u8 *resp_ie, size_t resp_ie_len)
544550
{
@@ -565,7 +571,7 @@ void __cfg80211_roamed(struct wireless_dev *wdev, const u8 *bssid,
565571
cfg80211_put_bss(&wdev->current_bss->pub);
566572
wdev->current_bss = NULL;
567573

568-
bss = cfg80211_get_bss(wdev->wiphy, NULL, bssid,
574+
bss = cfg80211_get_bss(wdev->wiphy, channel, bssid,
569575
wdev->ssid, wdev->ssid_len,
570576
WLAN_CAPABILITY_ESS, WLAN_CAPABILITY_ESS);
571577

@@ -603,7 +609,9 @@ void __cfg80211_roamed(struct wireless_dev *wdev, const u8 *bssid,
603609
#endif
604610
}
605611

606-
void cfg80211_roamed(struct net_device *dev, const u8 *bssid,
612+
void cfg80211_roamed(struct net_device *dev,
613+
struct ieee80211_channel *channel,
614+
const u8 *bssid,
607615
const u8 *req_ie, size_t req_ie_len,
608616
const u8 *resp_ie, size_t resp_ie_len, gfp_t gfp)
609617
{
@@ -619,6 +627,7 @@ void cfg80211_roamed(struct net_device *dev, const u8 *bssid,
619627
return;
620628

621629
ev->type = EVENT_ROAMED;
630+
ev->rm.channel = channel;
622631
memcpy(ev->rm.bssid, bssid, ETH_ALEN);
623632
ev->rm.req_ie = ((u8 *)ev) + sizeof(*ev);
624633
ev->rm.req_ie_len = req_ie_len;

net/wireless/util.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -746,7 +746,7 @@ static void cfg80211_process_wdev_events(struct wireless_dev *wdev)
746746
NULL);
747747
break;
748748
case EVENT_ROAMED:
749-
__cfg80211_roamed(wdev, ev->rm.bssid,
749+
__cfg80211_roamed(wdev, ev->rm.channel, ev->rm.bssid,
750750
ev->rm.req_ie, ev->rm.req_ie_len,
751751
ev->rm.resp_ie, ev->rm.resp_ie_len);
752752
break;

0 commit comments

Comments
 (0)