Skip to content

Commit

Permalink
hostapd: rework frequency/ht/vht selection for ibss/mesh
Browse files Browse the repository at this point in the history
- Remove obsolete patch chunks regarding fixed_freq
- Instead of patching in custom HT40+/- parameters, use the standard
config syntax as much as possible.
- Use fixed_freq for mesh
- Fix issues with disabling obss scan when using fixed_freq on mesh

Signed-off-by: Felix Fietkau <nbd@nbd.name>
  • Loading branch information
nbd168 committed Nov 15, 2017
1 parent 0da54fa commit d91494e
Show file tree
Hide file tree
Showing 9 changed files with 58 additions and 179 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -524,7 +524,7 @@ mac80211_setup_supplicant() {

mac80211_setup_supplicant_noctl() {
wpa_supplicant_prepare_interface "$ifname" nl80211 || return 1
wpa_supplicant_add_network "$ifname"
wpa_supplicant_add_network "$ifname" "$freq" "$htmode"
wpa_supplicant_run "$ifname"
}

Expand Down Expand Up @@ -637,6 +637,7 @@ mac80211_setup_vif() {
authsae_start_interface || failed=1
else
wireless_vif_parse_encryption
freq="$(get_freq "$phy" "$channel")"
mac80211_setup_supplicant_noctl || failed=1
fi
else
Expand Down Expand Up @@ -694,6 +695,7 @@ mac80211_setup_vif() {
wireless_vif_parse_encryption
mac80211_setup_adhoc_htmode
if [ "$wpa" -gt 0 -o "$auto_channel" -gt 0 ]; then
freq="$(get_freq "$phy" "$channel")"
mac80211_setup_supplicant_noctl || failed=1
else
mac80211_setup_adhoc
Expand Down
34 changes: 25 additions & 9 deletions package/network/services/hostapd/files/hostapd.sh
Original file line number Diff line number Diff line change
Expand Up @@ -594,8 +594,31 @@ EOF
return 0
}

wpa_supplicant_set_fixed_freq() {
local freq="$1"
local htmode="$2"

append network_data "fixed_freq=1" "$N$T"
append network_data "frequency=$freq" "$N$T"
case "$htmode" in
NOHT) append network_data "disable_ht=1" "$N$T";;
HT20|VHT20) append network_data "disable_ht40=1" "$N$T";;
HT40*|VHT40*|VHT80*|VHT160*) append network_data "ht40=1" "$N$T";;
esac
case "$htmode" in
VHT*) append network_data "vht=1" "$N$T";;
esac
case "$htmode" in
VHT80) append network_data "max_oper_chwidth=1" "$N$T";;
VHT160) append network_data "max_oper_chwidth=2" "$N$T";;
*) append network_data "max_oper_chwidth=0" "$N$T";;
esac
}

