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 <nick.lowe@gmail.com> Signed-off-by: Felix Fietkau <nbd@nbd.name> [cleanup, defaults change]
This commit is contained in:
		| @@ -64,6 +64,7 @@ hostapd_common_add_device_config() { | |||||||
| 	config_add_string country | 	config_add_string country | ||||||
| 	config_add_boolean country_ie doth | 	config_add_boolean country_ie doth | ||||||
| 	config_add_string require_mode | 	config_add_string require_mode | ||||||
|  | 	config_add_boolean legacy_rates | ||||||
|  |  | ||||||
| 	hostapd_add_log_config | 	hostapd_add_log_config | ||||||
| } | } | ||||||
| @@ -75,12 +76,15 @@ hostapd_prepare_device_config() { | |||||||
| 	local base="${config%%.conf}" | 	local base="${config%%.conf}" | ||||||
| 	local base_cfg= | 	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 | 	hostapd_set_log_options base_cfg | ||||||
|  |  | ||||||
| 	set_default country_ie 1 | 	set_default country_ie 1 | ||||||
| 	set_default doth 1 | 	set_default doth 1 | ||||||
|  | 	set_default legacy_rates 1 | ||||||
|  |  | ||||||
|  | 	[ "$hwmode" = "b" ] && legacy_rates=1 | ||||||
|  |  | ||||||
| 	[ -n "$country" ] && { | 	[ -n "$country" ] && { | ||||||
| 		append base_cfg "country_code=$country" "$N" | 		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" | 		[ "$country_ie" -gt 0 ] && append base_cfg "ieee80211d=1" "$N" | ||||||
| 		[ "$hwmode" = "a" -a "$doth" -gt 0 ] && append base_cfg "ieee80211h=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 | 	local brlist= br | ||||||
| 	json_get_values basic_rate_list basic_rate | 	json_get_values basic_rate_list basic_rate | ||||||
| 	for br in $basic_rate_list; do | 	local rlist= r | ||||||
| 		hostapd_add_rate brlist "$br" | 	json_get_values rate_list supported_rates | ||||||
| 	done |  | ||||||
|  | 	[ -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 | 	case "$require_mode" in | ||||||
| 		g) brlist="60 120 240" ;; |  | ||||||
| 		n) append base_cfg "require_ht=1" "$N";; | 		n) append base_cfg "require_ht=1" "$N";; | ||||||
| 		ac) append base_cfg "require_vht=1" "$N";; | 		ac) append base_cfg "require_vht=1" "$N";; | ||||||
| 	esac | 	esac | ||||||
|  |  | ||||||
| 	local rlist= r |  | ||||||
| 	json_get_values rate_list supported_rates |  | ||||||
| 	for r in $rate_list; do | 	for r in $rate_list; do | ||||||
| 		hostapd_add_rate rlist "$r" | 		hostapd_add_rate rlist "$r" | ||||||
| 	done | 	done | ||||||
|  |  | ||||||
|  | 	for br in $basic_rate_list; do | ||||||
|  | 		hostapd_add_rate brlist "$br" | ||||||
|  | 	done | ||||||
|  |  | ||||||
| 	[ -n "$rlist" ] && append base_cfg "supported_rates=$rlist" "$N" | 	[ -n "$rlist" ] && append base_cfg "supported_rates=$rlist" "$N" | ||||||
| 	[ -n "$brlist" ] && append base_cfg "basic_rates=$brlist" "$N" | 	[ -n "$brlist" ] && append base_cfg "basic_rates=$brlist" "$N" | ||||||
| 	[ -n "$beacon_int" ] && append base_cfg "beacon_int=$beacon_int" "$N" | 	[ -n "$beacon_int" ] && append base_cfg "beacon_int=$beacon_int" "$N" | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user
	 Nick Lowe
					Nick Lowe