From 4832ecd754f83a747328436c2a14244e018f8d9a Mon Sep 17 00:00:00 2001 From: Jouni Malinen Date: Mon, 28 Dec 2009 13:23:13 +0200 Subject: [PATCH] Add an option for driver wrappers to report operational frequency --- src/drivers/driver.h | 5 +++++ src/drivers/driver_nl80211.c | 7 ++++++- wpa_supplicant/events.c | 4 ++++ wpa_supplicant/wpa_supplicant_i.h | 1 + 4 files changed, 16 insertions(+), 1 deletion(-) diff --git a/src/drivers/driver.h b/src/drivers/driver.h index 27a110054..8a459571f 100644 --- a/src/drivers/driver.h +++ b/src/drivers/driver.h @@ -1797,6 +1797,11 @@ union wpa_event_data { /** * beacon_ies_len - Length of beacon_ies */ size_t beacon_ies_len; + + /** + * freq - Frequency of the operational channel in MHz + */ + unsigned int freq; } assoc_info; /** diff --git a/src/drivers/driver_nl80211.c b/src/drivers/driver_nl80211.c index ce6bedc70..847cacb1d 100644 --- a/src/drivers/driver_nl80211.c +++ b/src/drivers/driver_nl80211.c @@ -91,6 +91,7 @@ struct wpa_driver_nl80211_data { size_t ssid_len; int nlmode; int ap_scan_as_station; + unsigned int assoc_freq; int monitor_sock; int monitor_ifidx; @@ -536,6 +537,8 @@ static void mlme_event_assoc(struct wpa_driver_nl80211_data *drv, len - 24 - sizeof(mgmt->u.assoc_resp); } + event.assoc_info.freq = drv->assoc_freq; + wpa_supplicant_event(drv->ctx, EVENT_ASSOC, &event); } @@ -3442,7 +3445,9 @@ static int wpa_driver_nl80211_associate( if (params->freq) { wpa_printf(MSG_DEBUG, " * freq=%d", params->freq); NLA_PUT_U32(msg, NL80211_ATTR_WIPHY_FREQ, params->freq); - } + drv->assoc_freq = params->freq; + } else + drv->assoc_freq = 0; if (params->ssid) { wpa_hexdump_ascii(MSG_DEBUG, " * SSID", params->ssid, params->ssid_len); diff --git a/wpa_supplicant/events.c b/wpa_supplicant/events.c index f8141ebd6..b0dfe4162 100644 --- a/wpa_supplicant/events.c +++ b/wpa_supplicant/events.c @@ -888,6 +888,8 @@ static void wpa_supplicant_event_associnfo(struct wpa_supplicant *wpa_s, wpa_hexdump(MSG_DEBUG, "beacon_ies", data->assoc_info.beacon_ies, data->assoc_info.beacon_ies_len); + if (data->assoc_info.freq) + wpa_printf(MSG_DEBUG, "freq=%u MHz", data->assoc_info.freq); p = data->assoc_info.req_ies; l = data->assoc_info.req_ies_len; @@ -975,6 +977,8 @@ static void wpa_supplicant_event_associnfo(struct wpa_supplicant *wpa_s, wpa_sm_set_ap_rsn_ie(wpa_s->wpa, NULL, 0); if (wpa_found || rsn_found) wpa_s->ap_ies_from_associnfo = 1; + + wpa_s->assoc_freq = data->assoc_info.freq; } diff --git a/wpa_supplicant/wpa_supplicant_i.h b/wpa_supplicant/wpa_supplicant_i.h index 03d85f146..18d0bf6e2 100644 --- a/wpa_supplicant/wpa_supplicant_i.h +++ b/wpa_supplicant/wpa_supplicant_i.h @@ -326,6 +326,7 @@ struct wpa_supplicant { * before this has been cleared */ struct wpa_ssid *current_ssid; int ap_ies_from_associnfo; + unsigned int assoc_freq; /* Selected configuration (based on Beacon/ProbeResp WPA IE) */ int pairwise_cipher;