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