mesh: Convert channel configuration to use common routines

Use struct hostapd_freq_params just like other modes do instead of
mesh-specific freq and ht_mode.

Signed-off-by: Jouni Malinen <j@w1.fi>
This commit is contained in:
Jouni Malinen 2015-01-10 13:02:08 +02:00
parent 6334330ed6
commit f7e889fa2d
3 changed files with 20 additions and 43 deletions

View file

@ -1048,10 +1048,9 @@ struct wpa_driver_mesh_join_params {
const int *basic_rates;
const u8 *ies;
int ie_len;
int freq;
struct hostapd_freq_params freq;
int beacon_int;
int max_peer_links;
enum ht_mode ht_mode;
struct wpa_driver_mesh_bss_params conf;
#define WPA_DRIVER_MESH_FLAG_USER_MPM 0x00000001
#define WPA_DRIVER_MESH_FLAG_DRIVER_MPM 0x00000002

View file

@ -7804,43 +7804,9 @@ wpa_driver_nl80211_join_mesh(void *priv,
wpa_printf(MSG_DEBUG, "nl80211: mesh join (ifindex=%d)", drv->ifindex);
msg = nl80211_drv_msg(drv, 0, NL80211_CMD_JOIN_MESH);
if (!msg)
goto fail;
if (params->freq) {
wpa_printf(MSG_DEBUG, " * freq=%d", params->freq);
if (nla_put_u32(msg, NL80211_ATTR_WIPHY_FREQ, params->freq))
goto fail;
}
if (params->ht_mode) {
unsigned int ht_value;
char *ht_mode = "";
switch (params->ht_mode) {
default:
case CHAN_NO_HT:
ht_value = NL80211_CHAN_NO_HT;
ht_mode = "NOHT";
break;
case CHAN_HT20:
ht_value = NL80211_CHAN_HT20;
ht_mode = "HT20";
break;
case CHAN_HT40PLUS:
ht_value = NL80211_CHAN_HT40PLUS;
ht_mode = "HT40+";
break;
case CHAN_HT40MINUS:
ht_value = NL80211_CHAN_HT40MINUS;
ht_mode = "HT40-";
break;
}
wpa_printf(MSG_DEBUG, " * ht_mode=%s", ht_mode);
if (nla_put_u32(msg, NL80211_ATTR_WIPHY_CHANNEL_TYPE, ht_value))
goto fail;
}
if (nl80211_put_basic_rates(msg, params->basic_rates))
if (!msg ||
nl80211_put_freq_params(msg, &params->freq) ||
nl80211_put_basic_rates(msg, params->basic_rates))
goto fail;
if (params->meshid) {
@ -7905,7 +7871,7 @@ wpa_driver_nl80211_join_mesh(void *priv,
goto fail;
}
ret = 0;
bss->freq = params->freq;
bss->freq = params->freq.freq;
wpa_printf(MSG_DEBUG, "nl80211: mesh join request send successfully");
fail:

View file

@ -320,14 +320,26 @@ int wpa_supplicant_join_mesh(struct wpa_supplicant *wpa_s,
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;
}
if (ssid->beacon_int > 0)
params.beacon_int = ssid->beacon_int;
else if (wpa_s->conf->beacon_int > 0)
params.beacon_int = wpa_s->conf->beacon_int;
params.max_peer_links = wpa_s->conf->max_peer_links;
#ifdef CONFIG_IEEE80211N
params.ht_mode = ssid->mesh_ht_mode;
#endif /* CONFIG_IEEE80211N */
if (ssid->key_mgmt & WPA_KEY_MGMT_SAE) {
params.flags |= WPA_DRIVER_MESH_FLAG_SAE_AUTH;