From 7ac7fd43aa6ec3a5ca3848c66fcbf0dd38328174 Mon Sep 17 00:00:00 2001 From: Dmitry Shmidt Date: Thu, 13 Feb 2014 15:14:18 +0200 Subject: [PATCH] Add bssid/freq hint for driver-based BSS selection This uses the new nl80211 attributes to allow the connect command to provide bssid and freq hints to the driver without limiting roaming to the specific BSS/frequency. This can be used by drivers that perform internal BSS selection (WPA_DRIVER_FLAGS_BSS_SELECTION) as a candidate for initial association. Signed-off-by: Dmitry Shmidt --- src/drivers/driver.h | 20 ++++++++++++++++++++ src/drivers/driver_nl80211.c | 13 +++++++++++++ wpa_supplicant/wpa_supplicant.c | 2 ++ 3 files changed, 35 insertions(+) diff --git a/src/drivers/driver.h b/src/drivers/driver.h index 7ad857616..d4136d7f8 100644 --- a/src/drivers/driver.h +++ b/src/drivers/driver.h @@ -403,6 +403,16 @@ struct wpa_driver_associate_params { * responsible for selecting with which BSS to associate. */ const u8 *bssid; + /** + * bssid_hint - BSSID of a proposed AP + * + * This indicates which BSS has been found a suitable candidate for + * initial association for drivers that use driver/firmwate-based BSS + * selection. Unlike the @bssid parameter, @bssid_hint does not limit + * the driver from selecting other BSSes in the ESS. + */ + const u8 *bssid_hint; + /** * ssid - The selected SSID */ @@ -420,6 +430,16 @@ struct wpa_driver_associate_params { */ int freq; + /** + * freq_hint - Frequency of the channel the proposed AP is using + * + * This provides a channel on which a suitable BSS has been found as a + * hint for the driver. Unlike the @freq parameter, @freq_hint does not + * limit the driver from selecting other channels for + * driver/firmware-based BSS selection. + */ + int freq_hint; + /** * bg_scan_period - Background scan period in seconds, 0 to disable * background scan, or -1 to indicate no change to default driver diff --git a/src/drivers/driver_nl80211.c b/src/drivers/driver_nl80211.c index 59785681a..f4bb31c6b 100644 --- a/src/drivers/driver_nl80211.c +++ b/src/drivers/driver_nl80211.c @@ -8391,6 +8391,13 @@ static int nl80211_connect_common(struct wpa_driver_nl80211_data *drv, NLA_PUT(msg, NL80211_ATTR_MAC, ETH_ALEN, params->bssid); } + if (params->bssid_hint) { + wpa_printf(MSG_DEBUG, " * bssid_hint=" MACSTR, + MAC2STR(params->bssid_hint)); + NLA_PUT(msg, NL80211_ATTR_MAC_HINT, ETH_ALEN, + params->bssid_hint); + } + if (params->freq) { wpa_printf(MSG_DEBUG, " * freq=%d", params->freq); NLA_PUT_U32(msg, NL80211_ATTR_WIPHY_FREQ, params->freq); @@ -8398,6 +8405,12 @@ static int nl80211_connect_common(struct wpa_driver_nl80211_data *drv, } else drv->assoc_freq = 0; + if (params->freq_hint) { + wpa_printf(MSG_DEBUG, " * freq_hint=%d", params->freq_hint); + NLA_PUT_U32(msg, NL80211_ATTR_WIPHY_FREQ_HINT, + params->freq_hint); + } + if (params->bg_scan_period >= 0) { wpa_printf(MSG_DEBUG, " * bg scan period=%d", params->bg_scan_period); diff --git a/wpa_supplicant/wpa_supplicant.c b/wpa_supplicant/wpa_supplicant.c index 455b15828..e21c653a7 100644 --- a/wpa_supplicant/wpa_supplicant.c +++ b/wpa_supplicant/wpa_supplicant.c @@ -1656,6 +1656,8 @@ static void wpas_start_assoc_cb(struct wpa_radio_work *work, int deinit) params.bssid = bss->bssid; params.freq = bss->freq; } + params.bssid_hint = bss->bssid; + params.freq_hint = bss->freq; } else { params.ssid = ssid->ssid; params.ssid_len = ssid->ssid_len;