From 54fe48b9dc1411da63a30f0c3ad073d8da9e41ac Mon Sep 17 00:00:00 2001 From: Jouni Malinen Date: Sat, 10 Jan 2015 13:03:45 +0200 Subject: [PATCH] mesh: Use the shared function with IBSS to determine channel parameters Automatically enable HT20, HT40+, HT40-, or VHT, based on driver capabilities. This obsoletes the mesh_ht_mode network block parameter that was previously used to configure HT parameters. Signed-off-by: Jouni Malinen --- wpa_supplicant/mesh.c | 19 ++----------------- wpa_supplicant/wpa_supplicant.c | 6 +++--- wpa_supplicant/wpa_supplicant_i.h | 4 ++++ 3 files changed, 9 insertions(+), 20 deletions(-) diff --git a/wpa_supplicant/mesh.c b/wpa_supplicant/mesh.c index 6d3c19a85..5fdf4e085 100644 --- a/wpa_supplicant/mesh.c +++ b/wpa_supplicant/mesh.c @@ -318,23 +318,8 @@ int wpa_supplicant_join_mesh(struct wpa_supplicant *wpa_s, os_memset(¶ms, 0, sizeof(params)); params.meshid = ssid->ssid; params.meshid_len = ssid->ssid_len; - params.freq = ssid->frequency; - wpa_s->mesh_ht_enabled = ssid->mesh_ht_mode > CHAN_NO_HT; - switch (ssid->mesh_ht_mode) { - case CHAN_HT20: - params.freq.ht_enabled = 1; - break; - case CHAN_HT40PLUS: - params.freq.ht_enabled = 1; - params.freq.sec_channel_offset = 1; - break; - case CHAN_HT40MINUS: - params.freq.ht_enabled = 1; - params.freq.sec_channel_offset = -1; - break; - default: - break; - } + ibss_mesh_setup_freq(wpa_s, ssid, ¶ms.freq); + wpa_s->mesh_ht_enabled = !!params.freq.ht_enabled; if (ssid->beacon_int > 0) params.beacon_int = ssid->beacon_int; else if (wpa_s->conf->beacon_int > 0) diff --git a/wpa_supplicant/wpa_supplicant.c b/wpa_supplicant/wpa_supplicant.c index 8a77909b9..87f9f3f21 100644 --- a/wpa_supplicant/wpa_supplicant.c +++ b/wpa_supplicant/wpa_supplicant.c @@ -1650,9 +1650,9 @@ void wpa_supplicant_associate(struct wpa_supplicant *wpa_s, } -static void ibss_mesh_setup_freq(struct wpa_supplicant *wpa_s, - const struct wpa_ssid *ssid, - struct hostapd_freq_params *freq) +void ibss_mesh_setup_freq(struct wpa_supplicant *wpa_s, + const struct wpa_ssid *ssid, + struct hostapd_freq_params *freq) { enum hostapd_hw_mode hw_mode; struct hostapd_hw_modes *mode = NULL; diff --git a/wpa_supplicant/wpa_supplicant_i.h b/wpa_supplicant/wpa_supplicant_i.h index 68bdf51a5..e396a5df6 100644 --- a/wpa_supplicant/wpa_supplicant_i.h +++ b/wpa_supplicant/wpa_supplicant_i.h @@ -1075,6 +1075,10 @@ int wpa_supplicant_ctrl_iface_ctrl_rsp_handle(struct wpa_supplicant *wpa_s, const char *field, const char *value); +void ibss_mesh_setup_freq(struct wpa_supplicant *wpa_s, + const struct wpa_ssid *ssid, + struct hostapd_freq_params *freq); + /* events.c */ void wpa_supplicant_mark_disassoc(struct wpa_supplicant *wpa_s); int wpa_supplicant_connect(struct wpa_supplicant *wpa_s,