From 4d9e6fba2a73b2b54df656452c5c872e5d192dd4 Mon Sep 17 00:00:00 2001 From: Janusz Dziedzic Date: Thu, 19 Feb 2015 07:15:45 +0100 Subject: [PATCH] IBSS: Add fixed_freq network parameter Add fixed_freq=<0/1> network block parameter and pass it to the driver when starting or joining an IBSS. If this flag is set, IBSS should not try to look for other IBSS networks to merge with on different channels. Signed-off-by: Janusz Dziedzic --- src/drivers/driver.h | 8 ++++++++ src/drivers/driver_nl80211.c | 6 ++++++ wpa_supplicant/config.c | 1 + wpa_supplicant/config_file.c | 1 + wpa_supplicant/config_ssid.h | 5 +++++ wpa_supplicant/wpa_supplicant.c | 1 + 6 files changed, 22 insertions(+) diff --git a/src/drivers/driver.h b/src/drivers/driver.h index b1d896c02..9daae88d7 100644 --- a/src/drivers/driver.h +++ b/src/drivers/driver.h @@ -766,6 +766,14 @@ struct wpa_driver_associate_params { */ int fixed_bssid; + /** + * fixed_freq - Fix control channel in IBSS mode + * 0 = don't fix control channel (default) + * 1 = fix control channel; this prevents IBSS merging with another + * channel + */ + int fixed_freq; + /** * disable_ht - Disable HT (IEEE 802.11n) for this connection */ diff --git a/src/drivers/driver_nl80211.c b/src/drivers/driver_nl80211.c index 829904812..ee6d06947 100644 --- a/src/drivers/driver_nl80211.c +++ b/src/drivers/driver_nl80211.c @@ -4378,6 +4378,12 @@ retry: goto fail; } + if (params->fixed_freq) { + wpa_printf(MSG_DEBUG, " * fixed_freq"); + if (nla_put_flag(msg, NL80211_ATTR_FREQ_FIXED)) + goto fail; + } + if (params->key_mgmt_suite == WPA_KEY_MGMT_IEEE8021X || params->key_mgmt_suite == WPA_KEY_MGMT_PSK || params->key_mgmt_suite == WPA_KEY_MGMT_IEEE8021X_SHA256 || diff --git a/wpa_supplicant/config.c b/wpa_supplicant/config.c index 6c67f9f2e..30d9342f2 100644 --- a/wpa_supplicant/config.c +++ b/wpa_supplicant/config.c @@ -1896,6 +1896,7 @@ static const struct parse_data ssid_fields[] = { { INT_RANGE(peerkey, 0, 1) }, { INT_RANGE(mixed_cell, 0, 1) }, { INT_RANGE(frequency, 0, 65000) }, + { INT_RANGE(fixed_freq, 0, 1) }, #ifdef CONFIG_MESH { FUNC(mesh_basic_rates) }, { INT(dot11MeshMaxRetries) }, diff --git a/wpa_supplicant/config_file.c b/wpa_supplicant/config_file.c index ecc57372a..c749e21fc 100644 --- a/wpa_supplicant/config_file.c +++ b/wpa_supplicant/config_file.c @@ -736,6 +736,7 @@ static void wpa_config_write_network(FILE *f, struct wpa_ssid *ssid) #endif /* IEEE8021X_EAPOL */ INT(mode); INT(frequency); + INT(fixed_freq); write_int(f, "proactive_key_caching", ssid->proactive_key_caching, -1); INT(disabled); INT(peerkey); diff --git a/wpa_supplicant/config_ssid.h b/wpa_supplicant/config_ssid.h index f744895a3..7c826cfd9 100644 --- a/wpa_supplicant/config_ssid.h +++ b/wpa_supplicant/config_ssid.h @@ -419,6 +419,11 @@ struct wpa_ssid { */ int frequency; + /** + * fixed_freq - Use fixed frequency for IBSS + */ + int fixed_freq; + /** * mesh_basic_rates - BSS Basic rate set for mesh network * diff --git a/wpa_supplicant/wpa_supplicant.c b/wpa_supplicant/wpa_supplicant.c index 5f67e55df..2a0bf3995 100644 --- a/wpa_supplicant/wpa_supplicant.c +++ b/wpa_supplicant/wpa_supplicant.c @@ -2122,6 +2122,7 @@ static void wpas_start_assoc_cb(struct wpa_radio_work *work, int deinit) ibss_mesh_setup_freq(wpa_s, ssid, ¶ms.freq); if (ssid->mode == WPAS_MODE_IBSS) { + params.fixed_freq = ssid->fixed_freq; if (ssid->beacon_int) params.beacon_int = ssid->beacon_int; else