Commit ed9d0102 authored by Jouni Malinen's avatar Jouni Malinen Committed by John W. Linville

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: default avatarJouni Malinen <jouni.malinen@atheros.com>
Signed-off-by: default avatarJohn W. Linville <linville@tuxdriver.com>
parent 79d2b157
...@@ -565,7 +565,7 @@ static int iwm_mlme_assoc_complete(struct iwm_priv *iwm, u8 *buf, ...@@ -565,7 +565,7 @@ static int iwm_mlme_assoc_complete(struct iwm_priv *iwm, u8 *buf,
if (!test_and_clear_bit(IWM_STATUS_SME_CONNECTING, &iwm->status) if (!test_and_clear_bit(IWM_STATUS_SME_CONNECTING, &iwm->status)
&& iwm->conf.mode == UMAC_MODE_BSS) { && iwm->conf.mode == UMAC_MODE_BSS) {
cancel_delayed_work(&iwm->disconnect); cancel_delayed_work(&iwm->disconnect);
cfg80211_roamed(iwm_to_ndev(iwm), cfg80211_roamed(iwm_to_ndev(iwm), NULL,
complete->bssid, complete->bssid,
iwm->req_ie, iwm->req_ie_len, iwm->req_ie, iwm->req_ie_len,
iwm->resp_ie, iwm->resp_ie_len, iwm->resp_ie, iwm->resp_ie_len,
...@@ -586,7 +586,7 @@ static int iwm_mlme_assoc_complete(struct iwm_priv *iwm, u8 *buf, ...@@ -586,7 +586,7 @@ static int iwm_mlme_assoc_complete(struct iwm_priv *iwm, u8 *buf,
WLAN_STATUS_SUCCESS, WLAN_STATUS_SUCCESS,
GFP_KERNEL); GFP_KERNEL);
else else
cfg80211_roamed(iwm_to_ndev(iwm), cfg80211_roamed(iwm_to_ndev(iwm), NULL,
complete->bssid, complete->bssid,
iwm->req_ie, iwm->req_ie_len, iwm->req_ie, iwm->req_ie_len,
iwm->resp_ie, iwm->resp_ie_len, iwm->resp_ie, iwm->resp_ie_len,
......
...@@ -2830,7 +2830,8 @@ static void rndis_wlan_do_link_up_work(struct usbnet *usbdev) ...@@ -2830,7 +2830,8 @@ static void rndis_wlan_do_link_up_work(struct usbnet *usbdev)
req_ie_len, resp_ie, req_ie_len, resp_ie,
resp_ie_len, 0, GFP_KERNEL); resp_ie_len, 0, GFP_KERNEL);
else else
cfg80211_roamed(usbdev->net, bssid, req_ie, req_ie_len, cfg80211_roamed(usbdev->net, NULL, bssid,
req_ie, req_ie_len,
resp_ie, resp_ie_len, GFP_KERNEL); resp_ie, resp_ie_len, GFP_KERNEL);
} else if (priv->infra_mode == NDIS_80211_INFRA_ADHOC) } else if (priv->infra_mode == NDIS_80211_INFRA_ADHOC)
cfg80211_ibss_joined(usbdev->net, bssid, GFP_KERNEL); cfg80211_ibss_joined(usbdev->net, bssid, GFP_KERNEL);
......
...@@ -570,7 +570,7 @@ ar6k_cfg80211_connect_event(struct ar6_softc *ar, u16 channel, ...@@ -570,7 +570,7 @@ ar6k_cfg80211_connect_event(struct ar6_softc *ar, u16 channel,
WLAN_STATUS_SUCCESS, GFP_KERNEL); WLAN_STATUS_SUCCESS, GFP_KERNEL);
} else { } else {
/* inform roam event to cfg80211 */ /* inform roam event to cfg80211 */
cfg80211_roamed(ar->arNetDev, bssid, cfg80211_roamed(ar->arNetDev, ibss_channel, bssid,
assocReqIe, assocReqLen, assocReqIe, assocReqLen,
assocRespIe, assocRespLen, assocRespIe, assocRespLen,
GFP_KERNEL); GFP_KERNEL);
......
...@@ -2630,7 +2630,7 @@ wl_bss_roaming_done(struct wl_priv *wl, struct net_device *ndev, ...@@ -2630,7 +2630,7 @@ wl_bss_roaming_done(struct wl_priv *wl, struct net_device *ndev,
wl_get_assoc_ies(wl); wl_get_assoc_ies(wl);
memcpy(&wl->bssid, &e->addr, ETH_ALEN); memcpy(&wl->bssid, &e->addr, ETH_ALEN);
wl_update_bss_info(wl); wl_update_bss_info(wl);
cfg80211_roamed(ndev, cfg80211_roamed(ndev, NULL,
(u8 *)&wl->bssid, (u8 *)&wl->bssid,
conn_info->req_ie, conn_info->req_ie_len, conn_info->req_ie, conn_info->req_ie_len,
conn_info->resp_ie, conn_info->resp_ie_len, GFP_KERNEL); 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,7 +2663,7 @@ wl_bss_connect_done(struct wl_priv *wl, struct net_device *ndev,
WL_DBG("Report connect result - connection %s\n", WL_DBG("Report connect result - connection %s\n",
completed ? "succeeded" : "failed"); completed ? "succeeded" : "failed");
} else { } else {
cfg80211_roamed(ndev, cfg80211_roamed(ndev, NULL,
(u8 *)&wl->bssid, (u8 *)&wl->bssid,
conn_info->req_ie, conn_info->req_ie_len, conn_info->req_ie, conn_info->req_ie_len,
conn_info->resp_ie, conn_info->resp_ie_len, conn_info->resp_ie, conn_info->resp_ie_len,
......
...@@ -695,7 +695,7 @@ void prism2_disconnected(wlandevice_t *wlandev) ...@@ -695,7 +695,7 @@ void prism2_disconnected(wlandevice_t *wlandev)
void prism2_roamed(wlandevice_t *wlandev) void prism2_roamed(wlandevice_t *wlandev)
{ {
cfg80211_roamed(wlandev->netdev, wlandev->bssid, cfg80211_roamed(wlandev->netdev, NULL, wlandev->bssid,
NULL, 0, NULL, 0, GFP_KERNEL); NULL, 0, NULL, 0, GFP_KERNEL);
} }
......
...@@ -2878,6 +2878,7 @@ void cfg80211_connect_result(struct net_device *dev, const u8 *bssid, ...@@ -2878,6 +2878,7 @@ void cfg80211_connect_result(struct net_device *dev, const u8 *bssid,
* cfg80211_roamed - notify cfg80211 of roaming * cfg80211_roamed - notify cfg80211 of roaming
* *
* @dev: network device * @dev: network device
* @channel: the channel of the new AP
* @bssid: the BSSID of the new AP * @bssid: the BSSID of the new AP
* @req_ie: association request IEs (maybe be %NULL) * @req_ie: association request IEs (maybe be %NULL)
* @req_ie_len: association request IEs length * @req_ie_len: association request IEs length
...@@ -2888,7 +2889,9 @@ void cfg80211_connect_result(struct net_device *dev, const u8 *bssid, ...@@ -2888,7 +2889,9 @@ void cfg80211_connect_result(struct net_device *dev, const u8 *bssid,
* It should be called by the underlying driver whenever it roamed * It should be called by the underlying driver whenever it roamed
* from one AP to another while connected. * from one AP to another while connected.
*/ */
void cfg80211_roamed(struct net_device *dev, const u8 *bssid, void cfg80211_roamed(struct net_device *dev,
struct ieee80211_channel *channel,
const u8 *bssid,
const u8 *req_ie, size_t req_ie_len, const u8 *req_ie, size_t req_ie_len,
const u8 *resp_ie, size_t resp_ie_len, gfp_t gfp); const u8 *resp_ie, size_t resp_ie_len, gfp_t gfp);
......
...@@ -245,6 +245,7 @@ struct cfg80211_event { ...@@ -245,6 +245,7 @@ struct cfg80211_event {
u16 status; u16 status;
} cr; } cr;
struct { struct {
struct ieee80211_channel *channel;
u8 bssid[ETH_ALEN]; u8 bssid[ETH_ALEN];
const u8 *req_ie; const u8 *req_ie;
const u8 *resp_ie; const u8 *resp_ie;
...@@ -392,7 +393,9 @@ int __cfg80211_disconnect(struct cfg80211_registered_device *rdev, ...@@ -392,7 +393,9 @@ int __cfg80211_disconnect(struct cfg80211_registered_device *rdev,
int cfg80211_disconnect(struct cfg80211_registered_device *rdev, int cfg80211_disconnect(struct cfg80211_registered_device *rdev,
struct net_device *dev, u16 reason, struct net_device *dev, u16 reason,
bool wextev); bool wextev);
void __cfg80211_roamed(struct wireless_dev *wdev, const u8 *bssid, void __cfg80211_roamed(struct wireless_dev *wdev,
struct ieee80211_channel *channel,
const u8 *bssid,
const u8 *req_ie, size_t req_ie_len, const u8 *req_ie, size_t req_ie_len,
const u8 *resp_ie, size_t resp_ie_len); const u8 *resp_ie, size_t resp_ie_len);
int cfg80211_mgd_wext_connect(struct cfg80211_registered_device *rdev, int cfg80211_mgd_wext_connect(struct cfg80211_registered_device *rdev,
......
...@@ -250,7 +250,8 @@ static struct cfg80211_bss *cfg80211_get_conn_bss(struct wireless_dev *wdev) ...@@ -250,7 +250,8 @@ static struct cfg80211_bss *cfg80211_get_conn_bss(struct wireless_dev *wdev)
if (wdev->conn->params.privacy) if (wdev->conn->params.privacy)
capa |= WLAN_CAPABILITY_PRIVACY; capa |= WLAN_CAPABILITY_PRIVACY;
bss = cfg80211_get_bss(wdev->wiphy, NULL, wdev->conn->params.bssid, bss = cfg80211_get_bss(wdev->wiphy, wdev->conn->params.channel,
wdev->conn->params.bssid,
wdev->conn->params.ssid, wdev->conn->params.ssid,
wdev->conn->params.ssid_len, wdev->conn->params.ssid_len,
WLAN_CAPABILITY_ESS | WLAN_CAPABILITY_PRIVACY, WLAN_CAPABILITY_ESS | WLAN_CAPABILITY_PRIVACY,
...@@ -470,7 +471,10 @@ void __cfg80211_connect_result(struct net_device *dev, const u8 *bssid, ...@@ -470,7 +471,10 @@ void __cfg80211_connect_result(struct net_device *dev, const u8 *bssid,
} }
if (!bss) if (!bss)
bss = cfg80211_get_bss(wdev->wiphy, NULL, bssid, bss = cfg80211_get_bss(wdev->wiphy,
wdev->conn ? wdev->conn->params.channel :
NULL,
bssid,
wdev->ssid, wdev->ssid_len, wdev->ssid, wdev->ssid_len,
WLAN_CAPABILITY_ESS, WLAN_CAPABILITY_ESS,
WLAN_CAPABILITY_ESS); WLAN_CAPABILITY_ESS);
...@@ -538,7 +542,9 @@ void cfg80211_connect_result(struct net_device *dev, const u8 *bssid, ...@@ -538,7 +542,9 @@ void cfg80211_connect_result(struct net_device *dev, const u8 *bssid,
} }
EXPORT_SYMBOL(cfg80211_connect_result); EXPORT_SYMBOL(cfg80211_connect_result);
void __cfg80211_roamed(struct wireless_dev *wdev, const u8 *bssid, void __cfg80211_roamed(struct wireless_dev *wdev,
struct ieee80211_channel *channel,
const u8 *bssid,
const u8 *req_ie, size_t req_ie_len, const u8 *req_ie, size_t req_ie_len,
const u8 *resp_ie, size_t resp_ie_len) const u8 *resp_ie, size_t resp_ie_len)
{ {
...@@ -565,7 +571,7 @@ void __cfg80211_roamed(struct wireless_dev *wdev, const u8 *bssid, ...@@ -565,7 +571,7 @@ void __cfg80211_roamed(struct wireless_dev *wdev, const u8 *bssid,
cfg80211_put_bss(&wdev->current_bss->pub); cfg80211_put_bss(&wdev->current_bss->pub);
wdev->current_bss = NULL; wdev->current_bss = NULL;
bss = cfg80211_get_bss(wdev->wiphy, NULL, bssid, bss = cfg80211_get_bss(wdev->wiphy, channel, bssid,
wdev->ssid, wdev->ssid_len, wdev->ssid, wdev->ssid_len,
WLAN_CAPABILITY_ESS, WLAN_CAPABILITY_ESS); WLAN_CAPABILITY_ESS, WLAN_CAPABILITY_ESS);
...@@ -603,7 +609,9 @@ void __cfg80211_roamed(struct wireless_dev *wdev, const u8 *bssid, ...@@ -603,7 +609,9 @@ void __cfg80211_roamed(struct wireless_dev *wdev, const u8 *bssid,
#endif #endif
} }
void cfg80211_roamed(struct net_device *dev, const u8 *bssid, void cfg80211_roamed(struct net_device *dev,
struct ieee80211_channel *channel,
const u8 *bssid,
const u8 *req_ie, size_t req_ie_len, const u8 *req_ie, size_t req_ie_len,
const u8 *resp_ie, size_t resp_ie_len, gfp_t gfp) const u8 *resp_ie, size_t resp_ie_len, gfp_t gfp)
{ {
...@@ -619,6 +627,7 @@ void cfg80211_roamed(struct net_device *dev, const u8 *bssid, ...@@ -619,6 +627,7 @@ void cfg80211_roamed(struct net_device *dev, const u8 *bssid,
return; return;
ev->type = EVENT_ROAMED; ev->type = EVENT_ROAMED;
ev->rm.channel = channel;
memcpy(ev->rm.bssid, bssid, ETH_ALEN); memcpy(ev->rm.bssid, bssid, ETH_ALEN);
ev->rm.req_ie = ((u8 *)ev) + sizeof(*ev); ev->rm.req_ie = ((u8 *)ev) + sizeof(*ev);
ev->rm.req_ie_len = req_ie_len; ev->rm.req_ie_len = req_ie_len;
......
...@@ -746,7 +746,7 @@ static void cfg80211_process_wdev_events(struct wireless_dev *wdev) ...@@ -746,7 +746,7 @@ static void cfg80211_process_wdev_events(struct wireless_dev *wdev)
NULL); NULL);
break; break;
case EVENT_ROAMED: case EVENT_ROAMED:
__cfg80211_roamed(wdev, ev->rm.bssid, __cfg80211_roamed(wdev, ev->rm.channel, ev->rm.bssid,
ev->rm.req_ie, ev->rm.req_ie_len, ev->rm.req_ie, ev->rm.req_ie_len,
ev->rm.resp_ie, ev->rm.resp_ie_len); ev->rm.resp_ie, ev->rm.resp_ie_len);
break; break;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment