nl80211: Update assoc_freq and bss->freq based on real association info

Move event.assoc_info.freq selection to be after the
nl80211_get_assoc_ssid() call so that the current cfg80211 information
on the operating channel can be used should anything unexpected have
happened between the association request and completion of association.
Furthermore, update bss->freq based on assoc_freq to make that
information a bit more useful for station mode. It was already updated
after channel switches during association, but not at the beginning of
association.

Signed-off-by: Jouni Malinen <j@w1.fi>
This commit is contained in:
Jouni Malinen 2019-04-14 12:37:41 +03:00
parent 091c227714
commit c5fff8bbd2

View file

@ -267,8 +267,6 @@ static void mlme_event_assoc(struct wpa_driver_nl80211_data *drv,
event.assoc_info.req_ies_len = nla_len(req_ie); event.assoc_info.req_ies_len = nla_len(req_ie);
} }
event.assoc_info.freq = drv->assoc_freq;
/* When this association was initiated outside of wpa_supplicant, /* When this association was initiated outside of wpa_supplicant,
* drv->ssid needs to be set here to satisfy later checking. */ * drv->ssid needs to be set here to satisfy later checking. */
ssid_len = nl80211_get_assoc_ssid(drv, drv->ssid); ssid_len = nl80211_get_assoc_ssid(drv, drv->ssid);
@ -279,6 +277,9 @@ static void mlme_event_assoc(struct wpa_driver_nl80211_data *drv,
wpa_ssid_txt(drv->ssid, drv->ssid_len)); wpa_ssid_txt(drv->ssid, drv->ssid_len));
} }
event.assoc_info.freq = drv->assoc_freq;
drv->first_bss->freq = drv->assoc_freq;
nl80211_parse_wmm_params(wmm, &event.assoc_info.wmm_params); nl80211_parse_wmm_params(wmm, &event.assoc_info.wmm_params);
wpa_supplicant_event(drv->ctx, EVENT_ASSOC, &event); wpa_supplicant_event(drv->ctx, EVENT_ASSOC, &event);
@ -408,6 +409,7 @@ static void mlme_event_connect(struct wpa_driver_nl80211_data *drv,
} }
event.assoc_info.freq = nl80211_get_assoc_freq(drv); event.assoc_info.freq = nl80211_get_assoc_freq(drv);
drv->first_bss->freq = drv->assoc_freq;
if ((!ssid || ssid[1] == 0 || ssid[1] > 32) && if ((!ssid || ssid[1] == 0 || ssid[1] > 32) &&
(ssid_len = nl80211_get_assoc_ssid(drv, drv->ssid)) > 0) { (ssid_len = nl80211_get_assoc_ssid(drv, drv->ssid)) > 0) {