wpa_supplicant_add_network() {
local ifname="$1"
local freq="$2"
local htmode="$3"

_wpa_supplicant_common "$1"
wireless_vif_parse_encryption
Expand All @@ -617,11 +640,7 @@ wpa_supplicant_add_network() {

[[ "$_w_mode" = "adhoc" ]] && {
append network_data "mode=1" "$N$T"
[ -n "$channel" ] && {
freq="$(get_freq "$phy" "$channel")"
append network_data "fixed_freq=1" "$N$T"
append network_data "frequency=$freq" "$N$T"
}
[ -n "$channel" ] && wpa_supplicant_set_fixed_freq "$freq" "$htmode"

scan_ssid="scan_ssid=0"

Expand All @@ -633,10 +652,7 @@ wpa_supplicant_add_network() {
ssid="${mesh_id}"

append network_data "mode=5" "$N$T"
[ -n "$channel" ] && {
freq="$(get_freq "$phy" "$channel")"
append network_data "frequency=$freq" "$N$T"
}
[ -n "$channel" ] && wpa_supplicant_set_fixed_freq "$freq" "$htmode"
append wpa_key_mgmt "SAE"
scan_ssid=""
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -179,10 +179,10 @@ CONFIG_SMARTCARD=y
#CONFIG_PCSC=y

# Support HT overrides (disable HT/HT40, mask MCS rates, etc.)
#CONFIG_HT_OVERRIDES=y
CONFIG_HT_OVERRIDES=y

# Support VHT overrides (disable VHT, mask MCS rates, etc.)
#CONFIG_VHT_OVERRIDES=y
CONFIG_VHT_OVERRIDES=y

# Development testing
#CONFIG_EAPOL_TEST=y
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -179,10 +179,10 @@ CONFIG_DRIVER_WIRED=y
#CONFIG_PCSC=y

# Support HT overrides (disable HT/HT40, mask MCS rates, etc.)
#CONFIG_HT_OVERRIDES=y
CONFIG_HT_OVERRIDES=y

# Support VHT overrides (disable VHT, mask MCS rates, etc.)
#CONFIG_VHT_OVERRIDES=y
CONFIG_VHT_OVERRIDES=y

# Development testing
#CONFIG_EAPOL_TEST=y
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -179,10 +179,10 @@ CONFIG_SMARTCARD=y
#CONFIG_PCSC=y

# Support HT overrides (disable HT/HT40, mask MCS rates, etc.)
#CONFIG_HT_OVERRIDES=y
CONFIG_HT_OVERRIDES=y

# Support VHT overrides (disable VHT, mask MCS rates, etc.)
#CONFIG_VHT_OVERRIDES=y
CONFIG_VHT_OVERRIDES=y

# Development testing
#CONFIG_EAPOL_TEST=y
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -140,11 +140,10 @@ Signed-hostap: Antonio Quartulli <ordex@autistici.org>
/* Helper macros for network block parser */

#ifdef OFFSET
@@ -2224,6 +2316,9 @@ static const struct parse_data ssid_fiel
@@ -2224,6 +2316,8 @@ static const struct parse_data ssid_fiel
{ INT(ap_max_inactivity) },
{ INT(dtim_period) },
{ INT(beacon_int) },
+ { INT_RANGE(fixed_freq, 0, 1) },
+ { FUNC(rates) },
+ { FUNC(mcast_rate) },
#ifdef CONFIG_MACSEC
Expand Down Expand Up @@ -175,11 +174,10 @@ Signed-hostap: Antonio Quartulli <ordex@autistici.org>
* macsec_policy - Determines the policy for MACsec secure session
--- a/wpa_supplicant/wpa_supplicant.c
+++ b/wpa_supplicant/wpa_supplicant.c
@@ -2781,6 +2781,13 @@ static void wpas_start_assoc_cb(struct w
@@ -2781,6 +2781,12 @@ static void wpas_start_assoc_cb(struct w
params.beacon_int = ssid->beacon_int;
else
params.beacon_int = wpa_s->conf->beacon_int;
+ params.fixed_freq = ssid->fixed_freq;
+ i = 0;
+ while (i < WLAN_SUPP_RATES_MAX) {
+ params.rates[i] = ssid->rates[i];
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ Tested-by: Simon Wunderlich <simon.wunderlich@openmesh.com>

--- a/src/drivers/driver.h
+++ b/src/drivers/driver.h
@@ -1426,6 +1426,7 @@ struct wpa_driver_mesh_join_params {
@@ -1424,6 +1424,7 @@ struct wpa_driver_mesh_join_params {
#define WPA_DRIVER_MESH_FLAG_SAE_AUTH 0x00000004
#define WPA_DRIVER_MESH_FLAG_AMPE 0x00000008
unsigned int flags;
Expand All @@ -29,7 +29,7 @@ Tested-by: Simon Wunderlich <simon.wunderlich@openmesh.com>
/**
--- a/src/drivers/driver_nl80211.c
+++ b/src/drivers/driver_nl80211.c
@@ -8997,6 +8997,18 @@ static int nl80211_put_mesh_id(struct nl
@@ -8981,6 +8981,18 @@ static int nl80211_put_mesh_id(struct nl
}


Expand All @@ -48,7 +48,7 @@ Tested-by: Simon Wunderlich <simon.wunderlich@openmesh.com>
static int nl80211_put_mesh_config(struct nl_msg *msg,
struct wpa_driver_mesh_bss_params *params)
{
@@ -9055,6 +9067,7 @@ static int nl80211_join_mesh(struct i802
@@ -9039,6 +9051,7 @@ static int nl80211_join_mesh(struct i802
nl80211_put_basic_rates(msg, params->basic_rates) ||
nl80211_put_mesh_id(msg, params->meshid, params->meshid_len) ||
nl80211_put_beacon_int(msg, params->beacon_int) ||
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
--- a/wpa_supplicant/wpa_supplicant.c
+++ b/wpa_supplicant/wpa_supplicant.c
@@ -2010,11 +2010,13 @@ void ibss_mesh_setup_freq(struct wpa_sup
for (j = 0; j < wpa_s->last_scan_res_used; j++) {
struct wpa_bss *bss = wpa_s->last_scan_res[j];

- if (ssid->mode != WPAS_MODE_IBSS)
+ /* Don't adjust control freq in case of fixed_freq */
+ if (ssid->fixed_freq) {
+ obss_scan = 0;
break;
+ }

- /* Don't adjust control freq in case of fixed_freq */
- if (ssid->fixed_freq)
+ if (ssid->mode != WPAS_MODE_IBSS)
break;

if (!bss_is_ibss(bss))

0 comments on commit d91494e

Please sign in to comment.