developer | ce9e509 | 2022-11-10 22:41:59 +0800 | [diff] [blame] | 1 | diff --git a/package/kernel/mac80211/Makefile b/package/kernel/mac80211/Makefile |
developer | 5ad8986 | 2023-08-24 08:17:27 +0800 | [diff] [blame] | 2 | index 8ecbe30..44af0c7 100644 |
developer | ce9e509 | 2022-11-10 22:41:59 +0800 | [diff] [blame] | 3 | --- a/package/kernel/mac80211/Makefile |
| 4 | +++ b/package/kernel/mac80211/Makefile |
developer | 5ad8986 | 2023-08-24 08:17:27 +0800 | [diff] [blame] | 5 | @@ -19,6 +19,7 @@ PKG_SOURCE:=backports-$(PKG_VERSION).tar.xz |
developer | ce9e509 | 2022-11-10 22:41:59 +0800 | [diff] [blame] | 6 | PKG_BUILD_DIR:=$(KERNEL_BUILD_DIR)/backports-$(PKG_VERSION) |
| 7 | PKG_BUILD_PARALLEL:=1 |
developer | 356ecec | 2022-11-14 10:25:04 +0800 | [diff] [blame] | 8 | |
developer | ce9e509 | 2022-11-10 22:41:59 +0800 | [diff] [blame] | 9 | +SOURCE_PATH:=./src |
| 10 | PKG_MAINTAINER:=Felix Fietkau <nbd@nbd.name> |
developer | 356ecec | 2022-11-14 10:25:04 +0800 | [diff] [blame] | 11 | |
developer | ce9e509 | 2022-11-10 22:41:59 +0800 | [diff] [blame] | 12 | PKG_DRIVERS = \ |
developer | 5ad8986 | 2023-08-24 08:17:27 +0800 | [diff] [blame] | 13 | @@ -71,6 +72,11 @@ config-y:= \ |
developer | 6ec8e34 | 2022-11-21 18:47:15 +0800 | [diff] [blame] | 14 | WLAN_VENDOR_ST \ |
| 15 | WLAN_VENDOR_TI \ |
| 16 | WLAN_VENDOR_ZYDAS \ |
| 17 | + MAC80211_DEBUG_MENU \ |
| 18 | + MAC80211_MLME_DEBUG \ |
| 19 | + MAC80211_STA_DEBUG \ |
| 20 | + MAC80211_HT_DEBUG \ |
developer | 5ad8986 | 2023-08-24 08:17:27 +0800 | [diff] [blame] | 21 | + MAC80211_PS_DEBUG \ |
developer | 6ec8e34 | 2022-11-21 18:47:15 +0800 | [diff] [blame] | 22 | |
| 23 | config-$(call config_package,cfg80211) += CFG80211 |
| 24 | config-$(CONFIG_PACKAGE_CFG80211_TESTMODE) += NL80211_TESTMODE |
developer | 5ad8986 | 2023-08-24 08:17:27 +0800 | [diff] [blame] | 25 | @@ -296,6 +302,8 @@ define Build/Prepare |
developer | 356ecec | 2022-11-14 10:25:04 +0800 | [diff] [blame] | 26 | mkdir -p $(PKG_BUILD_DIR) |
| 27 | $(PKG_UNPACK) |
| 28 | $(Build/Patch) |
| 29 | + $(CP) $(SOURCE_PATH)/net $(PKG_BUILD_DIR) 2>/dev/null || : |
| 30 | + $(CP) $(SOURCE_PATH)/include $(PKG_BUILD_DIR) 2>/dev/null || : |
| 31 | rm -rf \ |
| 32 | $(PKG_BUILD_DIR)/include/linux/ssb \ |
| 33 | $(PKG_BUILD_DIR)/include/linux/bcma \ |
developer | 20d6771 | 2022-03-02 14:09:32 +0800 | [diff] [blame] | 34 | diff --git a/package/kernel/mac80211/files/lib/netifd/wireless/mac80211.sh b/package/kernel/mac80211/files/lib/netifd/wireless/mac80211.sh |
developer | d469bb9 | 2024-03-01 08:59:08 +0800 | [diff] [blame^] | 35 | index ed28052..797ea8d 100644 |
developer | 20d6771 | 2022-03-02 14:09:32 +0800 | [diff] [blame] | 36 | --- a/package/kernel/mac80211/files/lib/netifd/wireless/mac80211.sh |
| 37 | +++ b/package/kernel/mac80211/files/lib/netifd/wireless/mac80211.sh |
developer | 0ba09b6 | 2023-03-10 18:43:49 +0800 | [diff] [blame] | 38 | @@ -27,6 +27,7 @@ drv_mac80211_init_device_config() { |
| 39 | |
| 40 | config_add_string path phy 'macaddr:macaddr' |
| 41 | config_add_string tx_burst |
developer | 61604c8 | 2023-09-04 14:43:31 +0800 | [diff] [blame] | 42 | + config_add_int mbssid mu_onoff sr_enable sr_enhanced rnr obss_interval |
developer | 0ba09b6 | 2023-03-10 18:43:49 +0800 | [diff] [blame] | 43 | config_add_string distance |
| 44 | config_add_int beacon_int chanbw frag rts |
| 45 | config_add_int rxantenna txantenna antenna_gain txpower min_tx_power |
developer | ee85b6b | 2023-12-22 18:33:35 +0800 | [diff] [blame] | 46 | @@ -53,7 +54,12 @@ drv_mac80211_init_device_config() { |
developer | 785b650 | 2023-04-19 18:31:11 +0800 | [diff] [blame] | 47 | he_spr_sr_control \ |
| 48 | he_spr_psr_enabled \ |
| 49 | he_bss_color_enabled \ |
| 50 | - he_twt_required |
| 51 | + he_twt_required \ |
| 52 | + he_twt_responder \ |
| 53 | + etxbfen \ |
developer | ee85b6b | 2023-12-22 18:33:35 +0800 | [diff] [blame] | 54 | + itxbfen \ |
| 55 | + lpi_enable \ |
| 56 | + beacon_dup |
developer | 785b650 | 2023-04-19 18:31:11 +0800 | [diff] [blame] | 57 | config_add_int \ |
| 58 | beamformer_antennas \ |
| 59 | beamformee_antennas \ |
developer | ee85b6b | 2023-12-22 18:33:35 +0800 | [diff] [blame] | 60 | @@ -64,7 +70,8 @@ drv_mac80211_init_device_config() { |
| 61 | rx_stbc \ |
| 62 | tx_stbc \ |
| 63 | he_bss_color \ |
| 64 | - he_spr_non_srg_obss_pd_max_offset |
| 65 | + he_spr_non_srg_obss_pd_max_offset \ |
| 66 | + sku_idx |
| 67 | config_add_boolean \ |
| 68 | ldpc \ |
| 69 | greenfield \ |
| 70 | @@ -140,13 +147,11 @@ mac80211_hostapd_setup_base() { |
developer | 0ba09b6 | 2023-03-10 18:43:49 +0800 | [diff] [blame] | 71 | [ -n "$acs_exclude_dfs" ] && [ "$acs_exclude_dfs" -gt 0 ] && |
| 72 | append base_cfg "acs_exclude_dfs=1" "$N" |
| 73 | |
| 74 | - json_get_vars noscan ht_coex min_tx_power:0 tx_burst |
developer | 61604c8 | 2023-09-04 14:43:31 +0800 | [diff] [blame] | 75 | + json_get_vars noscan ht_coex min_tx_power:0 tx_burst mbssid mu_onoff rnr obss_interval |
developer | ee85b6b | 2023-12-22 18:33:35 +0800 | [diff] [blame] | 76 | + json_get_vars etxbfen:1 itxbfen:0 lpi_enable:0 sku_idx:0 beacon_dup:1 |
developer | 8d77be3 | 2022-10-20 15:08:25 +0800 | [diff] [blame] | 77 | json_get_values ht_capab_list ht_capab |
developer | 20d6771 | 2022-03-02 14:09:32 +0800 | [diff] [blame] | 78 | json_get_values channel_list channels |
| 79 | |
| 80 | - [ "$auto_channel" = 0 ] && [ -z "$channel_list" ] && \ |
| 81 | - channel_list="$channel" |
| 82 | - |
developer | 9b3248d | 2022-07-06 00:44:05 +0800 | [diff] [blame] | 83 | [ "$min_tx_power" -gt 0 ] && append base_cfg "min_tx_power=$min_tx_power" |
developer | 20d6771 | 2022-03-02 14:09:32 +0800 | [diff] [blame] | 84 | |
developer | 9b3248d | 2022-07-06 00:44:05 +0800 | [diff] [blame] | 85 | set_default noscan 0 |
developer | d469bb9 | 2024-03-01 08:59:08 +0800 | [diff] [blame^] | 86 | @@ -161,20 +166,41 @@ mac80211_hostapd_setup_base() { |
developer | 785b650 | 2023-04-19 18:31:11 +0800 | [diff] [blame] | 87 | ht_capab= |
| 88 | case "$htmode" in |
developer | d469bb9 | 2024-03-01 08:59:08 +0800 | [diff] [blame^] | 89 | VHT20|HT20|HE20) ;; |
developer | 785b650 | 2023-04-19 18:31:11 +0800 | [diff] [blame] | 90 | - HT40*|VHT40|VHT80|VHT160|HE40|HE80|HE160) |
developer | d469bb9 | 2024-03-01 08:59:08 +0800 | [diff] [blame^] | 91 | + HT40*|VHT40|VHT80|VHT160|HE40*|HE80|HE160) |
developer | 785b650 | 2023-04-19 18:31:11 +0800 | [diff] [blame] | 92 | case "$hwmode" in |
| 93 | a) |
| 94 | case "$(( (($channel / 4) + $chan_ofs) % 2 ))" in |
developer | da1bac7 | 2023-09-19 10:32:47 +0800 | [diff] [blame] | 95 | 1) ht_capab="[HT40+]";; |
| 96 | 0) ht_capab="[HT40-]";; |
| 97 | esac |
| 98 | + case "$htmode" in |
developer | d469bb9 | 2024-03-01 08:59:08 +0800 | [diff] [blame^] | 99 | + HT40-|HE40-) |
developer | da1bac7 | 2023-09-19 10:32:47 +0800 | [diff] [blame] | 100 | + if [ "$auto_channel" -gt 0 ]; then |
| 101 | + ht_capab="[HT40-]" |
| 102 | + fi |
| 103 | + ;; |
| 104 | + esac |
developer | be3cf97 | 2023-04-27 09:58:26 +0800 | [diff] [blame] | 105 | ;; |
| 106 | *) |
| 107 | case "$htmode" in |
| 108 | - HT40+) ht_capab="[HT40+]";; |
| 109 | - HT40-) ht_capab="[HT40-]";; |
developer | d469bb9 | 2024-03-01 08:59:08 +0800 | [diff] [blame^] | 110 | + HT40+|HE40+) |
developer | be3cf97 | 2023-04-27 09:58:26 +0800 | [diff] [blame] | 111 | + if [ "$channel" -gt 9 ]; then |
| 112 | + echo "Could not set the center freq with this HT mode setting" |
| 113 | + return 1 |
| 114 | + else |
| 115 | + ht_capab="[HT40+]" |
| 116 | + fi |
| 117 | + ;; |
developer | d469bb9 | 2024-03-01 08:59:08 +0800 | [diff] [blame^] | 118 | + HT40-|HE40-) |
developer | da1bac7 | 2023-09-19 10:32:47 +0800 | [diff] [blame] | 119 | + if [ "$channel" -lt 5 -a "$auto_channel" -eq 0 ]; then |
developer | be3cf97 | 2023-04-27 09:58:26 +0800 | [diff] [blame] | 120 | + echo "Could not set the center freq with this HT mode setting" |
| 121 | + return 1 |
| 122 | + else |
| 123 | + ht_capab="[HT40-]" |
| 124 | + fi |
| 125 | + ;; |
| 126 | *) |
developer | da1bac7 | 2023-09-19 10:32:47 +0800 | [diff] [blame] | 127 | - if [ "$channel" -lt 7 ]; then |
| 128 | + if [ "$channel" -lt 7 -o "$auto_channel" -gt 0 ]; then |
developer | be3cf97 | 2023-04-27 09:58:26 +0800 | [diff] [blame] | 129 | ht_capab="[HT40+]" |
developer | da1bac7 | 2023-09-19 10:32:47 +0800 | [diff] [blame] | 130 | else |
| 131 | ht_capab="[HT40-]" |
developer | ee85b6b | 2023-12-22 18:33:35 +0800 | [diff] [blame] | 132 | @@ -183,7 +209,6 @@ mac80211_hostapd_setup_base() { |
developer | da1bac7 | 2023-09-19 10:32:47 +0800 | [diff] [blame] | 133 | esac |
| 134 | ;; |
| 135 | esac |
| 136 | - [ "$auto_channel" -gt 0 ] && ht_capab="[HT40+]" |
| 137 | ;; |
| 138 | *) ieee80211n= ;; |
| 139 | esac |
developer | ee85b6b | 2023-12-22 18:33:35 +0800 | [diff] [blame] | 140 | @@ -193,6 +218,10 @@ mac80211_hostapd_setup_base() { |
developer | 61604c8 | 2023-09-04 14:43:31 +0800 | [diff] [blame] | 141 | |
| 142 | set_default ht_coex 0 |
| 143 | append base_cfg "ht_coex=$ht_coex" "$N" |
| 144 | + [ "$ht_coex" -eq 1 ] && { |
| 145 | + set_default obss_interval 300 |
| 146 | + append base_cfg "obss_interval=$obss_interval" "$N" |
| 147 | + } |
| 148 | |
| 149 | json_get_vars \ |
| 150 | ldpc:1 \ |
developer | ee85b6b | 2023-12-22 18:33:35 +0800 | [diff] [blame] | 151 | @@ -205,7 +234,7 @@ mac80211_hostapd_setup_base() { |
developer | 785b650 | 2023-04-19 18:31:11 +0800 | [diff] [blame] | 152 | dsss_cck_40:1 |
| 153 | |
| 154 | ht_cap_mask=0 |
| 155 | - for cap in $(iw phy "$phy" info | grep 'Capabilities:' | cut -d: -f2); do |
| 156 | + for cap in $(iw phy "$phy" info | grep 'Capabilities: 0x' | cut -d: -f2); do |
| 157 | ht_cap_mask="$(($ht_cap_mask | $cap))" |
| 158 | done |
| 159 | |
developer | d469bb9 | 2024-03-01 08:59:08 +0800 | [diff] [blame^] | 160 | @@ -271,6 +300,7 @@ mac80211_hostapd_setup_base() { |
developer | add8de6 | 2023-05-02 16:25:52 +0800 | [diff] [blame] | 161 | case "$channel" in |
| 162 | 36|40|44|48|52|56|60|64) idx=50;; |
| 163 | 100|104|108|112|116|120|124|128) idx=114;; |
| 164 | + 149|153|157|161|165|169|173|177) idx=163;; |
| 165 | esac |
| 166 | fi |
| 167 | enable_ac=1 |
developer | d469bb9 | 2024-03-01 08:59:08 +0800 | [diff] [blame^] | 168 | @@ -315,7 +345,6 @@ mac80211_hostapd_setup_base() { |
developer | 8b04dfd | 2022-12-07 16:29:19 +0800 | [diff] [blame] | 169 | vht_link_adapt:3 \ |
| 170 | vht160:2 |
| 171 | |
| 172 | - set_default tx_burst 2.0 |
| 173 | append base_cfg "ieee80211ac=1" "$N" |
| 174 | vht_cap=0 |
| 175 | for cap in $(iw phy "$phy" info | awk -F "[()]" '/VHT Capabilities/ { print $2 }'); do |
developer | d469bb9 | 2024-03-01 08:59:08 +0800 | [diff] [blame^] | 176 | @@ -329,6 +358,12 @@ mac80211_hostapd_setup_base() { |
developer | 785b650 | 2023-04-19 18:31:11 +0800 | [diff] [blame] | 177 | [ "$rx_stbc" -lt "$cap_rx_stbc" ] && cap_rx_stbc="$rx_stbc" |
| 178 | vht_cap="$(( ($vht_cap & ~(0x700)) | ($cap_rx_stbc << 8) ))" |
| 179 | |
| 180 | + [ "$etxbfen" -eq 0 ] && { |
| 181 | + su_beamformer=0 |
| 182 | + su_beamformee=0 |
| 183 | + mu_beamformer=0 |
| 184 | + } |
| 185 | + |
| 186 | mac80211_add_capabilities vht_capab $vht_cap \ |
| 187 | RXLDPC:0x10::$rxldpc \ |
| 188 | SHORT-GI-80:0x20::$short_gi_80 \ |
developer | d469bb9 | 2024-03-01 08:59:08 +0800 | [diff] [blame^] | 189 | @@ -419,10 +454,11 @@ mac80211_hostapd_setup_base() { |
developer | 785b650 | 2023-04-19 18:31:11 +0800 | [diff] [blame] | 190 | he_su_beamformee:1 \ |
| 191 | he_mu_beamformer:1 \ |
| 192 | he_twt_required:0 \ |
| 193 | + he_twt_responder \ |
| 194 | he_spr_sr_control:3 \ |
| 195 | he_spr_psr_enabled:0 \ |
| 196 | he_spr_non_srg_obss_pd_max_offset:0 \ |
| 197 | - he_bss_color:128 \ |
| 198 | + he_bss_color \ |
| 199 | he_bss_color_enabled:1 |
| 200 | |
| 201 | he_phy_cap=$(iw phy "$phy" info | sed -n '/HE Iftypes: AP/,$p' | awk -F "[()]" '/HE PHY Capabilities/ { print $2 }' | head -1) |
developer | d469bb9 | 2024-03-01 08:59:08 +0800 | [diff] [blame^] | 202 | @@ -436,6 +472,11 @@ mac80211_hostapd_setup_base() { |
developer | 785b650 | 2023-04-19 18:31:11 +0800 | [diff] [blame] | 203 | append base_cfg "he_oper_centr_freq_seg0_idx=$vht_center_seg0" "$N" |
| 204 | } |
| 205 | |
| 206 | + [ "$etxbfen" -eq 0 ] && { |
| 207 | + he_su_beamformer=0 |
| 208 | + he_mu_beamformer=0 |
| 209 | + } |
| 210 | + |
| 211 | mac80211_add_he_capabilities \ |
| 212 | he_su_beamformer:${he_phy_cap:6:2}:0x80:$he_su_beamformer \ |
| 213 | he_su_beamformee:${he_phy_cap:8:2}:0x1:$he_su_beamformee \ |
developer | d469bb9 | 2024-03-01 08:59:08 +0800 | [diff] [blame^] | 214 | @@ -443,7 +484,14 @@ mac80211_hostapd_setup_base() { |
developer | 785b650 | 2023-04-19 18:31:11 +0800 | [diff] [blame] | 215 | he_spr_psr_enabled:${he_phy_cap:14:2}:0x1:$he_spr_psr_enabled \ |
| 216 | he_twt_required:${he_mac_cap:0:2}:0x6:$he_twt_required |
| 217 | |
| 218 | + if [ -n "$he_twt_responder" ]; then |
| 219 | + append base_cfg "he_twt_responder=$he_twt_responder" "$N" |
| 220 | + fi |
| 221 | if [ "$he_bss_color_enabled" -gt 0 ]; then |
developer | 830efa7 | 2023-05-18 19:32:48 +0800 | [diff] [blame] | 222 | + if !([ "$he_bss_color" -gt 0 ] && [ "$he_bss_color" -le 64 ]); then |
developer | 785b650 | 2023-04-19 18:31:11 +0800 | [diff] [blame] | 223 | + rand=$(head -n 1 /dev/urandom | tr -dc 0-9 | head -c 2) |
| 224 | + he_bss_color=$((rand % 63 + 1)) |
| 225 | + fi |
| 226 | append base_cfg "he_bss_color=$he_bss_color" "$N" |
| 227 | [ "$he_spr_non_srg_obss_pd_max_offset" -gt 0 ] && { \ |
| 228 | append base_cfg "he_spr_non_srg_obss_pd_max_offset=$he_spr_non_srg_obss_pd_max_offset" "$N" |
developer | d469bb9 | 2024-03-01 08:59:08 +0800 | [diff] [blame^] | 229 | @@ -484,12 +532,21 @@ mac80211_hostapd_setup_base() { |
developer | 8b04dfd | 2022-12-07 16:29:19 +0800 | [diff] [blame] | 230 | append base_cfg "he_mu_edca_ac_vo_timer=255" "$N" |
| 231 | fi |
| 232 | |
developer | 18015ad | 2023-07-13 13:18:19 +0800 | [diff] [blame] | 233 | + set_default tx_burst 2 |
developer | 8b04dfd | 2022-12-07 16:29:19 +0800 | [diff] [blame] | 234 | + |
| 235 | hostapd_prepare_device_config "$hostapd_conf_file" nl80211 |
| 236 | cat >> "$hostapd_conf_file" <<EOF |
| 237 | ${channel:+channel=$channel} |
developer | 0ba09b6 | 2023-03-10 18:43:49 +0800 | [diff] [blame] | 238 | ${channel_list:+chanlist=$channel_list} |
| 239 | ${hostapd_noscan:+noscan=1} |
| 240 | ${tx_burst:+tx_queue_data2_burst=$tx_burst} |
| 241 | +${mbssid:+mbssid=$mbssid} |
developer | 785b650 | 2023-04-19 18:31:11 +0800 | [diff] [blame] | 242 | +${mu_onoff:+mu_onoff=$mu_onoff} |
| 243 | +${itxbfen:+ibf_enable=$itxbfen} |
developer | ee85b6b | 2023-12-22 18:33:35 +0800 | [diff] [blame] | 244 | +${lpi_enable:+lpi_enable=$lpi_enable} |
| 245 | +${sku_idx:+sku_idx=$sku_idx} |
| 246 | +${beacon_dup:+beacon_dup=$beacon_dup} |
developer | 2c6592a | 2023-07-21 11:20:56 +0800 | [diff] [blame] | 247 | +${rnr:+rnr=$rnr} |
developer | 0ba09b6 | 2023-03-10 18:43:49 +0800 | [diff] [blame] | 248 | $base_cfg |
| 249 | |
| 250 | EOF |
developer | d469bb9 | 2024-03-01 08:59:08 +0800 | [diff] [blame^] | 251 | @@ -517,7 +574,7 @@ mac80211_hostapd_setup_bss() { |
developer | 093e1a3 | 2023-02-24 16:10:53 +0800 | [diff] [blame] | 252 | append hostapd_cfg "wds_sta=1" "$N" |
| 253 | [ -n "$wds_bridge" ] && append hostapd_cfg "wds_bridge=$wds_bridge" "$N" |
| 254 | } |
| 255 | - [ "$staidx" -gt 0 -o "$start_disabled" -eq 1 ] && append hostapd_cfg "start_disabled=1" "$N" |
| 256 | + [ "$start_disabled" -eq 1 ] && append hostapd_cfg "start_disabled=1" "$N" |
| 257 | |
| 258 | cat >> /var/run/hostapd-$phy.conf <<EOF |
| 259 | $hostapd_cfg |
developer | d469bb9 | 2024-03-01 08:59:08 +0800 | [diff] [blame^] | 260 | @@ -527,6 +584,31 @@ ${max_listen_int:+max_listen_interval=$max_listen_int} |
developer | 0ba09b6 | 2023-03-10 18:43:49 +0800 | [diff] [blame] | 261 | EOF |
| 262 | } |
| 263 | |
| 264 | +mac80211_generate_mbssid_mac() { |
| 265 | + local phy="$1" |
| 266 | + local transmitted_bssid="$2" |
developer | 1952bcd | 2023-06-20 20:14:37 +0800 | [diff] [blame] | 267 | + local id="${mbssidx:-0}" |
developer | 0ba09b6 | 2023-03-10 18:43:49 +0800 | [diff] [blame] | 268 | + |
| 269 | + local ref="$(cat /sys/class/ieee80211/${phy}/macaddress)" |
developer | 0ba09b6 | 2023-03-10 18:43:49 +0800 | [diff] [blame] | 270 | + |
| 271 | + if [ -z "$transmitted_bssid" ]; then |
| 272 | + transmitted_bssid=$ref |
| 273 | + fi |
| 274 | + |
| 275 | + if [ $id -eq 0 ]; then |
| 276 | + echo "$transmitted_bssid" |
| 277 | + return |
| 278 | + fi |
| 279 | + |
| 280 | + local oIFS="$IFS"; IFS=":"; set -- $transmitted_bssid; IFS="$oIFS" |
| 281 | + |
| 282 | + # Calculate nontransmitted bssid |
developer | 0ba09b6 | 2023-03-10 18:43:49 +0800 | [diff] [blame] | 283 | + b6="0x$6" |
| 284 | + ref_b6=$(($b6 % $max_mbssid)) |
developer | 1952bcd | 2023-06-20 20:14:37 +0800 | [diff] [blame] | 285 | + b6=$(($b6 - $ref_b6 + ($ref_b6 + $id) % $max_mbssid)) |
developer | 0ba09b6 | 2023-03-10 18:43:49 +0800 | [diff] [blame] | 286 | + printf "%s:%s:%s:%s:%s:%02x" $1 $2 $3 $4 $5 $b6 |
| 287 | +} |
| 288 | + |
| 289 | mac80211_get_addr() { |
| 290 | local phy="$1" |
| 291 | local idx="$(($2 + 1))" |
developer | d469bb9 | 2024-03-01 08:59:08 +0800 | [diff] [blame^] | 292 | @@ -757,7 +839,19 @@ mac80211_prepare_vif() { |
developer | 0ba09b6 | 2023-03-10 18:43:49 +0800 | [diff] [blame] | 293 | |
| 294 | json_select .. |
| 295 | |
| 296 | - if [ -z "$macaddr" ]; then |
developer | d2fbd57 | 2023-06-19 19:48:25 +0800 | [diff] [blame] | 297 | + if [ "$mbssid" -gt 0 ] && [ "$mode" == "ap" ]; then |
developer | 1952bcd | 2023-06-20 20:14:37 +0800 | [diff] [blame] | 298 | + [ "$mbssidx" -eq 0 ] && { |
| 299 | + if [ -z $macaddr ]; then |
| 300 | + transmitted_bssid="$(mac80211_generate_mac $phy)" |
| 301 | + else |
| 302 | + # uci set mac address |
| 303 | + transmitted_bssid=$macaddr |
| 304 | + fi |
| 305 | + macidx="$(($macidx + 1))" |
developer | 0ba09b6 | 2023-03-10 18:43:49 +0800 | [diff] [blame] | 306 | + } |
| 307 | + macaddr="$(mac80211_generate_mbssid_mac $phy $transmitted_bssid)" |
developer | 1952bcd | 2023-06-20 20:14:37 +0800 | [diff] [blame] | 308 | + mbssidx="$(($mbssidx + 1))" |
developer | 0ba09b6 | 2023-03-10 18:43:49 +0800 | [diff] [blame] | 309 | + elif [ -z "$macaddr" ]; then |
| 310 | macaddr="$(mac80211_generate_mac $phy)" |
| 311 | macidx="$(($macidx + 1))" |
| 312 | elif [ "$macaddr" = 'random' ]; then |
developer | d469bb9 | 2024-03-01 08:59:08 +0800 | [diff] [blame^] | 313 | @@ -1058,6 +1152,9 @@ mac80211_setup_vif() { |
developer | f0de14b | 2022-12-14 23:07:34 +0800 | [diff] [blame] | 314 | |
| 315 | json_select .. |
| 316 | [ -n "$failed" ] || wireless_add_vif "$name" "$ifname" |
| 317 | + |
| 318 | + echo "Setup SMP Affinity" |
| 319 | + /sbin/smp-mt76.sh |
| 320 | } |
| 321 | |
| 322 | get_freq() { |
developer | d469bb9 | 2024-03-01 08:59:08 +0800 | [diff] [blame^] | 323 | @@ -1122,6 +1219,25 @@ drv_mac80211_cleanup() { |
developer | 0ba09b6 | 2023-03-10 18:43:49 +0800 | [diff] [blame] | 324 | hostapd_common_cleanup |
| 325 | } |
| 326 | |
| 327 | +mac80211_count_ap() { |
| 328 | + total_num_ap=$(($total_num_ap + 1)) |
| 329 | +} |
| 330 | + |
developer | 6cfee68 | 2023-11-27 19:34:42 +0800 | [diff] [blame] | 331 | +country_consistent_check() { |
| 332 | + local i |
| 333 | + inconsistent_country=0 |
| 334 | + country_list="$(cat /etc/config/wireless | grep country | cut -d ' ' -f3 | tr -s "'\n" ' ')" |
| 335 | + for i in $country_list |
| 336 | + do |
| 337 | + ret="$(echo $country_list | awk '{print ($2 == "" || $1 == $2)}')" |
| 338 | + [ $ret = '0' ] && { |
| 339 | + inconsistent_country=1 |
| 340 | + return |
| 341 | + } |
| 342 | + country_list="$(echo $country_list | sed -r 's/[A-Z]{2}( )*//')" |
| 343 | + done |
| 344 | +} |
| 345 | + |
developer | 0ba09b6 | 2023-03-10 18:43:49 +0800 | [diff] [blame] | 346 | drv_mac80211_setup() { |
| 347 | json_select config |
| 348 | json_get_vars \ |
developer | d469bb9 | 2024-03-01 08:59:08 +0800 | [diff] [blame^] | 349 | @@ -1129,7 +1245,8 @@ drv_mac80211_setup() { |
developer | 7450311 | 2023-06-29 17:34:49 +0800 | [diff] [blame] | 350 | country chanbw distance \ |
| 351 | txpower antenna_gain \ |
| 352 | rxantenna txantenna \ |
| 353 | - frag rts beacon_int:100 htmode |
| 354 | + frag rts beacon_int:100 htmode \ |
| 355 | + sr_enable sr_enhanced |
| 356 | json_get_values basic_rate_list basic_rate |
| 357 | json_get_values scan_list scan_list |
| 358 | json_select .. |
developer | d469bb9 | 2024-03-01 08:59:08 +0800 | [diff] [blame^] | 359 | @@ -1180,6 +1297,7 @@ drv_mac80211_setup() { |
developer | 1952bcd | 2023-06-20 20:14:37 +0800 | [diff] [blame] | 360 | no_ap=1 |
| 361 | macidx=0 |
| 362 | staidx=0 |
| 363 | + mbssidx=0 |
| 364 | |
| 365 | [ -n "$chanbw" ] && { |
| 366 | for file in /sys/kernel/debug/ieee80211/$phy/ath9k*/chanbw /sys/kernel/debug/ieee80211/$phy/ath5k/bwmode; do |
developer | d469bb9 | 2024-03-01 08:59:08 +0800 | [diff] [blame^] | 367 | @@ -1219,6 +1337,16 @@ drv_mac80211_setup() { |
developer | 0ba09b6 | 2023-03-10 18:43:49 +0800 | [diff] [blame] | 368 | for_each_interface "sta adhoc mesh" mac80211_set_noscan |
| 369 | [ -n "$has_ap" ] && mac80211_hostapd_setup_base "$phy" |
| 370 | |
| 371 | + total_num_ap=0 |
| 372 | + max_mbssid=1 |
| 373 | + for_each_interface "ap" mac80211_count_ap |
| 374 | + total_num_ap=$(($total_num_ap - 1)) |
| 375 | + while [ $total_num_ap -gt 0 ] |
| 376 | + do |
| 377 | + total_num_ap=$(($total_num_ap >> 1)) |
| 378 | + max_mbssid=$(($max_mbssid << 1)) |
| 379 | + done |
| 380 | + |
| 381 | mac80211_prepare_iw_htmode |
| 382 | for_each_interface "sta adhoc mesh monitor" mac80211_prepare_vif |
| 383 | NEWAPLIST= |
developer | d469bb9 | 2024-03-01 08:59:08 +0800 | [diff] [blame^] | 384 | @@ -1249,8 +1377,22 @@ drv_mac80211_setup() { |
developer | 6cfee68 | 2023-11-27 19:34:42 +0800 | [diff] [blame] | 385 | } |
| 386 | fi |
developer | ad1f317 | 2023-05-02 11:10:08 +0800 | [diff] [blame] | 387 | if [ "$no_reload" != "0" ]; then |
developer | 6cfee68 | 2023-11-27 19:34:42 +0800 | [diff] [blame] | 388 | + country_consistent_check |
| 389 | + if [ "$inconsistent_country" == "1" ]; then |
| 390 | + echo "ERROR: Please use the same country for all the radios." |
| 391 | + wireless_setup_failed HOSTAPD_START_FAILED |
| 392 | + return |
| 393 | + fi |
developer | ad1f317 | 2023-05-02 11:10:08 +0800 | [diff] [blame] | 394 | add_ap=1 |
| 395 | ubus wait_for hostapd |
| 396 | + |
| 397 | + # each phy sleeps different times to prevent for ubus race condition. |
| 398 | + if [ "$phy" = "phy1" ]; then |
| 399 | + sleep 1; |
| 400 | + elif [ "$phy" = "phy2" ]; then |
| 401 | + sleep 2; |
| 402 | + fi |
| 403 | + |
| 404 | local hostapd_res="$(ubus call hostapd config_add "{\"iface\":\"$primary_ap\", \"config\":\"${hostapd_conf_file}\"}")" |
| 405 | ret="$?" |
| 406 | [ "$ret" != 0 -o -z "$hostapd_res" ] && { |
developer | d469bb9 | 2024-03-01 08:59:08 +0800 | [diff] [blame^] | 407 | @@ -1266,6 +1408,9 @@ drv_mac80211_setup() { |
developer | 7450311 | 2023-06-29 17:34:49 +0800 | [diff] [blame] | 408 | [ "${add_ap}" = 1 ] && sleep 1 |
| 409 | for_each_interface "ap" mac80211_setup_vif |
| 410 | |
| 411 | + [ -n "$sr_enable" ] && echo "$sr_enable" > /sys/kernel/debug/ieee80211/$phy/mt76/sr_enable |
| 412 | + [ -n "$sr_enhanced" ] && echo "$sr_enhanced" > /sys/kernel/debug/ieee80211/$phy/mt76/sr_enhanced_enable |
| 413 | + |
| 414 | NEWSPLIST= |
| 415 | NEWUMLIST= |
| 416 | |
developer | 9b3248d | 2022-07-06 00:44:05 +0800 | [diff] [blame] | 417 | diff --git a/package/kernel/mac80211/files/lib/wifi/mac80211.sh b/package/kernel/mac80211/files/lib/wifi/mac80211.sh |
developer | d469bb9 | 2024-03-01 08:59:08 +0800 | [diff] [blame^] | 418 | index 3ecd932..0ce1fc1 100644 |
developer | e2597ba | 2022-06-24 13:09:16 +0800 | [diff] [blame] | 419 | --- a/package/kernel/mac80211/files/lib/wifi/mac80211.sh |
| 420 | +++ b/package/kernel/mac80211/files/lib/wifi/mac80211.sh |
developer | d469bb9 | 2024-03-01 08:59:08 +0800 | [diff] [blame^] | 421 | @@ -46,8 +46,13 @@ check_mac80211_device() { |
| 422 | |
| 423 | |
| 424 | __get_band_defaults() { |
| 425 | + local mt7915=0 |
| 426 | local phy="$1" |
| 427 | |
| 428 | + if (lspci | grep -q "7915"); then |
| 429 | + mt7915=1 |
| 430 | + fi |
| 431 | + |
| 432 | ( iw phy "$phy" info; echo ) | awk ' |
| 433 | BEGIN { |
| 434 | bands = "" |
| 435 | @@ -58,12 +63,12 @@ BEGIN { |
| 436 | mode="NOHT" |
| 437 | if (ht) mode="HT20" |
developer | 785b650 | 2023-04-19 18:31:11 +0800 | [diff] [blame] | 438 | if (vht && band != "1:") mode="VHT80" |
developer | d469bb9 | 2024-03-01 08:59:08 +0800 | [diff] [blame^] | 439 | - if (he) mode="HE80" |
| 440 | + if (he) mode="HE160" |
| 441 | + if (he && mt7915) mode="HE80" |
| 442 | + if (he && (lspci | grep -q "7915")); then |
| 443 | + mode="HE80" |
| 444 | + fi |
developer | 785b650 | 2023-04-19 18:31:11 +0800 | [diff] [blame] | 445 | if (he && band == "1:") mode="HE20" |
developer | d469bb9 | 2024-03-01 08:59:08 +0800 | [diff] [blame^] | 446 | - sub("\\[", "", channel) |
| 447 | - sub("\\]", "", channel) |
| 448 | - bands = bands band channel ":" mode " " |
| 449 | - } |
| 450 | band="" |
developer | 785b650 | 2023-04-19 18:31:11 +0800 | [diff] [blame] | 451 | } |
| 452 | |
developer | d469bb9 | 2024-03-01 08:59:08 +0800 | [diff] [blame^] | 453 | @@ -87,6 +92,11 @@ $0 ~ "HE Iftypes" { |
developer | 785b650 | 2023-04-19 18:31:11 +0800 | [diff] [blame] | 454 | he=1 |
| 455 | } |
| 456 | |
developer | 20ce7bd | 2023-05-20 13:25:14 +0800 | [diff] [blame] | 457 | +$0 ~ / *HE MAC Capabilities \(0x000000000000\)/ { |
| 458 | + he=0 |
| 459 | +} |
| 460 | + |
developer | 20ce7bd | 2023-05-20 13:25:14 +0800 | [diff] [blame] | 461 | + |
developer | 785b650 | 2023-04-19 18:31:11 +0800 | [diff] [blame] | 462 | $1 == "*" && $3 == "MHz" && $0 !~ /disabled/ && band && !channel { |
| 463 | channel = $4 |
| 464 | } |
developer | d469bb9 | 2024-03-01 08:59:08 +0800 | [diff] [blame^] | 465 | @@ -120,6 +130,20 @@ get_band_defaults() { |
developer | e2597ba | 2022-06-24 13:09:16 +0800 | [diff] [blame] | 466 | mode_band="$band" |
| 467 | channel="$chan" |
| 468 | htmode="$mode" |
| 469 | + if [ "$band" = "6g" ] |
| 470 | + then |
| 471 | + encryption=sae |
| 472 | + key=12345678 |
developer | 20ce7bd | 2023-05-20 13:25:14 +0800 | [diff] [blame] | 473 | + sae_pwe=2 |
| 474 | + ieee80211w=2 |
developer | adbb45b | 2023-06-09 14:43:01 +0800 | [diff] [blame] | 475 | + channel=37 |
| 476 | + mbssid=1 |
developer | f7aff42 | 2023-11-14 11:11:34 +0800 | [diff] [blame] | 477 | + mbo=1 |
developer | e2597ba | 2022-06-24 13:09:16 +0800 | [diff] [blame] | 478 | + else |
developer | 659b07e | 2023-05-25 12:34:13 +0800 | [diff] [blame] | 479 | + noscan=1 |
developer | e2597ba | 2022-06-24 13:09:16 +0800 | [diff] [blame] | 480 | + encryption=none |
developer | 2c6592a | 2023-07-21 11:20:56 +0800 | [diff] [blame] | 481 | + rnr=1 |
developer | e2597ba | 2022-06-24 13:09:16 +0800 | [diff] [blame] | 482 | + fi |
| 483 | done |
| 484 | } |
| 485 | |
developer | d469bb9 | 2024-03-01 08:59:08 +0800 | [diff] [blame^] | 486 | @@ -153,6 +177,10 @@ detect_mac80211() { |
developer | 785b650 | 2023-04-19 18:31:11 +0800 | [diff] [blame] | 487 | |
| 488 | json_load_file /etc/board.json |
| 489 | |
| 490 | + # generate random bytes for macaddr |
| 491 | + rand=$(hexdump -C /dev/urandom | head -n 1 &) |
| 492 | + killall hexdump |
| 493 | + |
| 494 | for _dev in /sys/class/ieee80211/*; do |
| 495 | [ -e "$_dev" ] || continue |
| 496 | |
developer | d469bb9 | 2024-03-01 08:59:08 +0800 | [diff] [blame^] | 497 | @@ -162,6 +190,13 @@ detect_mac80211() { |
developer | e2597ba | 2022-06-24 13:09:16 +0800 | [diff] [blame] | 498 | channel="" |
| 499 | htmode="" |
| 500 | ht_capab="" |
| 501 | + encryption="" |
developer | 659b07e | 2023-05-25 12:34:13 +0800 | [diff] [blame] | 502 | + noscan="" |
developer | e2597ba | 2022-06-24 13:09:16 +0800 | [diff] [blame] | 503 | + key="" |
developer | 0925793 | 2023-05-09 13:41:30 +0800 | [diff] [blame] | 504 | + sae_pwe="" |
developer | 20ce7bd | 2023-05-20 13:25:14 +0800 | [diff] [blame] | 505 | + ieee80211w="" |
developer | adbb45b | 2023-06-09 14:43:01 +0800 | [diff] [blame] | 506 | + mbssid="" |
developer | 2c6592a | 2023-07-21 11:20:56 +0800 | [diff] [blame] | 507 | + rnr="" |
developer | e2597ba | 2022-06-24 13:09:16 +0800 | [diff] [blame] | 508 | |
| 509 | get_band_defaults "$dev" |
| 510 | |
developer | d469bb9 | 2024-03-01 08:59:08 +0800 | [diff] [blame^] | 511 | @@ -192,6 +227,14 @@ detect_mac80211() { |
developer | 785b650 | 2023-04-19 18:31:11 +0800 | [diff] [blame] | 512 | ;; |
| 513 | esac |
| 514 | |
developer | 212c0d8 | 2023-07-13 19:41:47 +0800 | [diff] [blame] | 515 | + macaddr="" |
developer | 1325ba7 | 2023-06-26 13:43:31 +0800 | [diff] [blame] | 516 | + if (dmesg | grep -q "eeprom load fail"); then |
developer | 1952bcd | 2023-06-20 20:14:37 +0800 | [diff] [blame] | 517 | + for i in $(seq 2 3); do |
| 518 | + macaddr=${macaddr}:$(echo $rand | cut -d ' ' -f $i) |
| 519 | + done |
| 520 | + macaddr="00:0$(($devidx - 1)):55:66${macaddr}" |
developer | 1952bcd | 2023-06-20 20:14:37 +0800 | [diff] [blame] | 521 | + fi |
developer | 785b650 | 2023-04-19 18:31:11 +0800 | [diff] [blame] | 522 | + |
| 523 | uci -q batch <<-EOF |
| 524 | set wireless.${name}=wifi-device |
| 525 | set wireless.${name}.type=mac80211 |
developer | d469bb9 | 2024-03-01 08:59:08 +0800 | [diff] [blame^] | 526 | @@ -199,15 +242,43 @@ detect_mac80211() { |
developer | 0925793 | 2023-05-09 13:41:30 +0800 | [diff] [blame] | 527 | set wireless.${name}.channel=${channel} |
| 528 | set wireless.${name}.band=${mode_band} |
| 529 | set wireless.${name}.htmode=$htmode |
| 530 | - set wireless.${name}.disabled=1 |
developer | 20ce7bd | 2023-05-20 13:25:14 +0800 | [diff] [blame] | 531 | + set wireless.${name}.country='US' |
developer | 659b07e | 2023-05-25 12:34:13 +0800 | [diff] [blame] | 532 | + set wireless.${name}.noscan=${noscan} |
developer | 0925793 | 2023-05-09 13:41:30 +0800 | [diff] [blame] | 533 | + set wireless.${name}.disabled=0 |
developer | adbb45b | 2023-06-09 14:43:01 +0800 | [diff] [blame] | 534 | +EOF |
| 535 | + [ -n "$mbssid" ] && { |
| 536 | + uci -q set wireless.${name}.mbssid=${mbssid} |
| 537 | + } |
developer | 2c6592a | 2023-07-21 11:20:56 +0800 | [diff] [blame] | 538 | + [ -n "$rnr" ] && { |
| 539 | + uci -q set wireless.${name}.rnr=${rnr} |
| 540 | + } |
developer | 0925793 | 2023-05-09 13:41:30 +0800 | [diff] [blame] | 541 | |
developer | adbb45b | 2023-06-09 14:43:01 +0800 | [diff] [blame] | 542 | + uci -q batch <<-EOF |
developer | 0925793 | 2023-05-09 13:41:30 +0800 | [diff] [blame] | 543 | set wireless.default_${name}=wifi-iface |
| 544 | set wireless.default_${name}.device=${name} |
developer | 8d77be3 | 2022-10-20 15:08:25 +0800 | [diff] [blame] | 545 | set wireless.default_${name}.network=lan |
| 546 | set wireless.default_${name}.mode=ap |
developer | 0925793 | 2023-05-09 13:41:30 +0800 | [diff] [blame] | 547 | - set wireless.default_${name}.ssid=OpenWrt |
developer | 8d77be3 | 2022-10-20 15:08:25 +0800 | [diff] [blame] | 548 | - set wireless.default_${name}.encryption=none |
developer | 0925793 | 2023-05-09 13:41:30 +0800 | [diff] [blame] | 549 | + set wireless.default_${name}.ssid=OpenWrt-${mode_band} |
developer | 8d77be3 | 2022-10-20 15:08:25 +0800 | [diff] [blame] | 550 | + set wireless.default_${name}.encryption=${encryption} |
developer | e2597ba | 2022-06-24 13:09:16 +0800 | [diff] [blame] | 551 | EOF |
developer | 212c0d8 | 2023-07-13 19:41:47 +0800 | [diff] [blame] | 552 | + |
| 553 | + # calibrated board will use eeprom macaddress, not ramdom address |
| 554 | + [ -n "$macaddr" ] && { |
| 555 | + uci -q set wireless.default_${name}.macaddr=${macaddr} |
| 556 | + } |
| 557 | + |
developer | e2597ba | 2022-06-24 13:09:16 +0800 | [diff] [blame] | 558 | + [ -n "$key" ] && { |
developer | 8d77be3 | 2022-10-20 15:08:25 +0800 | [diff] [blame] | 559 | + uci -q set wireless.default_${name}.key=${key} |
developer | e2597ba | 2022-06-24 13:09:16 +0800 | [diff] [blame] | 560 | + } |
developer | 0925793 | 2023-05-09 13:41:30 +0800 | [diff] [blame] | 561 | + [ -n "$sae_pwe" ] && { |
| 562 | + uci -q set wireless.default_${name}.sae_pwe=${sae_pwe} |
| 563 | + } |
developer | 20ce7bd | 2023-05-20 13:25:14 +0800 | [diff] [blame] | 564 | + [ -n "$ieee80211w" ] && { |
| 565 | + uci -q set wireless.default_${name}.ieee80211w=${ieee80211w} |
| 566 | + } |
developer | f7aff42 | 2023-11-14 11:11:34 +0800 | [diff] [blame] | 567 | + [ -n "$mbo" ] && { |
| 568 | + uci -q set wireless.default_${name}.mbo=${mbo} |
| 569 | + } |
developer | e2597ba | 2022-06-24 13:09:16 +0800 | [diff] [blame] | 570 | uci -q commit wireless |
developer | 8d77be3 | 2022-10-20 15:08:25 +0800 | [diff] [blame] | 571 | done |
| 572 | } |
developer | 85839fe | 2023-02-23 10:32:51 +0800 | [diff] [blame] | 573 | diff --git a/package/network/services/hostapd/files/hostapd.sh b/package/network/services/hostapd/files/hostapd.sh |
developer | d469bb9 | 2024-03-01 08:59:08 +0800 | [diff] [blame^] | 574 | index 28bd210..723d387 100644 |
developer | 85839fe | 2023-02-23 10:32:51 +0800 | [diff] [blame] | 575 | --- a/package/network/services/hostapd/files/hostapd.sh |
| 576 | +++ b/package/network/services/hostapd/files/hostapd.sh |
developer | 7450311 | 2023-06-29 17:34:49 +0800 | [diff] [blame] | 577 | @@ -60,7 +60,14 @@ hostapd_append_wpa_key_mgmt() { |
| 578 | [ "${ieee80211w:-0}" -gt 0 ] && append wpa_key_mgmt "WPA-EAP-SHA256" |
| 579 | ;; |
| 580 | sae) |
| 581 | - append wpa_key_mgmt "SAE" |
| 582 | + case "$encryption" in |
| 583 | + *sae-ext*) |
| 584 | + append wpa_key_mgmt "SAE-EXT-KEY" |
| 585 | + ;; |
| 586 | + *) |
| 587 | + append wpa_key_mgmt "SAE" |
| 588 | + ;; |
| 589 | + esac |
| 590 | [ "${ieee80211r:-0}" -gt 0 ] && append wpa_key_mgmt "FT-SAE" |
| 591 | ;; |
| 592 | psk-sae) |
| 593 | @@ -115,6 +122,7 @@ hostapd_common_add_device_config() { |
| 594 | config_add_int rts_threshold |
| 595 | config_add_int rssi_reject_assoc_rssi |
| 596 | config_add_int rssi_ignore_probe_request |
| 597 | + config_add_int rssi_reject_assoc_timeout |
| 598 | config_add_int maxassoc |
| 599 | |
| 600 | config_add_string acs_chan_bias |
developer | 5ad8986 | 2023-08-24 08:17:27 +0800 | [diff] [blame] | 601 | @@ -225,8 +233,10 @@ hostapd_prepare_device_config() { |
developer | 7450311 | 2023-06-29 17:34:49 +0800 | [diff] [blame] | 602 | hostapd_add_rate brlist "$br" |
| 603 | done |
| 604 | |
| 605 | + json_get_vars rssi_reject_assoc_timeout |
| 606 | [ -n "$rssi_reject_assoc_rssi" ] && append base_cfg "rssi_reject_assoc_rssi=$rssi_reject_assoc_rssi" "$N" |
| 607 | [ -n "$rssi_ignore_probe_request" ] && append base_cfg "rssi_ignore_probe_request=$rssi_ignore_probe_request" "$N" |
| 608 | + [ -n "$rssi_reject_assoc_timeout" ] && append base_cfg "rssi_reject_assoc_timeout=$rssi_reject_assoc_timeout" "$N" |
| 609 | [ -n "$beacon_rate" ] && append base_cfg "beacon_rate=$beacon_rate" "$N" |
| 610 | [ -n "$rlist" ] && append base_cfg "supported_rates=$rlist" "$N" |
| 611 | [ -n "$brlist" ] && append base_cfg "basic_rates=$brlist" "$N" |
developer | d469bb9 | 2024-03-01 08:59:08 +0800 | [diff] [blame^] | 612 | @@ -376,6 +386,24 @@ hostapd_common_add_bss_config() { |
developer | 8240889 | 2023-03-27 15:09:00 +0800 | [diff] [blame] | 613 | config_add_string fils_dhcp |
| 614 | |
| 615 | config_add_int ocv |
| 616 | + |
developer | 8240889 | 2023-03-27 15:09:00 +0800 | [diff] [blame] | 617 | + config_add_int disable_he |
| 618 | + config_add_int disable_vht |
| 619 | + config_add_int disable_ht |
developer | 813f5d7 | 2023-03-28 17:44:38 +0800 | [diff] [blame] | 620 | + |
developer | f166f54 | 2023-05-25 14:40:30 +0800 | [diff] [blame] | 621 | + config_add_boolean beacon_prot interworking |
developer | 7450311 | 2023-06-29 17:34:49 +0800 | [diff] [blame] | 622 | + |
| 623 | + config_add_int unsol_bcast_probe_resp_interval |
| 624 | + config_add_int fils_discovery_min_interval |
| 625 | + config_add_int fils_discovery_max_interval |
| 626 | + config_add_boolean rnr |
| 627 | + |
| 628 | + config_add_array sae_groups |
| 629 | + config_add_array owe_groups |
| 630 | + config_add_array pairwise |
| 631 | + config_add_string group_cipher |
developer | 875fbb7 | 2023-12-13 15:49:01 +0800 | [diff] [blame] | 632 | + config_add_string group_mgmt_cipher |
developer | 7450311 | 2023-06-29 17:34:49 +0800 | [diff] [blame] | 633 | + |
developer | 8240889 | 2023-03-27 15:09:00 +0800 | [diff] [blame] | 634 | } |
| 635 | |
| 636 | hostapd_set_vlan_file() { |
developer | d469bb9 | 2024-03-01 08:59:08 +0800 | [diff] [blame^] | 637 | @@ -440,11 +468,11 @@ append_iw_nai_realm() { |
developer | f166f54 | 2023-05-25 14:40:30 +0800 | [diff] [blame] | 638 | } |
| 639 | |
| 640 | append_iw_venue_name() { |
| 641 | - append bss_conf "venue_name=$1" "$N" |
| 642 | + [ -n "$1" ] && append bss_conf "venue_name=$1" "$N" |
| 643 | } |
| 644 | |
| 645 | append_iw_venue_url() { |
| 646 | - append bss_conf "venue_url=$1" "$N" |
| 647 | + [ -n "$1" ] && append bss_conf "venue_url=$1" "$N" |
| 648 | } |
| 649 | |
| 650 | append_hs20_oper_friendly_name() { |
developer | d469bb9 | 2024-03-01 08:59:08 +0800 | [diff] [blame^] | 651 | @@ -562,7 +590,8 @@ hostapd_set_bss_options() { |
developer | 7450311 | 2023-06-29 17:34:49 +0800 | [diff] [blame] | 652 | ppsk airtime_bss_weight airtime_bss_limit airtime_sta_weight \ |
| 653 | multicast_to_unicast_all proxy_arp per_sta_vif \ |
| 654 | eap_server eap_user_file ca_cert server_cert private_key private_key_passwd server_id \ |
| 655 | - vendor_elements fils ocv |
| 656 | + vendor_elements fils ocv unsol_bcast_probe_resp_interval fils_discovery_min_interval \ |
developer | 875fbb7 | 2023-12-13 15:49:01 +0800 | [diff] [blame] | 657 | + fils_discovery_max_interval rnr group_cipher group_mgmt_cipher |
developer | 7450311 | 2023-06-29 17:34:49 +0800 | [diff] [blame] | 658 | |
| 659 | set_default fils 0 |
| 660 | set_default isolate 0 |
developer | d469bb9 | 2024-03-01 08:59:08 +0800 | [diff] [blame^] | 661 | @@ -790,6 +819,36 @@ hostapd_set_bss_options() { |
developer | 7450311 | 2023-06-29 17:34:49 +0800 | [diff] [blame] | 662 | local auth_algs="$((($auth_mode_shared << 1) | $auth_mode_open))" |
| 663 | append bss_conf "auth_algs=${auth_algs:-1}" "$N" |
| 664 | append bss_conf "wpa=$wpa" "$N" |
| 665 | + |
| 666 | + json_get_values pairwise pairwise |
developer | 945ed99 | 2023-10-25 15:01:32 +0800 | [diff] [blame] | 667 | + json_get_vars group_cipher |
developer | 9097e5e | 2023-07-19 10:22:24 +0800 | [diff] [blame] | 668 | + if [ -n "$pairwise" ]; then |
| 669 | + case "$pairwise" in |
| 670 | + *tkip+aes|*tkip+ccmp|*aes+tkip|*ccmp+tkip) |
| 671 | + wpa_cipher="CCMP TKIP" |
| 672 | + ;; |
| 673 | + *ccmp256) |
| 674 | + wpa_cipher="CCMP-256" |
| 675 | + ;; |
| 676 | + *aes|*ccmp) |
| 677 | + wpa_cipher="CCMP" |
| 678 | + ;; |
| 679 | + *tkip) |
| 680 | + wpa_cipher="TKIP" |
| 681 | + ;; |
| 682 | + *gcmp256) |
| 683 | + wpa_cipher="GCMP-256" |
| 684 | + ;; |
| 685 | + *gcmp) |
| 686 | + wpa_cipher="GCMP" |
| 687 | + ;; |
| 688 | + *) |
| 689 | + wpa_cipher="" |
| 690 | + ;; |
| 691 | + esac |
| 692 | + fi |
developer | 7450311 | 2023-06-29 17:34:49 +0800 | [diff] [blame] | 693 | + [ -n "$wpa_cipher" ] && wpa_pairwise="$wpa_cipher" |
| 694 | + |
| 695 | [ -n "$wpa_pairwise" ] && append bss_conf "wpa_pairwise=$wpa_pairwise" "$N" |
| 696 | |
| 697 | set_default wps_pushbutton 0 |
developer | d469bb9 | 2024-03-01 08:59:08 +0800 | [diff] [blame^] | 698 | @@ -841,7 +900,7 @@ hostapd_set_bss_options() { |
developer | da72319 | 2023-05-22 19:46:10 +0800 | [diff] [blame] | 699 | } |
| 700 | |
| 701 | append bss_conf "ssid=$ssid" "$N" |
| 702 | - [ -n "$network_bridge" ] && append bss_conf "bridge=$network_bridge${N}wds_bridge=" "$N" |
| 703 | + [ -n "$network_bridge" ] && append bss_conf "bridge=$network_bridge${N}wds_bridge=$network_bridge" "$N" |
| 704 | [ -n "$network_ifname" ] && append bss_conf "snoop_iface=$network_ifname" "$N" |
| 705 | [ -n "$iapp_interface" ] && { |
| 706 | local ifname |
developer | d469bb9 | 2024-03-01 08:59:08 +0800 | [diff] [blame^] | 707 | @@ -954,6 +1013,8 @@ hostapd_set_bss_options() { |
developer | 7450311 | 2023-06-29 17:34:49 +0800 | [diff] [blame] | 708 | fi |
| 709 | |
| 710 | if [ "$wpa" -ge "2" ]; then |
| 711 | + json_get_values sae_groups sae_groups |
| 712 | + json_get_values owe_groups owe_groups |
| 713 | if [ -n "$network_bridge" -a "$rsn_preauth" = 1 ]; then |
| 714 | set_default auth_cache 1 |
| 715 | append bss_conf "rsn_preauth=1" "$N" |
developer | d469bb9 | 2024-03-01 08:59:08 +0800 | [diff] [blame^] | 716 | @@ -972,17 +1033,52 @@ hostapd_set_bss_options() { |
developer | 7450311 | 2023-06-29 17:34:49 +0800 | [diff] [blame] | 717 | append bss_conf "okc=$auth_cache" "$N" |
| 718 | [ "$auth_cache" = 0 -a "$fils" = 0 ] && append bss_conf "disable_pmksa_caching=1" "$N" |
| 719 | |
| 720 | + [ -z "$group_cipher" ] && group_cipher="$wpa_cipher" |
| 721 | + |
| 722 | + if [ -n "$sae_groups" -o -n "$owe_groups" ]; then |
| 723 | + case "$auth_type" in |
| 724 | + sae*) |
| 725 | + append bss_conf "sae_groups=$sae_groups" "$N" |
| 726 | + append bss_conf "group_cipher=$group_cipher" "$N" |
| 727 | + ;; |
| 728 | + owe) |
| 729 | + append bss_conf "owe_groups=$owe_groups" "$N" |
| 730 | + append bss_conf "group_cipher=$group_cipher" "$N" |
| 731 | + ;; |
| 732 | + esac |
| 733 | + fi |
| 734 | + |
developer | 813f5d7 | 2023-03-28 17:44:38 +0800 | [diff] [blame] | 735 | # RSN -> allow management frame protection |
| 736 | case "$ieee80211w" in |
| 737 | [012]) |
| 738 | - json_get_vars ieee80211w_mgmt_cipher ieee80211w_max_timeout ieee80211w_retry_timeout |
| 739 | + json_get_vars ieee80211w_mgmt_cipher ieee80211w_max_timeout ieee80211w_retry_timeout beacon_prot |
| 740 | append bss_conf "ieee80211w=$ieee80211w" "$N" |
| 741 | [ "$ieee80211w" -gt "0" ] && { |
developer | 875fbb7 | 2023-12-13 15:49:01 +0800 | [diff] [blame] | 742 | + if [ -z "$group_mgmt_cipher" ]; then |
| 743 | + case "$group_cipher" in |
| 744 | + CCMP-256) |
| 745 | + ieee80211w_mgmt_cipher="BIP-CMAC-256" |
| 746 | + ;; |
| 747 | + CCMP) |
| 748 | + ieee80211w_mgmt_cipher="AES-128-CMAC" |
| 749 | + ;; |
| 750 | + GCMP-256) |
| 751 | + ieee80211w_mgmt_cipher="BIP-GMAC-256" |
| 752 | + ;; |
| 753 | + GCMP) |
| 754 | + ieee80211w_mgmt_cipher="BIP-GMAC-128" |
| 755 | + ;; |
| 756 | + esac |
| 757 | + else |
| 758 | + ieee80211w_mgmt_cipher="$group_mgmt_cipher" |
| 759 | + fi |
developer | 813f5d7 | 2023-03-28 17:44:38 +0800 | [diff] [blame] | 760 | if [ "$auth_type" = "eap192" ]; then |
developer | 7450311 | 2023-06-29 17:34:49 +0800 | [diff] [blame] | 761 | append bss_conf "group_mgmt_cipher=BIP-GMAC-256" "$N" |
developer | 813f5d7 | 2023-03-28 17:44:38 +0800 | [diff] [blame] | 762 | else |
| 763 | append bss_conf "group_mgmt_cipher=${ieee80211w_mgmt_cipher:-AES-128-CMAC}" "$N" |
| 764 | fi |
| 765 | + [ -n "$beacon_prot" ] && \ |
| 766 | + append bss_conf "beacon_prot=$beacon_prot" "$N" |
| 767 | [ -n "$ieee80211w_max_timeout" ] && \ |
| 768 | append bss_conf "assoc_sa_query_max_timeout=$ieee80211w_max_timeout" "$N" |
| 769 | [ -n "$ieee80211w_retry_timeout" ] && \ |
developer | d469bb9 | 2024-03-01 08:59:08 +0800 | [diff] [blame^] | 770 | @@ -1047,9 +1143,10 @@ hostapd_set_bss_options() { |
developer | f166f54 | 2023-05-25 14:40:30 +0800 | [diff] [blame] | 771 | json_get_vars iw_roaming_consortium iw_domain_name iw_anqp_3gpp_cell_net iw_nai_realm |
| 772 | json_get_vars iw_anqp_elem iw_qos_map_set iw_ipaddr_type_availability iw_gas_address3 |
| 773 | json_get_vars iw_venue_name iw_venue_url |
| 774 | + json_get_vars interworking |
| 775 | |
| 776 | set_default iw_enabled 0 |
| 777 | - if [ "$iw_enabled" = "1" ]; then |
| 778 | + if [ "$iw_enabled" = "1" ] || [ "$interworking" = "1" ]; then |
| 779 | append bss_conf "interworking=1" "$N" |
| 780 | set_default iw_internet 1 |
| 781 | set_default iw_asra 0 |
developer | d469bb9 | 2024-03-01 08:59:08 +0800 | [diff] [blame^] | 782 | @@ -1156,6 +1253,22 @@ hostapd_set_bss_options() { |
developer | 7450311 | 2023-06-29 17:34:49 +0800 | [diff] [blame] | 783 | append bss_conf "$val" "$N" |
| 784 | done |
| 785 | |
| 786 | + if [ "$unsol_bcast_probe_resp_interval" -gt 0 ]; then |
| 787 | + append bss_conf "unsol_bcast_probe_resp_interval=$unsol_bcast_probe_resp_interval" "$N" |
| 788 | + fi |
| 789 | + |
| 790 | + if [ -n "$fils_discovery_min_interval" ]; then |
| 791 | + append bss_conf "fils_discovery_min_interval=$fils_discovery_min_interval" "$N" |
| 792 | + fi |
| 793 | + |
| 794 | + if [ -n "$fils_discovery_max_interval" ]; then |
| 795 | + append bss_conf "fils_discovery_max_interval=$fils_discovery_max_interval" "$N" |
| 796 | + fi |
| 797 | + |
| 798 | + if [ -n "$rnr" ]; then |
| 799 | + append bss_conf "rnr=$rnr" "$N" |
| 800 | + fi |
| 801 | + |
| 802 | bss_md5sum="$(echo $bss_conf | md5sum | cut -d" " -f1)" |
| 803 | append bss_conf "config_id=$bss_md5sum" "$N" |
| 804 | |
developer | d469bb9 | 2024-03-01 08:59:08 +0800 | [diff] [blame^] | 805 | @@ -1246,6 +1359,7 @@ wpa_supplicant_prepare_interface() { |
developer | 18015ad | 2023-07-13 13:18:19 +0800 | [diff] [blame] | 806 | country_str="country=$country" |
| 807 | } |
| 808 | |
developer | 2cf3f4c | 2023-07-24 16:58:25 +0800 | [diff] [blame] | 809 | + local tx_queue_data2_burst="tx_queue_data2_burst=0" |
developer | 18015ad | 2023-07-13 13:18:19 +0800 | [diff] [blame] | 810 | multiap_flag_file="${_config}.is_multiap" |
| 811 | if [ "$multi_ap" = "1" ]; then |
| 812 | touch "$multiap_flag_file" |
developer | d469bb9 | 2024-03-01 08:59:08 +0800 | [diff] [blame^] | 813 | @@ -1257,6 +1371,7 @@ wpa_supplicant_prepare_interface() { |
developer | 18015ad | 2023-07-13 13:18:19 +0800 | [diff] [blame] | 814 | ${scan_list:+freq_list=$scan_list} |
| 815 | $ap_scan |
| 816 | $country_str |
| 817 | +$tx_queue_data2_burst |
| 818 | EOF |
| 819 | return 0 |
| 820 | } |
developer | d469bb9 | 2024-03-01 08:59:08 +0800 | [diff] [blame^] | 821 | @@ -1528,12 +1643,39 @@ wpa_supplicant_add_network() { |
developer | 7450311 | 2023-06-29 17:34:49 +0800 | [diff] [blame] | 822 | ;; |
| 823 | esac |
| 824 | |
developer | bb29b5e | 2023-07-25 20:41:04 +0800 | [diff] [blame] | 825 | - [ "$wpa_cipher" = GCMP ] && { |
| 826 | - append network_data "pairwise=GCMP" "$N$T" |
| 827 | - append network_data "group=GCMP" "$N$T" |
| 828 | - } |
developer | 7450311 | 2023-06-29 17:34:49 +0800 | [diff] [blame] | 829 | + json_get_values pairwise pairwise |
developer | 875fbb7 | 2023-12-13 15:49:01 +0800 | [diff] [blame] | 830 | + json_get_vars group_cipher group_mgmt_cipher |
developer | 9097e5e | 2023-07-19 10:22:24 +0800 | [diff] [blame] | 831 | + if [ -n "$pairwise" ]; then |
| 832 | + case "$pairwise" in |
| 833 | + *tkip+aes|*tkip+ccmp|*aes+tkip|*ccmp+tkip) |
| 834 | + wpa_cipher="CCMP TKIP" |
| 835 | + ;; |
| 836 | + *ccmp256) |
| 837 | + wpa_cipher="CCMP-256" |
| 838 | + ;; |
| 839 | + *aes|*ccmp) |
| 840 | + wpa_cipher="CCMP" |
| 841 | + ;; |
| 842 | + *tkip) |
| 843 | + wpa_cipher="TKIP" |
| 844 | + ;; |
| 845 | + *gcmp256) |
| 846 | + wpa_cipher="GCMP-256" |
| 847 | + ;; |
| 848 | + *gcmp) |
| 849 | + wpa_cipher="GCMP" |
| 850 | + ;; |
| 851 | + *) |
| 852 | + wpa_cipher="" |
| 853 | + ;; |
| 854 | + esac |
| 855 | + fi |
developer | 7450311 | 2023-06-29 17:34:49 +0800 | [diff] [blame] | 856 | + [ -n "$wpa_cipher" ] && wpa_pairwise="$wpa_cipher" |
developer | 7450311 | 2023-06-29 17:34:49 +0800 | [diff] [blame] | 857 | |
| 858 | [ "$mode" = mesh ] || { |
| 859 | + json_get_values sae_groups sae_groups |
| 860 | + json_get_values owe_groups owe_groups |
| 861 | + |
| 862 | case "$wpa" in |
| 863 | 1) |
| 864 | append network_data "proto=WPA" "$N$T" |
developer | d469bb9 | 2024-03-01 08:59:08 +0800 | [diff] [blame^] | 865 | @@ -1543,12 +1685,58 @@ wpa_supplicant_add_network() { |
developer | 7450311 | 2023-06-29 17:34:49 +0800 | [diff] [blame] | 866 | ;; |
| 867 | esac |
| 868 | |
| 869 | + [ -n "$wpa_pairwise" ] && append network_data "pairwise=$wpa_pairwise" "$N$T" |
| 870 | + [ -z "$group_cipher" ] && group_cipher="$wpa_cipher" |
| 871 | + |
| 872 | + if [ -n "$sae_groups" -o -n "$owe_groups" ]; then |
| 873 | + case "$auth_type" in |
| 874 | + sae*) |
| 875 | + echo "sae_groups=$sae_groups" >> "$_config" |
| 876 | + append network_data "group=$group_cipher" "$N$T" |
| 877 | + ;; |
| 878 | + owe) |
| 879 | + append network_data "owe_group=$owe_groups" "$N$T" |
| 880 | + append network_data "group=$group_cipher" "$N$T" |
| 881 | + ;; |
| 882 | + esac |
| 883 | + fi |
| 884 | + |
| 885 | + # RSN -> allow management frame protection |
| 886 | case "$ieee80211w" in |
| 887 | [012]) |
| 888 | - [ "$wpa" -ge 2 ] && append network_data "ieee80211w=$ieee80211w" "$N$T" |
| 889 | + json_get_vars ieee80211w_mgmt_cipher ieee80211w_max_timeout ieee80211w_retry_timeout beacon_prot |
| 890 | + append network_data "ieee80211w=$ieee80211w" "$N$T" |
| 891 | + [ "$ieee80211w" -gt "0" ] && { |
developer | 875fbb7 | 2023-12-13 15:49:01 +0800 | [diff] [blame] | 892 | + if [ -z "$group_mgmt_cipher" ]; then |
| 893 | + case "$group_cipher" in |
| 894 | + CCMP-256) |
| 895 | + ieee80211w_mgmt_cipher="BIP-CMAC-256" |
| 896 | + ;; |
| 897 | + CCMP) |
| 898 | + ieee80211w_mgmt_cipher="AES-128-CMAC" |
| 899 | + ;; |
| 900 | + GCMP-256) |
| 901 | + ieee80211w_mgmt_cipher="BIP-GMAC-256" |
| 902 | + ;; |
| 903 | + GCMP) |
| 904 | + ieee80211w_mgmt_cipher="BIP-GMAC-128" |
| 905 | + ;; |
| 906 | + esac |
| 907 | + else |
| 908 | + ieee80211w_mgmt_cipher="$group_mgmt_cipher" |
| 909 | + fi |
developer | 7450311 | 2023-06-29 17:34:49 +0800 | [diff] [blame] | 910 | + if [ "$auth_type" = "eap192" ]; then |
| 911 | + append network_data "group_mgmt=BIP-GMAC-256" "$N$T" |
| 912 | + else |
| 913 | + append network_data "group_mgmt=${ieee80211w_mgmt_cipher:-AES-128-CMAC}" "$N$T" |
| 914 | + fi |
| 915 | + [ -n "$beacon_prot" ] && \ |
| 916 | + append network_data "beacon_prot=$beacon_prot" "$N$T" |
| 917 | + } |
| 918 | ;; |
| 919 | esac |
| 920 | } |
| 921 | + |
| 922 | [ -n "$bssid" ] && append network_data "bssid=$bssid" "$N$T" |
| 923 | [ -n "$beacon_int" ] && append network_data "beacon_int=$beacon_int" "$N$T" |
| 924 | |
developer | d469bb9 | 2024-03-01 08:59:08 +0800 | [diff] [blame^] | 925 | @@ -1559,6 +1747,17 @@ wpa_supplicant_add_network() { |
developer | 8240889 | 2023-03-27 15:09:00 +0800 | [diff] [blame] | 926 | [ -n "$bssid_blacklist" ] && append network_data "bssid_blacklist=$bssid_blacklist" "$N$T" |
| 927 | [ -n "$bssid_whitelist" ] && append network_data "bssid_whitelist=$bssid_whitelist" "$N$T" |
| 928 | |
developer | 8240889 | 2023-03-27 15:09:00 +0800 | [diff] [blame] | 929 | + local disable_he |
| 930 | + local disable_vht |
| 931 | + local disable_ht |
developer | 8240889 | 2023-03-27 15:09:00 +0800 | [diff] [blame] | 932 | + json_get_vars disable_he |
| 933 | + json_get_vars disable_vht |
| 934 | + json_get_vars disable_ht |
| 935 | + |
developer | 8240889 | 2023-03-27 15:09:00 +0800 | [diff] [blame] | 936 | + [ -n "$disable_he" ] && append network_data "disable_he=$disable_he" "$N$T" |
| 937 | + [ -n "$disable_vht" ] && append network_data "disable_vht=$disable_vht" "$N$T" |
| 938 | + [ -n "$disable_ht" ] && append network_data "disable_ht=$disable_ht" "$N$T" |
| 939 | + |
| 940 | [ -n "$basic_rate" ] && { |
| 941 | local br rate_list= |
| 942 | for br in $basic_rate; do |
developer | d469bb9 | 2024-03-01 08:59:08 +0800 | [diff] [blame^] | 943 | @@ -1573,6 +1772,11 @@ wpa_supplicant_add_network() { |
developer | 85839fe | 2023-02-23 10:32:51 +0800 | [diff] [blame] | 944 | append network_data "mcast_rate=$mc_rate" "$N$T" |
| 945 | } |
| 946 | |
| 947 | + if [ "$auth_type" = "sae" ]; then |
| 948 | + json_get_vars sae_pwe sae_pwe |
| 949 | + [ -n "$sae_pwe" ] && echo "sae_pwe=$sae_pwe" >> "$_config" |
| 950 | + fi |
| 951 | + |
| 952 | if [ "$key_mgmt" = "WPS" ]; then |
| 953 | echo "wps_cred_processing=1" >> "$_config" |
| 954 | else |
developer | d469bb9 | 2024-03-01 08:59:08 +0800 | [diff] [blame^] | 955 | |