From 9e2af29f9bf065099b9a2abceaf40ac0e1bf86fa Mon Sep 17 00:00:00 2001 From: Nicolas Cavallari Date: Sat, 28 Jan 2012 11:33:47 +0200 Subject: [PATCH] Support fixing the BSSID in IBSS mode When the "bssid=" option is set for an IBSS network and ap_scan = 2, ask the driver to fix this BSSID, if possible. Previously, any "bssid=" option were ignored in IBSS mode when ap_scan=2. Signed-hostap: Nicolas Cavallari --- src/drivers/driver.h | 7 +++++++ wpa_supplicant/wpa_supplicant.c | 7 +++++++ 2 files changed, 14 insertions(+) diff --git a/src/drivers/driver.h b/src/drivers/driver.h index d72c83b69..f56c41b91 100644 --- a/src/drivers/driver.h +++ b/src/drivers/driver.h @@ -516,6 +516,13 @@ struct wpa_driver_associate_params { * STA mode: bits 0..3 UAPSD enabled for VO,VI,BK,BE */ int uapsd; + + /** + * fixed_bssid - Whether to force this BSSID in IBSS mode + * 1 = Fix this BSSID and prevent merges. + * 0 = Do not fix BSSID. + */ + int fixed_bssid; }; enum hide_ssid { diff --git a/wpa_supplicant/wpa_supplicant.c b/wpa_supplicant/wpa_supplicant.c index 68b80b95b..e79011ff3 100644 --- a/wpa_supplicant/wpa_supplicant.c +++ b/wpa_supplicant/wpa_supplicant.c @@ -1364,6 +1364,13 @@ void wpa_supplicant_associate(struct wpa_supplicant *wpa_s, params.ssid = ssid->ssid; params.ssid_len = ssid->ssid_len; } + + if (ssid->mode == WPAS_MODE_IBSS && ssid->bssid_set && + wpa_s->conf->ap_scan == 2) { + params.bssid = ssid->bssid; + params.fixed_bssid = 1; + } + if (ssid->mode == WPAS_MODE_IBSS && ssid->frequency > 0 && params.freq == 0) params.freq = ssid->frequency; /* Initial channel for IBSS */