From: Nick Lowe Date: Mon, 27 Mar 2017 09:50:23 +0000 (+0100) Subject: hostapd: add legacy_rates option to disable 802.11b data rates. X-Git-Url: http://git.lede-project.org./?a=commitdiff_plain;h=ed62d91f4b5296a4aa883ce975d76f590ef4e910;p=openwrt%2Fstaging%2Fadrian.git hostapd: add legacy_rates option to disable 802.11b data rates. Setting legacy_rates to 0 disables 802.11b data rates. Setting legacy_rates to 1 enables 802.11b data rates. (Default) The basic_rate option and supported_rates option are filtered based on this. The rationale for the change, stronger now than in 2014, can be found in: https://mentor.ieee.org/802.11/dcn/14/11-14-0099-00-000m-renewing-2-4ghz-band.pptx The balance of equities between compatibility with b clients and the detriment to the 2.4 GHz ecosystem as a whole strongly favors disabling b rates by default. Signed-off-by: Nick Lowe Signed-off-by: Felix Fietkau [cleanup, defaults change] --- diff --git a/package/network/services/hostapd/files/hostapd.sh b/package/network/services/hostapd/files/hostapd.sh index 988ebc7757..6fb902e376 100644 --- a/package/network/services/hostapd/files/hostapd.sh +++ b/package/network/services/hostapd/files/hostapd.sh @@ -64,6 +64,7 @@ hostapd_common_add_device_config() { config_add_string country config_add_boolean country_ie doth config_add_string require_mode + config_add_boolean legacy_rates hostapd_add_log_config } @@ -75,12 +76,15 @@ hostapd_prepare_device_config() { local base="${config%%.conf}" local base_cfg= - json_get_vars country country_ie beacon_int doth require_mode + json_get_vars country country_ie beacon_int doth require_mode legacy_rates hostapd_set_log_options base_cfg set_default country_ie 1 set_default doth 1 + set_default legacy_rates 1 + + [ "$hwmode" = "b" ] && legacy_rates=1 [ -n "$country" ] && { append base_cfg "country_code=$country" "$N" @@ -88,25 +92,33 @@ hostapd_prepare_device_config() { [ "$country_ie" -gt 0 ] && append base_cfg "ieee80211d=1" "$N" [ "$hwmode" = "a" -a "$doth" -gt 0 ] && append base_cfg "ieee80211h=1" "$N" } - [ -n "$hwmode" ] && append base_cfg "hw_mode=$hwmode" "$N" local brlist= br json_get_values basic_rate_list basic_rate - for br in $basic_rate_list; do - hostapd_add_rate brlist "$br" - done + local rlist= r + json_get_values rate_list supported_rates + + [ -n "$hwmode" ] && append base_cfg "hw_mode=$hwmode" "$N" + [ "$legacy_rates" -eq 0 ] && set_default require_mode g + + [ "$hwmode" = "g" ] && { + [ "$legacy_rates" -eq 0 ] && set_default rate_list "6000 9000 12000 18000 24000 36000 48000 54000" + [ -n "$require_mode" ] && set_default basic_rate_list "6000 12000 24000" + } + case "$require_mode" in - g) brlist="60 120 240" ;; n) append base_cfg "require_ht=1" "$N";; ac) append base_cfg "require_vht=1" "$N";; esac - local rlist= r - json_get_values rate_list supported_rates for r in $rate_list; do hostapd_add_rate rlist "$r" done + for br in $basic_rate_list; do + hostapd_add_rate brlist "$br" + done + [ -n "$rlist" ] && append base_cfg "supported_rates=$rlist" "$N" [ -n "$brlist" ] && append base_cfg "basic_rates=$brlist" "$N" [ -n "$beacon_int" ] && append base_cfg "beacon_int=$beacon_int" "$N"