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