From 8f05577d1137fe8753efb5278efd3d6a942e5b20 Mon Sep 17 00:00:00 2001 From: Jouni Malinen Date: Thu, 6 Mar 2014 23:09:20 +0200 Subject: [PATCH] Configure beacon interval for IBSS command wpa_supplicant already allowed beacon interval to be configured for AP mode operations, but this was not passed to the driver for IBSS even though the same parameter can used for that case. Add this for the nl80211 driver interface to allow beacon interval to be controlled for IBSS as well. Signed-off-by: Jouni Malinen --- src/drivers/driver.h | 5 +++++ src/drivers/driver_nl80211.c | 6 ++++++ wpa_supplicant/wpa_supplicant.c | 8 ++++++++ 3 files changed, 19 insertions(+) diff --git a/src/drivers/driver.h b/src/drivers/driver.h index 6b6c0efe4..a92de5604 100644 --- a/src/drivers/driver.h +++ b/src/drivers/driver.h @@ -447,6 +447,11 @@ struct wpa_driver_associate_params { */ int bg_scan_period; + /** + * beacon_int - Beacon interval for IBSS or 0 to use driver default + */ + int beacon_int; + /** * wpa_ie - WPA information element for (Re)Association Request * WPA information element to be included in (Re)Association diff --git a/src/drivers/driver_nl80211.c b/src/drivers/driver_nl80211.c index 87c9661de..9b9e66cfe 100644 --- a/src/drivers/driver_nl80211.c +++ b/src/drivers/driver_nl80211.c @@ -8377,6 +8377,12 @@ retry: wpa_printf(MSG_DEBUG, " * freq=%d", params->freq); NLA_PUT_U32(msg, NL80211_ATTR_WIPHY_FREQ, params->freq); + if (params->beacon_int > 0) { + wpa_printf(MSG_DEBUG, " * beacon_int=%d", params->beacon_int); + NLA_PUT_U32(msg, NL80211_ATTR_BEACON_INTERVAL, + params->beacon_int); + } + ret = nl80211_set_conn_keys(params, msg); if (ret) goto nla_put_failure; diff --git a/wpa_supplicant/wpa_supplicant.c b/wpa_supplicant/wpa_supplicant.c index 46195b158..555210bc6 100644 --- a/wpa_supplicant/wpa_supplicant.c +++ b/wpa_supplicant/wpa_supplicant.c @@ -1714,6 +1714,14 @@ static void wpas_start_assoc_cb(struct wpa_radio_work *work, int deinit) if (ssid->mode == WPAS_MODE_IBSS && ssid->frequency > 0 && params.freq == 0) params.freq = ssid->frequency; /* Initial channel for IBSS */ + + if (ssid->mode == WPAS_MODE_IBSS) { + if (ssid->beacon_int) + params.beacon_int = ssid->beacon_int; + else + params.beacon_int = wpa_s->conf->beacon_int; + } + params.wpa_ie = wpa_ie; params.wpa_ie_len = wpa_ie_len; params.pairwise_suite = cipher_pairwise;